SA-MP Forums Archive
MySQL Admin Forum Name system not saving/loading - 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: MySQL Admin Forum Name system not saving/loading (/showthread.php?tid=488807)



MySQL Admin Forum Name system not saving/loading - EmilLykke - 19.01.2014

The title basically explains it. It won't work out probably.

pawn Код:
mysql_fetch_field_row(savingstring, "aforumname"); strmid(Player[playerid][aForumName], savingstring, 0, strlen(savingstring), 50);

            format(query, sizeof(query), "UPDATE accounts SET adminlevel=%d AND aforumname=%s WHERE id=%d LIMIT 1",
            Player[playerid][AdminLevel],
            Player[playerid][aForumName],
            Player[playerid][AccountID]);
            mysql_query(query);
enum PlayerDataEnum
    {
aforumname[50]
}

CMD:setaforumname(playerid, params[])
    {
        new string[128], string1[128], namestring[32], id;
        if(Player[playerid][AdminLevel] >= 1)
        {
            if(sscanf(params, "us[50]", id, namestring)) return SCM(playerid, GREY, "Usage: /setaforumname [playerid][newname]");
            {
                if(id != INVALID_PLAYER_ID)
                {
                    if(Player[id][AdminLevel] != 0)
                    {
                        strmid(Player[id][aForumName], namestring, 0, strlen(namestring), 255);
                       
                        new query[128];
                       
                        format(string1, sizeof(string), "You have set %s's (ID: %d) ingame forum name to {FFFF00}%s", RemoveUnderScore(id), id, namestring);
                        format(string, sizeof(string), "Administrator %s (ID: %d) has set your ingame forum name to %s", RemoveUnderScore(playerid), playerid, namestring);
                       
                        mysql_query(query);
                       
                        SendClientMessage(playerid, WHITE, string1);
                        SendClientMessage(id, WHITE, string);
                        SaveStats(id);
                    }
                    else return SCM(playerid, GREY, "This player is not an administrator.");
                }
                else return SCM(playerid, GREY, NotConnected);
            }
        }
        else return SendClientMessage(playerid, GREY, AdminOnly);
        return 1;
    }
I tried to change it to Player[i][aForumName] = namestring; But it didn't work, errors.


Re: MySQL Admin Forum Name system not saving/loading - EmilLykke - 19.01.2014

In the debug, it says that the SQL query was incorrect.


Re: MySQL Admin Forum Name system not saving/loading - Jimmy0wns - 19.01.2014

pawn Код:
mysql_fetch_field_row(savingstring, "aforumname"); strmid(Player[playerid][aForumName], savingstring, 0, strlen(savingstring), 50);

            format(query, sizeof(query), "UPDATE accounts SET `adminlevel`=%d, `aforumname`=%s WHERE `id`=%d LIMIT 1",
            Player[playerid][AdminLevel],
            Player[playerid][aForumName],
            Player[playerid][AccountID]);
            mysql_query(query);
Try this.


Re: MySQL Admin Forum Name system not saving/loading - EmilLykke - 19.01.2014

Still not loading or saving.


Re: MySQL Admin Forum Name system not saving/loading - Smally - 19.01.2014

Can you show us the whole of your SaveStats function please.