• Charges System - Variables Query
    5 replies, posted
[CODE]ITEM.Name = 'Juggernaut (+100 Health)' ITEM.Price = 25 ITEM.Model = 'models/weapons/w_shotgun.mdl' ITEM.Health= '200' local i function ITEM:OnBuy(ply) ply:SetMaxHealth(self.Health) i = 0 end function ITEM:PlayerDeath(ply) i+1 if( i >= 5 ) then ply:SetMaxHealth(100) ply:PS_TakeItem(self.ID) end end[/CODE] I want the script to, when bought, the player that bought it will get increased health for x(5 in this case) amount of lives Does the i variable need to be a SetNetworkedInt? So the counter would only apply to the player that bought the item? Or would the script function correctly? (This is a item script for Pointshop)
Why would you network players health while it's Shared ?. Doign SetMaxHealth or SetHealth sends it automatically to all the players.
[QUOTE=Netheous;40947449]Why would you network players health while it's Shared ?. Doign SetMaxHealth or SetHealth sends it automatically to all the players.[/QUOTE] No, I think you missed the problem/question. The main thing at hand here is the counter. Say if multiple people have the same item, will the counters interfere with each other? Or will the counter only run for the player who bought it? [CODE]local i function ITEM:OnBuy(ply) i = 0 end function ITEM:PlayerDeath(ply) i+1 if( i >= 5 ) then --do something end end[/CODE] Focus'd code^^
ply.i = 0 in PlayerInitialSpawn Would be different if it was client side, but it's serverside.
It still increments whenever ANY player dies, I only want to counter to increment when the player who bought it dies, can anyone help?
Read the post above you and you'll get the answer.
Sorry, you need to Log In to post a reply to this thread.