12.09.2009, 14:26
Try This:
pawn Код:
dcmd_farton(playerid,params[])
{
new tmp2[300],tmp[300], Index;
tmp = strtok(params,Index), tmp2 = strtok(params,Index);
new id = strval(tmp);
if(IsPlayerAdminLevel(playerid,2))
{
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_RED,"That Player Is Not Connected");
new string2[156], pname[24], pname2[24];
GetPlayerName(playerid, pname, 24);
GetPlayerName(id, pname2, 24);
new Float:health;
GetPlayerHealth(id,health);
health -= 5; // Put this, so the variable will change. And not only return the new variable value if you do -5.
SetPlayerHealth(id,health);
format(string2, sizeof(string2), "Admin %s farted on %s (%d Health Left)",pname,pname2,floatround(health));
SendClientMessageToAll(COLOR_RED,string2);
}
else
{
SendClientMessage(playerid,COLOR_RED,"You must be Admin Level 2 to do this.");
}
return 1;
}