SA-MP Forums Archive
Disable command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Disable command (/showthread.php?tid=657986)



Disable command - ServerFiles - 20.08.2018

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"); 



Re: Disable command - Shinja - 20.08.2018

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



Re: Disable command - ServerFiles - 20.08.2018

This shows me the error even when player still alive.


Re: Disable command - Shockey HD - 20.08.2018

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


Re: Disable command - ServerFiles - 20.08.2018

still same


Re: Disable command - Shockey HD - 20.08.2018

Show us how you are using it in your command.


Re: Disable command - ServerFiles - 20.08.2018

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 



Re: Disable command - jlalt - 20.08.2018

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



Re: Disable command - ServerFiles - 20.08.2018

thanks fixed