Posts: 1,063
Threads: 278
Joined: Mar 2010
Reputation:
0
I have a command there i want to do so only it can be used on dead people, if the player is alive and he type the command like
/restinpiece id/nick
he will get a msg like
%s is alive, you cant use this command
Posts: 227
Threads: 37
Joined: Sep 2013
PHP код:
#include <a_samp>
new DEAD[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
DEAD[playerid] = 0;//player is alive
return 1;
}
public OnPlayerSpawn(playerid)
{
DEAD[playerid] = 0;//player is alive
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
DEAD[playerid] = 1;//player is dead
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(DEAD[playerid] == 1)
{
//dead commands
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
return 1;
}
}
else
{
//alive commands
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
}
}
return 0;
}