How could i make it so when my entity is hit with the weapon "weapon_pick" it puts nothing or metal in their itemstore inventory
To add an item to the inventory you do
pl.Inventory:AddItem( metal )
If you have this function inside the entity folder ENTITY/OnTakeDamage
After that you just do data:GetAttacker():GetActiveWeapon() == "weapon_pick" inside the ^ function, after this just do what you want. Example:
function ENT:OnTakeDamage( data )
if data:GetAttacker():GetActiveWeapon() == "weapon_pick" then
data:GetAttacker().Inventory:AddItem( metal )
end
end
Data is CTakeDamageInfo ( Category ), if you made the "mine able rock" yourself and have little knowledge of lua you should be able to figure this out. GetAttacker() will return the entity that attacked your rock, and after this you can use that player as a userdata value (the same as pl, ply, etc), and can call functions on that player.
If you still don't understand how to edit the base entity file, use GM/EntityTakeDamage
Thank you, I will test this out
Sorry, you need to Log In to post a reply to this thread.