Commands problem.
#3

What if it is unset (-1)? You don't check that:
pawn Код:
if(engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET)
and health is float so you should declare a variable with Float: tag and use "f" specifier at sscanf.

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;
}
Reply


Messages In This Thread
Commands problem. - by alanhutch - 28.04.2015, 21:09
Re: Commands problem. - by Richie© - 28.04.2015, 21:13
Re: Commands problem. - by Konstantinos - 28.04.2015, 21:17
Re: Commands problem. - by alanhutch - 28.04.2015, 21:19
Re: Commands problem. - by [KHK]Khalid - 28.04.2015, 21:19
Re: Commands problem. - by alanhutch - 28.04.2015, 21:21

Forum Jump:


Users browsing this thread: 1 Guest(s)