Hello so i have a deathrun server but i need the hats and weapons to be permanent so if you die you get it back at respawn, change team you get it, leave and rejoin you get it, etc and the only way to get rid of it is to holster it
This is the code i found on the website somwhere but i dont think it works properly since when it switches team i dont get it and somtimes at respawn i dont get it.
Heres my file.
[CODE]ITEM.Name = 'Butterfly'
ITEM.Price = 10000
ITEM.Model = 'models/weapons/w_csgo_butterfly.mdl'
ITEM.WeaponClass = 'csgo_butterfly'
ITEM.SingleUse = false
function ITEM:OnBuy(ply)
ply:Give(self.WeaponClass)
end
function ITEM:OnEquip(ply)
ply:Give(self.WeaponClass)
end
function ITEM:OnHolster(ply)
ply:StripWeapon(self.WeaponClass)
end
function ITEM:OnSell(ply)
ply:StripWeapon(self.WeaponClass)
end[/CODE]
I have never coded lua before so i dont know what the code means maybe the code isnt for this even.
Again, it's probably a problem with the gamemode since it works on Sandbox and TTT fine, but we don't know the Deathrun gamemode
[QUOTE=code_gs;50630023]Again, it's probably a problem with the gamemode since it works on Sandbox and TTT fine, but we don't know the Deathrun gamemode[/QUOTE]
it works with pointshop2 but oh well :(
Try adding this to the item:
[code]function ITEM:PlayerSpawn(ply)
ply:Give(self.WeaponClass)
end[/code]
[QUOTE=joealdred;50630041]Try adding this to the item:
[code]function ITEM:PlayerSpawn(ply)
ply:Give(self.WeaponClass)
end[/code][/QUOTE]
where would i add it?
Just into the item like the rest of the functions.
EDIT: Like this:
[code]ITEM.Name = 'Butterfly'
ITEM.Price = 10000
ITEM.Model = 'models/weapons/w_csgo_butterfly.mdl'
ITEM.WeaponClass = 'csgo_butterfly'
ITEM.SingleUse = false
function ITEM:OnBuy(ply)
ply:Give(self.WeaponClass)
end
function ITEM:OnEquip(ply)
ply:Give(self.WeaponClass)
end
function ITEM:OnHolster(ply)
ply:StripWeapon(self.WeaponClass)
end
function ITEM:OnSell(ply)
ply:StripWeapon(self.WeaponClass)
end
function ITEM:PlayerSpawn(ply)
ply:Give(self.WeaponClass)
end[/code]
[QUOTE=joealdred;50630056]Just into the item like the rest of the functions.
EDIT: Like this:
[code]ITEM.Name = 'Butterfly'
ITEM.Price = 10000
ITEM.Model = 'models/weapons/w_csgo_butterfly.mdl'
ITEM.WeaponClass = 'csgo_butterfly'
ITEM.SingleUse = false
function ITEM:OnBuy(ply)
ply:Give(self.WeaponClass)
end
function ITEM:OnEquip(ply)
ply:Give(self.WeaponClass)
end
function ITEM:OnHolster(ply)
ply:StripWeapon(self.WeaponClass)
end
function ITEM:OnSell(ply)
ply:StripWeapon(self.WeaponClass)
end
function ITEM:PlayerSpawn(ply)
ply:Give(self.WeaponClass)
end[/code][/QUOTE]
OMG Thanks it worked! But how do i add it to the hats?
Have the PlayerSpawn method call the OnEquip, like
[code]function ITEM:PlayerSpawn(ply)
self:OnEquip(ply)
end[/code]
[QUOTE=code_gs;50630281]Have the PlayerSpawn method call the OnEquip, like
[code]function ITEM:PlayerSpawn(ply)
self:OnEquip(ply)
end[/code][/QUOTE]
I just add this into the hats?
Yes
[QUOTE=code_gs;50630389]Yes[/QUOTE]
ok thanks i think it worked :)
Sorry, you need to Log In to post a reply to this thread.