• Rcon function
    8 replies, posted
Hey guys, Im not very good a lua at all, but i have been trying to do more things myself, and not rely on purchasing scripts:P I'm trying to get it so that when an admin goes admin on duty, it will god him! Additional info: My server is running the latest darkrp, and no errors are being produced when i change to the job! [code] hook.Add('PlayerGod', 'setgod', function(ply) if ply:Team() == TEAM_SM or ply:Team() == TEAM_SA or ply:Team() == TEAM_SSA then RunConsoleCommand("ulx god", ply:Nick) end end)[/code] I may have been going about it the wrong way, so if you have any suggestions for it, it would be much appreciated! Thanks!
Check this thread: [url]http://www.facepunch.com/showthread.php?t=1377699[/url]
Or do a player check to see if they're admin or above then run the command. Also use elseif instead of or
[QUOTE=MrPlonker;44472847]Or do a player check to see if they're admin or above then run the command. [b]Also use elseif instead of or[/b][/QUOTE] Although not the prettiest thing to look at, it's just as good, if not better than your proposal.
Nothing suggested has worked so far, no errors either.. Thanks though!:P Any other ideas?
Change [b]ply:Nick[/b] to [b]ply:Nick()[/b] [lua]hook.Add('PlayerGod', 'setgod', function(ply) if ply:Team() == TEAM_SM or ply:Team() == TEAM_SA or ply:Team() == TEAM_SSA then RunConsoleCommand("ulx god", ply:Nick()) end end)[/lua]
You could use this? [url]http://wiki.darkrp.com/index.php/Hooks/shared/onplayerchangedteam[/url] with team.GetName(num) check if team name is == to admin job name, if true set god mode?
I dont think "PlayerGod" is even a hook, unless you've created it that is. Also you need a space after "ulx god" in RunConsoleCommand("ulx god", ply:Nick) otherwise you're running "ulx godGarry :D"
'ulx' is the actual concommand, not 'ulx god'. 'god' is the first argument to it. [lua]RunConsoleCommand('ulx', 'god', ply:Nick())[/lua] And as mentioned, 'PlayerGod' isn't a regular hook, are you sure it exists/is being called?
Sorry, you need to Log In to post a reply to this thread.