16.07.2010, 14:26
pawn Код:
dcmd_health(playerid, params[])
{
new
giveplayerid, tmp[256], tmp2[256], idx,
amount, string[156];
tmp=strtok(params, idx); tmp2=strtok(params, idx);
if(!strlen(tmp) || !strlen(tmp2)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /health [playerid] [amount]");
giveplayerid=strval(tmp); amount=strval(tmp2);
if (!IsPlayerConnected(giveplayerid)) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
if (amount > 100) SendClientMessage(playerid, 0xFF0000AA, "Invalid health");
else
{
new Float:hh; GetPlayerHealth(playerid, hh);
SetPlayerHealth(giveplayerid, amount);
SetPlayerHealth(playerid, hh-10);
format(string,sizeof(string),"life's й [%i]",amount);
SendClientMessageToAll(COR_BRANCO, string);
}
return 1;
}
And I did not get the thing with the -10 HP. I just made that if you set someones health, your own health will be set 10 lower.