So, I installed a addon where you can spawn in armor and you press e and it gives you armor, I have it set where you can spawn the armor using the f4 menu darkrp but, once they spawn it and have used the armor they can spawn more.
I want to make it where they cant spawn anymore armor entities until they have died. Any idea on how to code it and what hooks and variables are being used, I can find anything that could work.
https://steamcommunity.com/sharedfiles/filedetails/?id=151830991
heres the addon.
Put that into your shipment code.
customCheck = function(ply) return ply.buyableKevlar end,
onBought = function(ply, shipment, ent) ply.buyableKevlar = false end,
CustomCheckFailMsg = "You can buy kevlar only once per lifetime!"
and that into your lua/autorun/serverside
hook.Add("PlayerSpawn","Kevlar_ResetVariable",function(ply)
if IsValid(ply) then
ply.buyableKevlar = true
end
end)
Little bit all over the place, but should work.
Code breakdown:
Shipment customCheck will return whenever buyableKevlar is set to, either true or false. True = allows you to buy stuff
onBought is called when you buy stuff successfully, we set the buyable kevlar variable to false then, disallowing purchase for future
CustomCheckFailMsg is just an information for players, and finally, the hook makes it so on each spawn your var is reset back to true.
Sorry, you need to Log In to post a reply to this thread.