pawn Код:
//command text
new cmd[50], params[100];
new msg[180], id;
unformat(cmdtext, "s[50]S( )[100]",cmd,params);
if(strcmp(cmd, "/envenenar", true) == 0 || strcmp(cmd, "env", true) == 0)
{
if(sscanf(params, "d", id)) return SendClientMessage(playerid, -1, "USO: /env [id]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "ID OFFLINE");
new Float:pos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
if(!IsPlayerInRangeOfPoint(id, 5.0, pos[0], pos[1], pos[2]) return SendClientMessage(playerid, -1, "Player nгo estб prуximo!"):
format(msg, sizeof(msg), "%s lhe envenenou", Name(playerid));
SendClientMessage(id, -1, msg);
SendClientMessage(playerid, -1, "Vocк envenenou o player!"):
vene[id] = 0;
env = SetTimerEx("veneno", 1000, true, "d", id);
return 1;
}
pawn Код:
forward veneno(id);
public veneno(id)
{
new Float:vida;
GetPlayerHealth(id, vida);
SetPlayerHealth(id, vida - 5);
vene[id] ++;
if(vene[id] == 10)
{
KillTimer(env);
return 1;
}
return 1;
}
pawn Код:
stock Name(playerid)
{
new nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, sizeof(nome));
return nome;
}