Thread: Optimize Plugin
View Single Post
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-17-2018 , 18:58   Re: Optimize Plugin
Reply With Quote #23

Quote:
Originally Posted by PurposeLessx View Post
I know I don't need check connected with is_user_alive.

My question is:

!is_user_alive && is_user_connected
Put some logic before posting, is_user_alive and !is_user_alive are both the same native, you're just using a negation mark.

PHP Code:
is_user_alive(id
This is what happens inside the AMXX module
Code:
pPlayer->ingame && pPlayer->IsAlive()

So in your case:

!is_user_alive would return true if either player is not connected or not alive.

What you're doing:

!is_user_alive(id) && is_user_connected(id)

What happens in the module:
Code:
pPlayer->ingame && !(pPlayer->IsAlive()) && pPlayer->ingame

So basically you're calling a native for nothing.

Last edited by edon1337; 07-17-2018 at 19:02.
edon1337 is offline