• How to detect if a player has picked up a certain entity
    8 replies, posted
I am not sure where the thread for questions that don't need their own answers is so, I thought I would post here. I am using _Undefined's PointShop and I am looking for a way where if a player picks up a certain entity and has brought an item through the PointShop, it gives them something else. Undefined's OnEquip function works fine, but only with weapons you start with. Feedback is greatly appreciated.
Player Use -> PS_HasItem -> PS_TakeItem -> PS GiveItem?
[QUOTE=Lerpaderp;40115077]Player Use -> PS_HasItem -> PS_TakeItem -> PS GiveItem?[/QUOTE] I am not sure what you mean, there is no PS_HasItem, there is PS_HasItemEquipped but as I mentioned before, they already have the item equipped at the start of the round. I need something that can run a check when a player picks a up a certain gun.
If you mean how players can equip weapons laying around, you can hijack the pickup by overriding ply:Give(), in TTT, because TTT has its own weapon pickup script that relies on ply.Give
[QUOTE=Bletotum;40118561]If you mean how players can equip weapons laying around, you can hijack the pickup by overriding ply:Give(), in TTT, because TTT has its own weapon pickup script that relies on ply.Give[/QUOTE] No, not weapons that have already spawned as such. If the player buys 'item1' from the PointShop, he then equips the 'item1' in the PointShop. Then when he picks up 'weapon1' of the ground it will remove 'weapon1' and give him 'weapon2'
[IMG]http://fc04.deviantart.net/fs71/f/2013/030/a/a/download__2__by_n00kyava-d5t8glh.jpg[/IMG] Basically this. I believe he's talking about weapon skins, which I have on my server. You buy the skin in the shop and have it equipped. Whenever you pick up the weapon the skin is pertaining to, it will then turn it into the skin. So in the image, you buy the golden deagle skin, you pick up a deagle and it gives you the golden deagle skin. If this isn't what you want then I apologize but I think I have the jist of what you're asking.
[QUOTE=Nookyava;40124856] Basically this. I believe he's talking about weapon skins, which I have on my server. You buy the skin in the shop and have it equipped. Whenever you pick up the weapon the skin is pertaining to, it will then turn it into the skin. So in the image, you buy the golden deagle skin, you pick up a deagle and it gives you the golden deagle skin. If this isn't what you want then I apologize but I think I have the jist of what you're asking.[/QUOTE] This.
If this makes sense for what you are trying to accomplish. I recommend you edit the base weapon file for ttt. (weapon_tttbase) Specifically the SWEP:Equip( newowner ) function. Simply check what skin the player has equiped for self:GetClass( ). Then apply skin to the weapon.
[QUOTE=smithy285;40120708]No, not weapons that have already spawned as such. If the player buys 'item1' from the PointShop, he then equips the 'item1' in the PointShop. Then when he picks up 'weapon1' of the ground it will remove 'weapon1' and give him 'weapon2'[/QUOTE] TTT uses ply:Give() for ALL weapons picked off of the ground. [lua] local ply = FindMetaTable("Player") local oldgivefunction = ply.Give ply.Give = function(weapon) if weapon == "blah" && player has the upgrade etc then weapon = "upgraded blah" end oldgivefunction(self,weapon) end [/lua]
Sorry, you need to Log In to post a reply to this thread.