I had a similar problem with my plugin (custom items that can be dropped and picked up). I simply made a bool:canpickup[33] that I set to false for the player when someone drops something. It is set back to true 0.3 seconds later (item is dropped with a 400 velocity in the direction the player is aiming, you may need to alter the timing if the weapon is dropped faster or slower).
The top of public pfn_touch(ptr, ptd) looks like this for my plugin: Code:
viola, no more premature picking up stuff. |
DopeFish, how do I set that per-player?...how do I find when the user drops and item to be able to block it?
Another question...is there a way to get entity data to get ACTUALLY what is on the ground? -- say, a colt on ground has silencer on it, and 13 bullets, and 40 in the spare clips?...I want to give the player THAT weapon...and if they run out they can drop the empty item? |
in my case it was easy since they had to use a menu command or a bind to drop the item, you may need to hook the drop command. this code snippet may help you further:
Code:
I wrote it off the top of my head and copied some stuff from my plugins so some things may be needless, but I think you'll get the generel idea how it works. hope this helps. The second part of the question is a little harder for me since I've never coded that kind of stuff, "Jhonny got his gun" would definatly know an answer to that question. |
wow, thanks.
Forgot about the register_clcmd function...(doh!) I used to work/learn amx 24/7 but I've been working on websites, etc and AMXX .16 was unstable for me so I went back to old stuff...and I'm starting again working on amxx plugins anticipating the .20 release. |
btw, thanks guys...
heres my code so far. Code:
My only problems now are getting rid of the entity that just got picked up, and making sure the gun has the same ammo it got dropped with...and making a menu frontend to make sure they can buy multiple weapons and also pick them up. Maybe I should make a cvar for multi_canpickup, multi_canbuy? |
nooooo u dont get rid of the entity...u just make it invisible and movetype_follow and aiment as the player
|
wtf, you just lost me...
|
you have to remove the weapon off the ground once you give it to the player.
there is code in CSDM to show you how to do this: look in safe_rment and replaceWeapon (just strip out the code that creates a fake weapon to replace it) |
| All times are GMT -4. The time now is 10:58. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.