PHP Code:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#define red 0xFF0000FF
CMD:setarvida(playerid, params[])
{
if(!IsPlayerAdmin(playerid)
return SendClientMessage(playerid, red, "|ERRO| » Vocк nгo й admin rcon");
new player1, vida, string[128], Float:hp;
if(sscanf(params, "ud", player1, vida))
return SendClientMessage(playerid, red, "|USE| » /SetarVida [playerid] [quantia]");
if(player1 == INVALID_PLAYER_ID)
return SendClientMessage(playerid, red, "|ERRO| » O jogador nгo estб conectado.");
if(vida < 0 || vida > 100)
return SendClientMessage(playerid, red, "|ERRO| » Quantia invбlida. (Min: 1 - Max: 100)");
hp = float(vida);
format(string, sizeof(string), "Vocк definiu a vida de \"%s\" para: '%d'", pName(player1), vida);
SendClientMessage(playerid, 0xFFFF00FF, string);
if(player1 != playerid)
{
format(string, sizeof(string), "O Admin \"%s\" definiu sua vida para: '%d'", pName(playerid), vida);
SendClientMessage(player1, 0x00FF00FF, string);
}
SetPlayerHealth(player1, hp);
return 1;
}
stock pName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}