AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   is_user_alive (https://forums.alliedmods.net/showthread.php?t=173785)

KamiN 12-10-2011 13:08

is_user_alive
 
Code:

Is_user_alive(id)
Checks is it player, is he connected and is he alive?
Or just is he connected and is he alive?

Arkshine 12-10-2011 13:17

Re: is_user_alive
 
Quote:

Checks is it player, is he connected and is he alive?
Or just is he connected and is he alive?
You're asking the same thing. :)

Anyway, if an user is alive... it means he's obviously connected. And this native is_user_alive, to check if someone is alive has to check before if he's connected.

Erox902 12-10-2011 13:18

Re: is_user_alive
 
It does check if he's alive and connected true.
Not sure if it checks whether or not the index is a player.

hleV 12-10-2011 13:26

Re: is_user_alive
 
If it's not a player, then ofc it's not alive.

Erox902 12-10-2011 13:29

Re: is_user_alive
 
Entities and bots can't be alive? :?

KamiN 12-10-2011 13:33

Re: is_user_alive
 
Quote:

Originally Posted by hleV (Post 1610898)
If it's not a player, then ofc it's not alive.

So if u already check with
Code:

is_user_alive(id)
checking with IsPlayer would be pointless, right?
Code:

#define IsPlayer(%1) (1<=%1<=g_max_clients)

new g_max_clients

public plugin_init() {
    g_max_clients = get_maxplayers()
}

if(IsPlayer(i) && is_user_alive(i))
{   
...
}


ConnorMcLeod 12-10-2011 14:32

Re: is_user_alive
 
Yes it is pointless, but anyway your code shouldn't call tha native on a non player entity, else it means your code has something wrong, and in that case an error will be generated.


All times are GMT -4. The time now is 12:10.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.