attempting to optimize code
Is this the best way to elbow this code?
PHP Code:
|
Re: attempting to optimize code
Why are you checking g_isalive in every condition?
|
Re: attempting to optimize code
Not even close to good. This is somewhat better:
PHP Code:
|
Re: attempting to optimize code
Quote:
Quote:
|
Re: attempting to optimize code
No , it's not correct.
You are checking if equal to 200 but it can be more than 200 . He will have model only when has level 200 but no 201... And use cs_get_user_team instead, it returns correct teams. And why do you use g_isalive? Use directly is_user_alive , it's library native and is faster then plugin array. PHP Code:
|
Re: attempting to optimize code
Quote:
|
Re: attempting to optimize code
yes?
how plugin works: death - is_alive[id] = false; disconnect is_alive[id] = false; spawn - is_alive[id] = true; native_is_user_alive(id) return is_alive(id) when you use is_user_alive(id), don't you get already cached value? the thing is that when you use is_alive , you acces global array from plugin but when you call native is_user_alive, you call array from module, which is faster. |
Re: attempting to optimize code
Quote:
https://forums.alliedmods.net/showth...hlight=Caching https://forums.alliedmods.net/showthread.php?t=88792 |
Re: attempting to optimize code
On usual functions, caching alive status is useless. It's somehow usefull on per frame forwards.
|
Re: attempting to optimize code
Quote:
Quote:
|
| All times are GMT -4. The time now is 18:39. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.