Posts: 591
Threads: 150
Joined: Sep 2013
Reputation:
0
how to make a command for admins to decrease the target id's health step by step depends on how many seconds i put in my script.
example:
/decrease
SendClientMessage: Usage - /decrease [playerid]
/decrease 3
makes the playerid's health automatically decreases 5% per 10 seconds
Posts: 403
Threads: 10
Joined: Oct 2013
pawn Код:
CMD:sethp(playerid, params[])
{
new string[128], playa, health;
if(sscanf(params, "ud", playa, health))
{
SendClientMessageEx(playerid, COLOR_GRAD2, "USAGE: /sethp [playerid] [health]");
return 1;
}
if (PlayerInfo[playerid][pAdmin] >= 4) {
if(IsPlayerConnected(playa)) {
if(playa != INVALID_PLAYER_ID)
{
SetPlayerHealth(playa, health);
format(string, sizeof(string), "You have set %s's health to %d.", GetPlayerNameEx(playa), health);
SendClientMessageEx(playerid, COLOR_WHITE, string);
}
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
}
else {
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}
Try it
Posts: 1,954
Threads: 79
Joined: Aug 2009
Reputation:
0
There's nothing complicated about it... Just put it in your code...
If you want to decrease ID 5's hp for 13.5 damage for 6 seconds you'd do /decreasehp 5 13.5 6