Optimizing - Remove dropped weapons
Hello!
Well it's pretty simple, the code I've made for deleting dropped weapons after a certain period works somewhat good but not enough. If you take a look at the the script you quickly notice how inefficient it is. Therefore I'm asking you for help! PHP Code:
a certain time has passed (defined by cvar). To check that the weapon hasn't been picked up under the time passed (time defined by cvar) the code checks if the origin of the entity has changed. For some reason the origin is only correct 50% of the times... |
Re: Optimizing - Remove dropped weapons
Welcome back, atomen. :)
All you need to do is modify this plugin: http://forums.alliedmods.net/showthread.php?t=49323 And add a set_task() instead of instantly removing the weapon. If the weaponbox entity is still valid (which means no one picked it up) then you remove it. |
Re: Optimizing - Remove dropped weapons
Thank you for your greeting!
Ok, I decided to optimize my code as good as possible and it has turned out pretty good though there's one small little problem... You can see I've marked 2 spots in the code and the code which I've marked, logs the entity number. For some reason the entity numbers on the SAME weapon differs: Code:
|
Re: Optimizing - Remove dropped weapons
Lol .. Making weapon think, engine removes it self :)
PHP Code:
|
Re: Optimizing - Remove dropped weapons
If you want instant remove :
PHP Code:
|
Re: Optimizing - Remove dropped weapons
No, I wan't the weapon to be removed after a certain time has passed(defined by cvar). And after the time has elapsed the plugin must check if the weapon has been picked up and then dropped during the time passed.
But how come the entities number differs? |
Re: Optimizing - Remove dropped weapons
@ xPaw
static szClassname[ 9 ]; // weaponbox -> static szClassname[ 10 ]; // weaponbox |
Re: Optimizing - Remove dropped weapons
@ConnorMcLeod: my bad :d
@atomen: use my code |
Re: Optimizing - Remove dropped weapons
Quote:
|
Re: Optimizing - Remove dropped weapons
If i remember, Ham_Spawn works only if you instantly remove the weaponbox, because right after it, the Think is not set so that the weaponbox will be removed.
|
| All times are GMT -4. The time now is 15:27. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.