SA-MP Forums Archive
Sql Lite + sscanf Getting errors. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Sql Lite + sscanf Getting errors. (/showthread.php?tid=310733)



Sql Lite + sscanf Getting errors. - [WSF]ThA_Devil - 13.01.2012

pawn Код:
CMD:createshopcar(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    new shopid,modelid,cost;
    if (sscanf(params, "iii", shopid,modelid,cost)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/createshopcar <Shop Id | Vehicle Model Id | Cost>\"");
    if (!IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, 0xFF0000AA, "You aren't in any car!");
        else
        {
        new
        Query[ 150 ],
        DBResult: Result;
        format(Query, sizeof(Query), "SELECT * FROM `SHOPS` WHERE `ID` = '%i'", DB_Escape(shopid)); // line 40
        Result = db_query(database, Query);
        }
    return 1;
}
errors:
Код:
new.pwn(40) : error 035: argument type mismatch (argument 1)
Thanks for help

line 40 is format line.

all has been set perfectly, this just don't work.


Re: Sql Lite + sscanf Getting errors. - Jefff - 13.01.2012

format(Query, sizeof(Query), "SELECT * FROM `SHOPS` WHERE `ID` = %i",shopid); // line 40


Re: Sql Lite + sscanf Getting errors. - [WSF]ThA_Devil - 13.01.2012

Quote:
Originally Posted by Jefff
Посмотреть сообщение
format(Query, sizeof(Query), "SELECT * FROM `SHOPS` WHERE `ID` = %i",shopid); // line 40
integers don't need for DB_Escape?


Respuesta: Re: Sql Lite + sscanf Getting errors. - OPremium - 13.01.2012

Quote:
Originally Posted by [WSF]ThA_Devil
Посмотреть сообщение
integers don't need for DB_Escape?
No... Only strings


Re: Respuesta: Re: Sql Lite + sscanf Getting errors. - [WSF]ThA_Devil - 13.01.2012

Quote:
Originally Posted by OPremium
Посмотреть сообщение
No... Only strings
oh, okay. Gotta remmember that.