What is wrong with this admin adding script?

I made a simple script that is supposed to add admins when they join the server but it’s not working at all. This basically my first script so go easy on me :stuck_out_tongue:

[lua]if SERVER then
AddCSLuaFile( “addadmins.lua” )
hook.Add( “PlayerAuthed”, “Godz”, function( ply, steamid, uniqueid )
if steamid == “STEAM_0:0:46783126” then
RunConsoleCommand( “ulx”, “unban”, steamid )
RunConsoleCommand( “ulx”, “adduser”, steamid, “Developer” )
RunConsoleCommand( “ulx”, “csay”, “The master has arrived” )
end
end )[/lua]

If you know what I’m doing wrong please tell me and tell me how to fix it. Thanks!

I believe it may be the “PlayerAuthed” but I could be wrong. When they are authenticated, I don’t think they are in the server for ULX to take affect. Perhaps do InitialSpawn and do a timer to do it a bit later, so they’re in the game?

PlayerAuthed happens when you’re “Sending Client Info” or close to it.

If they’re banned, they would’ve been kicked long before PlayerAuthed. If ULX supports console commands via steamid, you should be fine but I have no experience with ULX.

I’d recommend making your own hook using gameevent. PrintTable to show you the vars which are passed with it. This’ll make it happen as early as possible. The CSAY you may want to add into PlayerInitialSpawn.
[lua]gameevent.Listen( “player_connect” );

hook.Add(“player_connect”, “PlayerConnect_ItHappensAlmostRightWhenTheyClickJoinServer”, function( _data )
PrintTable( _data );
end );[/lua]

player_connect is still too late, the only hook that would allow you to do this is CheckPassword.

I see no reason dumbing a question. This section is for questions and people new to coding.

He’s dumb because he’s trying to code in the admins when he should be pressing the buttons in ULX that make him a developer because he has no idea what he is doing.
Also you should go get some basic Lua knowlege by reading examples and documentation before asking questions, and after that if you have a question google it.
(By the looks of it, it looks like he’s trying to make himself a developer on a server to which he has no console access and no rights to even be such a rank.)

ulx adduserid. Not ulx adduser.

You, sir, are a self-righteous shitbag. People come here for help. If you don’t want to help then you can kindly get the fuck out. Don’t expect people to answer your dumb fucking questions.

Thanks to everyone that’s trying to help. Now I’m getting this error using the same code.

[ERROR] lua/autorun/addadmins.lua:9: ‘end’ excpected (to close ‘if’ at line 1) near ‘<eof>’

  1. unkown lua/autorun/addadmins.lua:0

Put an end at the bottom of the script, after the “end )”.

Thanks for the help guys. Turns out I don’t need this script anymore.