I have my own dedicated TTT server, but I want to be able to set the Karma for a specific player when they join my server. I also want it to set when a new map is selected.
Currently I am using ulx karma <playername> <playerkarma> using the ulx addon every map which is quite annoying to do every map.
I have tried putting the following in the init.lua for the terrortown game mode but it doesnt seem to work. I see the print message on the server console but the karma doesn't get set for the player.
local function spawn_kama_custom( ply )
print("setting karma")
ply:SetBaseKarma( 500 )
ply:SetLiveKarma( 500 )
end
hook.Add( "PlayerInitialSpawn", "TTTCUSTOMKARMA", spawn_kama_custom)
Can anyone tell me a better way do this? or tell me how to fix the code above.
TTT is overriding your option in the same hook: garrysmod/player_ext.lua at 7afc0e9627781656216c5bdd85729b64c6d2..
Use a 0-second timer inside of the hook. Make sure to check if the player is still valid.
I want to only set the karma for 1 person and leave the rest at 1000
He ment
hook.Add("PlayerInitialSpawn", "Whatever", function(ply)
timer.Simple(0, function() -- 0-0.2 usually works fine
-- <your code here>
end)
end)
Sorry, you need to Log In to post a reply to this thread.