• Player joined for the first time hook?
    5 replies, posted
hey i have tons of ideas for my darkrp server one of them was to make the players job visitor. but if they leave then join the server again some day. they will be citizen.
They could join and then leave and reconnect all within like 10 minutes :) But use SetPData() on the player, that saves over sessions
[QUOTE=Exho;46245384]They could join and then leave and reconnect all within like 10 minutes :) But use SetPData() on the player, that saves over sessions[/QUOTE] thanks. do u know how i would use it? the tut on the wiki not very useful [CODE] player.GetByID( 1 ):SetPData( "money", 100 ) [/CODE] if they have not joined i set to this job. then if they have joined before set to the other job?
[QUOTE=TrippleT;46245496]thanks. do u know how i would use it? the tut on the wiki not very useful [CODE] player.GetByID( 1 ):SetPData( "money", 100 ) [/CODE] if they have not joined i set to this job. then if they have joined before set to the other job?[/QUOTE] Store all players that have connected before in either a TXT file or SQL database. (PlayerInitialSpawn hook) Read the TXT/SQL and check if the player's SteamID is in it. If not, run the code for one job. If so, run the code for another job etc.
[lua]hook.Add("PlayerInitialSpawn", "FirstJoin", function(ply) if !ply:GetPData("bool") then ply:SetPData("bool", true) print("first time joining!") else print("ive joined before") end end)[/lua] idk if this works
[QUOTE=zerothefallen;46245615][lua]hook.Add("PlayerInitialSpawn", "FirstJoin", function(ply) if !ply:GetPData("bool") then ply:SetPData("bool", true) print("first time joining!") else print("ive joined before") end end)[/lua] idk if this works[/QUOTE] ok now i get it thanks!
Sorry, you need to Log In to post a reply to this thread.