28.04.2015, 21:17
What if it is unset (-1)? You don't check that:
and health is float so you should declare a variable with Float: tag and use "f" specifier at sscanf.
pawn Код:
if(engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET)
pawn Код:
CMD:sethp(playerid, params[])
{
if(PlayerData[playerid][AdminLevel] < 1) return SendUnathorizedMessage(playerid);
new target, Float: vita;
if(sscanf(params, "uf", target, vita)) return SendClientMessage(playerid, COLOR_SEABLUE, "{999999}Uso:{FFFFFF} /sethp [ID/Parte del nome] [quantitа]");
if(IsPlayerConnected(target))
{
if(!gIsPlayerLoggedIn[target]) return SendPlayerNotLoggedInMessage(playerid);
SetPlayerHealth(target, vita);
new string[128];
format(string, sizeof(string), "{999999}SERVER:{FFFFFF} Un admin ti ha settato gli HP a %.0f", vita);
SendClientMessage(target, COLOR_WHITE, string);
format(string, sizeof(string), "Admin:{FFFFFF} %s ha settato a %s gli HP a %.0f", GetPlayersName(playerid), GetPlayersName(target), vita);
SendAdministratorMessage(string);
}
return 1;
}