Rcon GMX
#1

When I use rcon gmx, it doesn't load any of the variables for a player when he returns, and I've spent like 2 weeks trying to find out why, and I can't. It works when the player disconnects, but on gmx or any restart, it won't load player variables. Below is my login script and save.

Login part1
pawn Код:
case DIALOG_LOGIN:
        {
            new
                HashedPW[145],
                str[1024]
            ;
            mysql_real_escape_string(inputtext, HashedPW);
            WP_Hash(HashedPW, sizeof (HashedPW), inputtext);
            format(str, sizeof(str), "SELECT * FROM "SQL_ACCOUNT_TABLE" WHERE Username = '%s' AND Password = '%s'", pName(playerid), HashedPW);

            PlayerLogin(playerid);
        }
login part2
pawn Код:
function PlayerLogin(playerid)
{
    new
        szQuery2[1024],
        str[1024];
    if(mysql_num_rows() > 0)
            {
                if(mysql_fetch_row(szQuery2)) { sscanf(str, "e<p<|>s[24]s[64]s[26]ddfffdd>", User[playerid]); }
                format(szQuery2, sizeof(szQuery2), "UPDATE "SQL_ACCOUNT_TABLE" SET IP = '%s' WHERE Username = '%s'", pIP(playerid), pName(playerid));
                mysql_query(szQuery2);
                printf("LOGIN||[%s] |",str);
            }
            else
            {
                SendClientMessage(playerid, -1, "[::] Invalid password. Please try again.");
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "[::] Login", "Please enter your password below to login.", "Login", "");
                return 0;
            }

    SetSpawnInfo(playerid, 0, User[playerid][Skin], User[playerid][pPosX], User[playerid][pPosY], User[playerid][pPosZ], 0.0, 0, 0, 0, 0, 0, 0);
    SpawnPlayer(playerid);
   
    SetPlayerPos(playerid, User[playerid][pPosX],User[playerid][pPosY],User[playerid][pPosZ]);
    SetPlayerSkin(playerid, User[playerid][Skin]);
   
    SetPlayerScore(playerid, User[playerid][Level]);
    GivePlayerMoney(playerid, User[playerid][Money]);

    mysql_free_result();
    return 1;
 }


Now saving:

pawn Код:
function SavePlayerAccount(playerid)
{
    new
        szQuery[1024];
       
    GetPlayerPos(playerid, User[playerid][pPosX], User[playerid][pPosY], User[playerid][pPosZ]);

    format(szQuery, sizeof(szQuery), "UPDATE "SQL_ACCOUNT_TABLE" SET Level = %d, Money = %d, pPosX = %f, pPosY = %f, pPosZ = %f, Skin = %d WHERE Username = '%s'",

        GetPlayerScore(playerid),
        GetPlayerMoney(playerid),
        User[playerid][pPosX],
        User[playerid][pPosY],
        User[playerid][pPosZ],
        User[playerid][Skin],
       
        pName(playerid));



    mysql_query(szQuery);
    printf("SAVING||[%s]",szQuery);
    return 1;
}

Onplayerspawn
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid, User[playerid][pPosX],User[playerid][pPosY],User[playerid][pPosZ]);
    SetPlayerSkin(playerid, User[playerid][Skin]);
    SetSpawnInfo(playerid, 0, User[playerid][Skin], User[playerid][pPosX], User[playerid][pPosY], User[playerid][pPosZ], 0.0, 0, 0, 0, 0, 0, 0);
    SetPlayerColor(playerid, COLOR_WHITE);
   
    return 1;
}

How can I fix the GMX issue? Please help as this is stressing me out extremely.


I've tried with timers also:

pawn Код:
CMD:gmx(playerid, params[]) {
    foreach(Player, x)
    {
        SavePlayerAccount(x);
    }
    SendClientMessage(playerid, COLOR_YELLOW, "Player data saved.");
    SetTimer("restartProcess", 5000, false);
    return 1;
}

public restartProcess() {
    SendClientMessageToAll(COLOR_RED, "The server is now restarting.");
    mysql_close();
    SendRconCommand("gmx");
    return 1;
}
Reply
#2

eny PAWNO errors?
Reply
#3

No. No errors no warnings.
Reply
#4

Bump - If I have to, I guess I could get a few dollars to pay whoever helps fix this stuff as it's extremely annoying
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)