ID not valid
#16

Sorry for double post, just tried now. While doing /creategarage i get this in console log:

Quote:

[13:04:22] sscanf warning: Format specifier does not match parameter count.

However, the garage is created and it's ID 0 in database.

Is it normal?

EDIT: Just tried creating 3 garages, the first one with assigned ID 0 works. The last two garages have their X, Y and Z to 0 (so their position is not saved), and their XYZ too replaces the garage ID 0 XYZ, why?

EDIT 2: Edited /creategarage CMD and manage to make it work the position save.

pawn Код:
CMD:creategarage(playerid, params[])
{
    if(Player[playerid][AdminLevel] < 5) return 0;

    if(Iter_Free(Garages) >= MAX_GARAGES) return SCM(playerid, COLOR_ERROR, "» Server has reached max garages limit.");

    new id = Iter_Free(Garages);

    new price, size;

    if(sscanf(params, "dd(0)", price, size))
    {
        SCM(playerid, COLOR_BELGREEN, "» [USAGE]: /creategarage [price] [size(default 0)]");
        return SCM(playerid, COLOR_BELGREEN, "» Size: 0 - Small Garage , 1 - Medium Garage, 2 - Big Garage.");
    }

    if((size < 0) || (size > 2)) return SCM(playerid, COLOR_ERROR, "» Size must be from 0 to 2.");
    if((price < 1) || (price > 999999)) return SCM(playerid, COLOR_ERROR, "» Invalid price.");
   
    new Float:X, Float:Y, Float:Z, Float:A;
   
    GetPlayerPos(playerid, X, Y, Z);
    GetPlayerFacingAngle(playerid, A);
   
    GarageInfo[id][garagePos][0] = X;
    GarageInfo[id][garagePos][1] = Y;
    GarageInfo[id][garagePos][2] = Z;
    GarageInfo[id][garagePos][3] = A;
   
    GarageInfo[id][garageVW] = GetPlayerVirtualWorld(playerid);

    GarageInfo[id][garagePrice] = price;
    GarageInfo[id][garageSize] = size;

    Iter_Add(Garages, id);

    new query[400];
   
    mysql_format(g_SQL, query, sizeof query, "INSERT INTO `garages` (`garageID`, `garagePrice`, `garageSize`, `garageX`, `garageY`, `garageZ`, `garageA`) VALUES ('%d', '%d', '%d', '%.4f', '%.4f', '%.4f', '%.4f')",
    id, price, size, X, Y, Z, A);
   
    mysql_tquery(g_SQL, query, "OnGarageCreated", "d", id);

    SCMEX(playerid, COLOR_YELLOW, "» You have successfully created a garage. ID: %d - Price: %s - Size: %d", id, formatInt(price), size);
   
    printf("Garage is saved for id: %d", id);
    return 1;
}
Now there is yet a problem, the last created garage replaces automatically garage with ID 0 (by copying XYZ, price and size), but still gets created normally (and its ID gets assigned correctly).
Reply


Messages In This Thread
ID not valid - by SymonClash - 22.02.2019, 10:19
Re: ID not valid - by CherryMond - 22.02.2019, 14:14
Re: ID not valid - by SymonClash - 22.02.2019, 14:17
Re: ID not valid - by TheToretto - 22.02.2019, 14:30
Re: ID not valid - by SymonClash - 22.02.2019, 14:38
Re: ID not valid - by TheToretto - 22.02.2019, 15:05
Re: ID not valid - by SymonClash - 22.02.2019, 19:06
Re: ID not valid - by TheToretto - 22.02.2019, 19:51
Re: ID not valid - by SymonClash - 22.02.2019, 20:39
Re: ID not valid - by TheToretto - 22.02.2019, 21:40
Re: ID not valid - by Pottus - 22.02.2019, 21:54
Re: ID not valid - by TheToretto - 22.02.2019, 22:12
Re: ID not valid - by Pottus - 22.02.2019, 22:58
Re: ID not valid - by SymonClash - 22.02.2019, 23:30
Re: ID not valid - by TheToretto - 23.02.2019, 09:36
Re: ID not valid - by SymonClash - 23.02.2019, 11:05
Re: ID not valid - by TheToretto - 23.02.2019, 12:23
Re: ID not valid - by SymonClash - 23.02.2019, 12:34
Re: ID not valid - by TheToretto - 23.02.2019, 13:46
Re: ID not valid - by SymonClash - 23.02.2019, 14:20
Re: ID not valid - by SymonClash - 24.02.2019, 19:09
Re: ID not valid - by JasonRiggs - 24.02.2019, 19:40
Re: ID not valid - by SymonClash - 24.02.2019, 21:06
Re: ID not valid - by JasonRiggs - 24.02.2019, 21:36
Re: ID not valid - by SymonClash - 25.02.2019, 13:05

Forum Jump:


Users browsing this thread: 2 Guest(s)