Disable command
#1

How to disable command when player death?

I tried when player health is below 1, he can't use command, but it didn't work and he still can use it.
Like:

PHP код:
    new Float:health;
    
GetPlayerHealth(playeridhealth);
    if(
health 0) return SendClienMessage(playerid"You cannot use command while dead"); 
Reply
#2

PHP код:
if( GetPlayerState(playerid) != PLAYER_STATE_SPAWNED 
Reply
#3

This shows me the error even when player still alive.
Reply
#4

Код:
if(GetPlayerState(playerid) != 	PLAYER_STATE_WASTED)
That should work. I believe PLAYER_STATE_WASTED is called on death
Reply
#5

still same
Reply
#6

Show us how you are using it in your command.
Reply
#7

I don't know if I'm doing this right, but I did like this.

PHP код:
COMMAND:bk(playeridparams[])
{
    if(!
IsPlayerCOP(playerid)) return SendClientError(playerid"You are not LSPD!");
    if(
GetPlayerState(playerid) !=     PLAYER_STATE_WASTED) return SendClientError(playerid"You cannot use this command while dead");
... and 
so on 
Reply
#8

do it like this:
PHP код:
if(GetPlayerState(playerid) == PLAYER_STATE_WASTED) return SendClientError(playerid"You cannot use this command while dead"); 
Reply
#9

thanks fixed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)