So I am trying to make a addon and there is problems with the pdata basically when you kill someone it adds points to the the pdata and on the clientside it shows the points on a draw hook but it doesn't work and it says nil
Client side file:
[CODE]function BountyCL ()
local ply = LocalPlayer()
draw.SimpleText(ply:GetPData( "bounty", 0), "Default", 400,ScrH()-80, Color(155,255,255,245) )
end
hook.Add("HUDPaint", "BountyCLient", BountyCL)[/CODE]
Server side file:
[CODE]hook.Add("PlayerDeath", "bnsys", function( ply, wep, killer )
if IsValid(killer) and killer:IsPlayer() and killer != ply and not killer:isCP() then
killer:SetPData( "bounty", 100 )
end
end)[/CODE]
PData isn't networked. Try using ply:GetNWint/ply:SetNWInt
Yes but I want it to save the points when a player gets off and back on
[QUOTE=DeadShotKillz;48419491]Yes but I want it to save the points when a player gets off and back on[/QUOTE]
Network a var that has its value as the PData then.
[lua]ply:SetNWInt( "bounty", ply:GetPData( "bounty", 0) )[/lua]
Ok I got that solved out but how do I make a number on a hud for example like if it was 12,000$ make it 12k
[QUOTE=Mooda Looda;48419843]Network a var that has its value as the PData then.
[lua]ply:SetNWInt( "bounty", ply:GetPData( "bounty", 0) )[/lua][/QUOTE]
Dont NWs get reset upron rejoining?
[editline]10th August 2015[/editline]
[QUOTE=DeadShotKillz;48420695]Ok I got that solved out but how do I make a number on a hud for example like if it was 12,000$ make it 12k[/QUOTE]
make a check for it to be bigger than 1000, and use string.sub to replace the last 3 numbers with "K".
Sorry, you need to Log In to post a reply to this thread.