22.12.2014, 21:17
Phew, the whole code is fucked up.
Here's a fix.
I have only fixed the errors, I didn't check wether the command actually works.
It should work though.
Here's a fix.
I have only fixed the errors, I didn't check wether the command actually works.
It should work though.
pawn Код:
CMD:sethp(playerid, params[], help)
{
if(PlayerInfo[playerid][pRank] == 2.6) {
new string[128],targetid,Float:Heal,Pname[MAX_PLAYER_NAME],Iname[MAX_PLAYER_NAME];
GetPlayerName(playerid,Pname,sizeof(Pname));
GetPlayerName(targetid,Iname,sizeof(Iname));
if(sscanf(params, "ud", targetid,Heal))
{
SendClientMessage(playerid,-1,"USAGE: /SetHealth (Player Name/ID) (Health)");
return 1;
}
else if(!IsPlayerConnected(targetid))
{
format(string,sizeof(string),"The Player ID (%d) is not connected to the server. You cannot heal them.",targetid);
SendClientMessage(playerid,-1,string);
return 1;
} else {
SetPlayerHealth(playerid,Heal);
format(string,sizeof(string),"You Have Set %s(%d) Health To %d",Iname,targetid,Heal);
SendClientMessage(playerid,-1,string);
format(string,sizeof(string),"%s(%d) Has Set Your Health To %d",Pname,playerid,Heal);
SendClientMessage(targetid,-1,string);
SetPlayerHealth(targetid, Heal);
}
}
return 1;
}