Ulysses
General => Developers Corner => Topic started by: blackfire88 on January 09, 2012, 02:30:53 PM
-
function ulx.changetorp( calling_ply )
local curgame = GetConVarString("sv_gamemode")
local shouldbe = "darkrp"
if curgame = shouldbe then
ULib.tsayError( calling_ply, "Server is already in RP!" )
else
RunConsoleCommand("changegamemode", game.GetMap .. " darkrp")
ulx.fancyLogAdmin( calling_ply, "#A changed to RP." )
end
local changetorp = ulx.command( "Extras", "ulx changetorp", ulx.changetorp, "!changetorp" )
changetorp:defaultAccess( ULib.ACCESS_ADMIN )
changetorp:help( "Changes to RP" )
Its not registering! What have I done wrong :(
-
function ulx.changetorp( calling_ply )
local curgame = GetConVarString("sv_gamemode")
local shouldbe = "darkrp"
if curgame = shouldbe then
ULib.tsayError( calling_ply, "Server is already in RP!" )
else
RunConsoleCommand("changegamemode", game.GetMap(), "darkrp")
ulx.fancyLogAdmin( calling_ply, "#A changed to RP." )
end
end
local changetorp = ulx.command( "Extras", "ulx changetorp", ulx.changetorp, "!changetorp" )
changetorp:defaultAccess( ULib.ACCESS_ADMIN )
changetorp:help( "Changes to RP" )
Fixed - You forgot an end.
-
Also game.GetMap should be game.GetMap()
Have to watch that syntax :)
Wouldn't a better command argument be
RunConsoleCommand("changegamemode", game.GetMap(), "darkrp") ?
According to the Gmod wiki, its runconsolecommand(command, parm1, parm2) -
Seems using concatenation ".." isn't optimal if a command allows for multiple parameters.
-
Ahh yeah... modified my post with those as well. I didn't double check for more errors.