• SetPData / GetPData no working properly ?
    3 replies, posted
Hello i've been having some troubles with PData because it's simply not working on a listen server or a dedicated server... For example: [code] hook.Add( "PlayerDisconnected", "PlDisctwo", function( pl ) for _, v in pairs( player.GetAll() ) do if ( v:GetPData("ShowSid") == 1 ) then v:ChatPrint( pl:GetName().. ": " ..pl:SteamID() ) end end end ) hook.Add( "PlayerSay", "PlSaytwo", function (ply, msg, team) if msg == "!hidesid" then ply:SetPData("ShowSid",0) ply:ChatPrint( "Disabled ShowSid" ) end if msg == "!showsid" then ply:SetPData("ShowSid",1) ply:ChatPrint( "Enabled ShowSid" ) end end )[/code] Here i try to make script that shows a players SteamID when he leave to players that have typed "!showsid" in chat. I used PData because i don't want players to have to type the command everytime the server restarts or the map changes. The script is running and i get no errors, appearently "v:GetPData("ShowSid") == 1" is returning as nil cause SetPData isn't setting anything
bump
GetPData returns a string. Typecast it to a number to compare it to 1, or enclose the 1 in ".
lol thanks i believe its working... kinda silly >.<
Sorry, you need to Log In to post a reply to this thread.