Hey guys once again I’m in need of help. I have a script that shows when a player connects to my server + plays a sound, I’ve edited it to make it play a sound depending on their rank ( Admin or not ) but I’ve got it so it checks local players so if your an admin on the server you’ll always hear the admin connecting sound where as the none admins will hear the member connecting sound.
What I am asking here is there a way to check if the player connecting to the server is admin or not a play the sound depending on his rank and not everyones on the server?
This is the code:
// Connect function player_connect( data ) local ply = LocalPlayer() local name1 = data:ReadString() local nickteamcolour1 = team.GetColor(data:ReadShort()) chat.AddText( Color( 15, 15, 15 ), "[Server] ", nickteamcolour1, name1, Color( 255, 255, 255 ), " has joined the server." ) if ply:IsAdmin() then surface.PlaySound( "ag/WelcomeAdmin.mp3" ) elseif ply:IsUserGroup( "user" ) or ply:IsUserGroup( "respected" ) then surface.PlaySound( "ag/MemberJoined.mp3" ) end end usermessage.Hook("player_connect", player_connect) // Disconnect function player_disconnect( data ) local name2 = data:ReadString() local nickteamcolour2 = team.GetColor(data:ReadShort()) chat.AddText( Color( 15, 15, 15 ), "[Server] ", nickteamcolour2, name2, Color( 255, 255, 255 ), " has left the server." ) surface.PlaySound( "garrysmod/save_load2.wav" ) end usermessage.Hook("player_disconnect", player_disconnect)