sscanf sub-params help
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
The problem is that when you use "s" as the last parameter, it gets the whole of the remainder of the string - sub-command AND parameters in one. Instead use "s[20] " - the trailing space is VERY important, it used to trick sscanf in to not thinking that "s" was the last parameter, without actually doing anything; it still does that, only now it is a handy and supported feature rather than a trick.

Or try this:

pawn Код:
if (!sscanf(params, "'create'I(-1)I(-1)", int, price))
Combine the "strcmp" and "sscanf" phases in to one (and then check the parameters aren't -1).
Like this?
pawn Код:
if (!sscanf(params, "'create'I(-1)I(-1)", int, price))
    {
        if(PlayerInfo[playerid][pAdmin] < 4)
            return 1;
        if (sscanf(params, "ii",int,price))
            return SendClientMessage(playerid,COLOR_CYAN,"[Usage] /createhouse [int] [price]");
        new query[256];
        new Float:p[3];
        GetPlayerPos(playerid,p[0],p[1],p[2]);
        //INSERT INTO `houses` (`ownerid`,`price`,`locked`,`int`,`vw`,`rent`,`entx`,`enty`,`entz`,`extx`,`exty`,`exyz`,`ownername`) VALUES ('9999','999999','0','1','1','1','12.77777777','12.77777777','12.77777777','12.77777777','12.77777777','12.77777777','None')
        format(query,sizeof(query),"INSERT INTO `houses` (`ownerid`,`price`,`locked`,`int`,`vw`,`rent`,`entx`,`enty`,`entz`,`extx`,`exty`,`extz`,`ownername`) VALUES ('9999','%i','1','%i','%i',1,'%.1f','%.1f','%.1f','%.1f','%.1f','%.1f','None')",price,HInts[int],int*2,p[0],p[1],p[2],HouseInts[int][0],HouseInts[int][1],HouseInts[int][2],GetName(playerid));
        mysql_query(query);
        printf("query:",query);
        SendFormat(playerid,COLOR_GREEN,"[House Creation] {FFFFFF}You have just created a new house (InteriorID: %i | Price: %i",int,price);
    }
I tried but it still doesn't work.
Reply


Messages In This Thread
sscanf sub-params help - by printer - 11.01.2013, 09:57
Re: sscanf sub-params help - by David (Sabljak) - 11.01.2013, 10:59
Re: sscanf sub-params help - by printer - 11.01.2013, 11:21
Re: sscanf sub-params help - by printer - 11.01.2013, 16:28

Forum Jump:


Users browsing this thread: 1 Guest(s)