07.09.2013, 15:38
Well, I have a /health command, that's supposed to set the player's health to the amount I choose.
It somewhat works, but if I set someone's health to somewhere above 250 (not sure if 250 is the EXACT number, but I've noticed that it's something about it) it just doesn't set the health properly.
So if I set someone's health to 400, it won't work properly, it will just set his health to random amount (usually around 100)
It somewhat works, but if I set someone's health to somewhere above 250 (not sure if 250 is the EXACT number, but I've noticed that it's something about it) it just doesn't set the health properly.
So if I set someone's health to 400, it won't work properly, it will just set his health to random amount (usually around 100)
pawn Код:
CMD:health(playerid, params[])
{
if(gPlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED, "[Error] You are not authorised to use this command!");
new Float:health,
name[MAX_PLAYER_NAME+1],
idname[MAX_PLAYER_NAME+1],
id,
string[128];
if(sscanf(params, "uf", id, health)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage] /health [ID] [Amount]");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Invalid Player ID.");
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(id, idname, sizeof(idname));
for(new slots = GetMaxPlayers(), i; i < slots; i++)
{
if(!IsPlayerConnected(i)) continue;
if(gPlayerInfo[i][pAdmin] >= 1)
{
format(string, sizeof(string), "[AdmCmd] %s has set %s's health to %f", name, idname, health);
SendClientMessage(i, COLOR_RED, string);
}
}
format(string, sizeof(string), "[Info] Your health is now set to %f", health);
SendClientMessage(id, COLOR_WHITE, string);
SetPlayerHealth(id, health);
return 1;
}