[+REP] MySQL format
#1

Hello, I've made a "/h buy" command today, all functions in it are working well, except the mysql_format, it doesn't set the "owner" the player name.
Can someone tell me what's wrong in this?:

Код:
CMD:h(playerid,params[])
{
    new selection[10],string[145];
    if(sscanf(params,"s[10]",selection))return SendUsageMSG(playerid,"/h [BUY/SELL/CONFIG]");
    if(!strcmp(selection,"buy",true))
    {
        for(new i;i<MAX_HOUSES;i++)
        {
            if(IsPlayerInDynamicCP(playerid,hInfo[i][EntranceCP]))
            {
                if(hInfo[i][hOwned] == 1) return SCM(playerid, COLOR_WHITE, ""WORD_ERROR"This house is already owned by someone else.");
                new query[300];
                mysql_format(mysql, query, sizeof(query), "UPDATE `houses` SET `Owned` = '1', `Owner` = '%s' WHERE `ID` = '%d'", PlayerName(playerid), i);
                mysql_tquery(mysql, query, "", "");
                format(string,sizeof(string),""WORD_SYSTEM"You have successfully bought house ID %d. owner: %s",hInfo[i][hID], hInfo[i][hOwner]);
                SCM(playerid,COLOR_WHITE,string);
                reloadHouses();
                break;
                
            }
            else
            {
                SCM(playerid, COLOR_WHITE, ""WORD_ERROR"You must be in a house checkpoint to use this command.");
                break;
	    }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)