MySQL Helper level does not save.
#1

Код:
CMD:role(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pHelper] >= 3 || PlayerInfo[playerid][pDeveloper] >= 3)
    {
        new subcmd[30], scmd_params[30];

        if(sscanf(params, "s[30]S()[30]",subcmd, scmd_params))
            return SendClientMessage(playerid, COLOR_INFO, "/role [(o)helper/(o)developer/(o)admin]");



        // role helper subcmd
        if(strmatch(subcmd, "helper"))
        {
            if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pHelper] >= 3)
            {
                new targetid, value, str[128];

                if(sscanf(params, "s[30]ui",subcmd, targetid, value))
                    return SCM(playerid, COLOR_INFO, "/role helper [name/id] [value]");

                if(targetid == playerid)
                    return SCM(playerid, COLOR_ERROR, "You can not use this command on yourself.");

                if(!IsPlayerConnected(targetid))
                    return SCM(playerid, COLOR_ERROR, "That account is not connected.") && SCM(playerid, COLOR_INFO, "Use /role ohelper instead.");

                if(FirstSpawn[targetid])
                    return SCM(playerid, COLOR_ERROR, "That player has not logged in or spawned yet.");

                if(value < 0 || value > 4)
                    return SCM(playerid, COLOR_ERROR, "You can only use a level value between 0 and 4.");

                if(!IsAdmin(playerid))
                {
                    if(value > PlayerInfo[playerid][pHelper])
                        return SCM(playerid, COLOR_ERROR, "You can only use a level value that does not surpass your own.");
                }

                if(PlayerInfo[targetid][pAdmin] > PlayerInfo[playerid][pAdmin])
                    return SCM(playerid, COLOR_ERROR, "That player has a higher helper level than you.");

                PlayerInfo[targetid][pHelper] = value;

                format(str,sizeof(str),"You have set %s(%i) their helper level to %i.",ReturnICName(targetid), targetid, value);
                SCM(playerid, COLOR_COOLBLUE, str);

                format(str,sizeof(str),"Your helper level was set to %i by %s(%i).",value, ReturnICName(playerid), playerid);
                SCM(targetid, COLOR_COOLBLUE,str);

                new action[128];
                format(action, sizeof(action), "role helper to %i", value);

                new query[250];

                mysql_format(g_SQL, query, sizeof(query), "INSERT INTO logs_roles(acc_dbid, acc_name, target_dbid, target_name, time, action) VALUES('%i', '%e', '%i', '%e', UTC_TIMESTAMP(), '%e')", PlayerInfo[playerid][pDBID], ReturnName(playerid), PlayerInfo[targetid][pDBID], ReturnName(targetid), action);
                mysql_tquery(g_SQL, query);

                mysql_format(g_SQL, query, sizeof(query),"UPDATE `accounts` SET `helper` = %i WHERE `acc_dbid` = '%i' LIMIT 1",value, PlayerInfo[targetid][pHelper]);
                mysql_tquery(g_SQL, query);

            }

            else return SCM(playerid,COLOR_ERROR,"You do not have the required access to execute this subcommand.");
        }

        // if no strmatch
        else return SCM(playerid, COLOR_ERROR, "That subcommand does not exist.");
    }

    else return SCM(playerid,COLOR_ERROR,"You do not have the required access to execute this command.");

    return 1;
}
The helper level does not update in MySQL. I've marked the relevant code in red. Any idea why it won't?
Reply


Messages In This Thread
MySQL Helper level does not save. - by Stefhan - 04.01.2019, 18:39
Re: MySQL Helper level does not save. - by Stefhan - 04.01.2019, 18:41
Re: MySQL Helper level does not save. - by d3Pedro - 04.01.2019, 19:33
Re: MySQL Helper level does not save. - by Stefhan - 04.01.2019, 19:47
Re: MySQL Helper level does not save. - by SkyFlare - 04.01.2019, 22:19

Forum Jump:


Users browsing this thread: 1 Guest(s)