Posts: 20
Threads: 0
Joined: Sep 2014
pawn Код:
CMD:fullhealth(playerid, params[])
{
if (IsPlayerAdmin(playerid) == 1)
{
new command[56];
if (sscanf(params, "d", command)) return SendClientMessage(playerid, RED, "USAGE: /fullhealth [ID]");
else if (!strcmp(command, "d", true))
{
new playername[256];
new adminname[256];
new string[256];
SetPlayerHealth(command, 100);
GetPlayerName(command, playername, sizeof(playername));
format(string, sizeof(string), "*** Health has been set to 100", playername);
SendClientMessage(playerid, ORANGE, string);
GetPlayerName(playerid, adminname, sizeof(adminname));
format(string, sizeof(string), "*** 100% health set..", adminname);
SendClientMessage(command, ORANGE, string);
}
}
else
{
SendClientMessage(playerid, RED, "SERVER: Your health has been set by an admin");
}
return 1;
}
This script can only set the player health to 100.
Posts: 41
Threads: 11
Joined: Jul 2014
Reputation:
0
this is not working where i can add this in script?
Posts: 24
Threads: 3
Joined: Aug 2014
Reputation:
0
Add it on the bottom of the script and then compile it and it will work
Posts: 807
Threads: 10
Joined: Jan 2013
Reputation:
0
Don't use Ricagor's code it's highly inefficient. I doubt he even tested it. Look up the tutorials section, there's a fair few tutorials on basic commands. Setting health is one of them im sure
Posts: 20
Threads: 0
Joined: Sep 2014
Ok dude , use this:
pawn Код:
CMD:sethealth(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 3) {
new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(tmp) || isnull(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE:
/sethealth [playerid] [amount]");
if(strval(tmp2) < 0 || strval(tmp2) > 100 && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid, red, "ERROR: Invaild health amount");
new player1 = strval(tmp), health = strval(tmp2), string[128];
if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
CMDMessageToAdmins(playerid,"SETHEALTH");
format(string, sizeof(string), "You have set \"%s's\" health to '%d", pName(player1), health); SendClientMessage(playerid,blue,string);
if(player1 != playerid) { format(string,sizeof(string),"Administrator \"%s\" has set your health to '%d'", pName(playerid), health); SendClientMessage(player1,blue,string); }
return SetPlayerHealth(player1, health);
} else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
Posts: 20
Threads: 0
Joined: Sep 2014