sscanf setting param to 114 if nothing is entered
#6

pawn Код:
if(strcmp(item, "pot") == 0)
{
    new pot = CarInfo[car][vPot];
    if( sscanf( item, "i(114)", amount ) ) return amount = 144;
    if(amount < 0) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car get pot [amount]");
    if(amount > pot) return SendClientMessage(playerid, COLOR_GREY, "* Your car does not have that much Pot !");

    CarInfo[car][vPot] -= amount;
    format(string, sizeof(string), "* %s takes out something from his vehicle.", PlayerName(playerid));
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

    PlayerInfo[playerid][pPot] += amount;

    format(string, sizeof(string), "New amount after taking %d pot: %d", amount, CarInfo[car][vPot]);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

    return 1;
}
PS: You better use ZCMD/Y_CMD with SSCANF...
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)