SA-MP Forums Archive
setoff... not working - SQLite - 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: setoff... not working - SQLite (/showthread.php?tid=526236)



setoff... not working - SQLite - Kyance - 16.07.2014

Whenever I try to set someones offline score/coprank/robrank/adminlevel bla blabla, it says;
NOTE: NAME's ROBRANK/COPRANK/ADMINLEVEL/SCORE has NOT been set to VALUE

The code;
pawn Код:
CMD:setoffrobrank(playerid, params[]) {
    new
        mString[112],
        pName[24],
        Amount,
        DBResult:Result,
        Query[90]
    ;
    if(PlayerInfo[playerid][AdminLevel] < 4) return SendClientMessage(playerid, -1, "{FFFFFF}* {00C0FF}You're not a high enough level to use this command!");
    if(sscanf(params, "s[24]i", pName, Amount)) return SendClientMessage(playerid, COLOR_NOTES, "USAGE: /setoffrobrank [UserName] [Amount]");
    format(Query, sizeof(Query), "SELECT * FROM `USERS` WHERE `NAME` = '%s'", pName);
    Result = db_query(CnR,Query);
    if(!db_num_rows(Result))
    {
        format(mString, sizeof(mString), "ERROR: No account(s) with '%s' has been found.", pName);
        SendClientMessage(playerid, COLOR_NOTES2, mString);
        return 1;
    }
    else
    {
        format(Query, sizeof(Query), "UPDATE `USERS` WHERE `NAME` = '%s' SET `ROB` = '%i'", pName, Amount);
        Result = db_query(CnR, Query);
        if(Result)
        {
            format(mString, sizeof(mString), "NOTE: %s's rob-rank has been successfully set to %i!", pName, Amount);
            SendClientMessage(playerid, COLOR_NOTES, mString);
        }
        else
        {
            format(mString, sizeof(mString), "NOTE: %s's rob-rank has NOT been set to %i!", pName, Amount);
            SendClientMessage(playerid, COLOR_NOTES2, mString);
        }
        db_free_result(Result);
    }
    mString = "\0", Query = "\0", pName = "\0";
    return 1;
}



Re: setoff... not working - SQLite - Jack_Leslie - 16.07.2014

Try:
Код:
UPDATE `USERS` SET `ROB` = '%i' WHERE `NAME` = '%s'



Re: setoff... not working - SQLite - Kyance - 16.07.2014

Quote:
Originally Posted by Jack_Leslie
Посмотреть сообщение
Try:
Код:
UPDATE `USERS` SET `ROB` = '%i' WHERE `NAME` = '%s'
Works now, thanks a lot!
Successfully +rep'd too ;d