Author Topic: ULX Restartmap  (Read 7986 times)

0 Members and 1 Guest are viewing this topic.

Offline fackelkind

  • Newbie
  • *
  • Posts: 24
  • Karma: 4
ULX Restartmap
« on: July 10, 2006, 01:28:16 PM »
Hey a simples small script, which guves a vote to restart map:
Allows everybody to use !restart, if not a MAPADMIN is online, else just the MAPADMINS are allowed.


Code: [Select]
-- cc_ulxVotekick
function cc_ulxVoterestart( userid, args, argv, argc )
local target = _GetCurrentMap()
if target == nil then
return
end
        if hasAccess (userid, ACCESS_MAP) == false then
                for i = 1, _MaxPlayers() do
                        if hasAccess (i, ACCESS_MAP) == true then
                                _PrintMessage (userid, HUD_PRINTTALK, "You cannot perform this action, while an admin is online.")
                                return
                        end
                end
        end

menu_sendVote( ulx_voterestartCallback, _, "Restart " .. target .. "?", "Yes", target, "No", false )
end

function ulx_voterestartCallback( id )
if id == nil or id == ID_NONE or id == false then
ulx_tsay_all( "Voterestart unsuccessful." )
return
end

ulx_tsay_all( "Restarting map " .. id .. " in 5 seconds." )
AddTimer (5, 1, _ServerCommand, "changelevel " .. id .. "\n" )
end

ULX_CONCOMMAND( "ulx_restart", cc_ulxVoterestart, nil, "Gives the users a vote to restart the current map", 0, "!restart" )
« Last Edit: July 10, 2006, 02:05:43 PM by fackelkind »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Re: ULX Restartmap
« Reply #1 on: July 10, 2006, 04:34:08 PM »
Good job.
Experiencing God's grace one day at a time.

Offline sparts

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: ULX Restartmap
« Reply #2 on: August 05, 2006, 06:16:39 AM »
>< how do install it im a nooblet at this sry  :'(

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: ULX Restartmap
« Reply #3 on: August 05, 2006, 08:57:19 AM »
Copy and paste the above code into a file using notepad,
save it as something like 'restartmap.lua' or any other filename.lua you want
save it in gmod9/lua/ulx/modules
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Griff

  • Newbie
  • *
  • Posts: 40
  • Karma: 3
Re: ULX Restartmap
« Reply #4 on: August 05, 2006, 05:02:25 PM »
ehhhhh, so how do you combat noobs going
Quote
!restart
every 10 mins? could you put like a time on it? i.e. the restart is allowed every hour after the last restart?

Offline Ulrar

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: ULX Restartmap
« Reply #5 on: August 07, 2006, 12:55:38 PM »
!restart not fonctional for me, this is /lua/ULX/modules for ULX 2 ?

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: ULX Restartmap
« Reply #6 on: August 07, 2006, 05:10:23 PM »
PLEASE see the name of this forum

"Releases for ULX v1.*"

NOT "Releases for ULX v2"

There is no current place to post specific ULX v2 releases.
I'd recommend using the Ulib -> Releases section for now.
Once Megiddo gets back, if he wishes, he can make a ULX v2 releases section.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming