Get weapon entity index when dropped
So i'd like to get the index of a certain weapon, so that i can do stuff with this entity.
Example: Let's say i gave this player who has the index in a function an m4, and he decides to drop it. When he drops it, set glow to that weapon if it's an m4, and the owner of the m4 is correct. Don't set glow on other players m4 when they drop theirs. Only if it's the player that i previously chose in my function. No need to teach me how to set glow on entities, i know that part. I just need to know how to detect weapon dropping, and checking who it belongs to, and storing the entity index of the weapon inside a variable so that i can do a bunch of stuff to it. |
Re: Get weapon entity index when dropped
From my last request
Code:
register_forward( FM_SetModel, "SetModel", 1); |
Re: Get weapon entity index when dropped
Quote:
|
Re: Get weapon entity index when dropped
Uhm.. This is making bugs that i've never seen before.. When i tried it, my screen like turned upside down.. or sideways :s.. I could walk around like that too.. Also i did not see my weapon. I'm suspecting there is something wrong with pev_health. When this happens, my health is set to 1, though i set health to 100 in the function. I noticed the value of "100" for pev_health that was wrong, and i changed it to a float value "100.0" from default "100", now i'm not even getting to the player menu.. This is really confusing. But.. the glow itself worked while my screen was twisted though :bee:
Here's a screenshot of it. http://steamcommunity.com/sharedfile.../?id=250330790 Getting no error logs when debugging, or any errors compiling. Plugin is not close to done.. i just started making it an hour ago, and all this happened when i ran it for the first time just to check that it was working as it should.. but here it is PHP Code:
|
Re: Get weapon entity index when dropped
There must be something that your not showing. It's usually related to a player's health being forcibly set to 0. Therefore if your inputting an integer where it's supposed to be a float, you'll end up with the wrong value.
|
Re: Get weapon entity index when dropped
Quote:
Edit: It's fixed. I was running the server in console mode, and i switched to gui, and it worked :s But i have no idea what caused this and probably will never know. |
Re: Get weapon entity index when dropped
Last question. How would i remove the glow? I know how i could do it inside the function, but i'm going to remove it on round end. my entity cannot be reached from there. It's only reached inside the function itself. I never work with entities.. So i feel pretty horrible at this. It's like the first day of coding when working with entities. :D But i gotta learn it sometime
|
Re: Get weapon entity index when dropped
Loop through all entites and do set_rendering(ent) on them
I can show code later when Im on my computer Edit: Code:
new Entity = -1; |
Re: Get weapon entity index when dropped
Quote:
|
| All times are GMT -4. The time now is 17:53. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.