Stupid mysql problem.
#1

I've been struggling with this bug for weeks.. Can't find any solution to it.



It sets either random values or it copies this from another account, for example, my account is admin 4 and 50 kills with 17 death, when someone registers, it takes my data and inserts it into his account?! I fixed this by using WHERE uid=%d instead of WHERE user='%s'. But now it saves data for the previous account.. Can someone please help me? This is my SavePlayer function:

pawn Код:
stock SavePlayer(playerid)
{
    if(Logged[playerid] == 1)
    {
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, MAX_PLAYER_NAME);
        new query[300];
        format(query, sizeof(query), "UPDATE playerdata SET `score`='%d', `money`='%d', `level`='%d', `kills`='%d', `deaths`='%d', `vip`='%d', `clan`='%d', `clanposition`='%d', `logins`='%d',`banned`='%d' WHERE user='%s'",
        pInfo[playerid][pScore],
        GetPlayerMoney(playerid),
        pInfo[playerid][pAdmin],
        pInfo[playerid][pKills],
        pInfo[playerid][pDeaths],
        pInfo[playerid][pVIP],
        pInfo[playerid][pClan],
        pInfo[playerid][pClanP],
        pInfo[playerid][pLogins],
        pInfo[playerid][pBanned],
        name);
        mysql_query(query);
        Logged[playerid] = 0;
        printf("%s", query);
    }
}
Reply
#2

You have a function that cleans all variables player that connects?
Reply
#3

Quote:
Originally Posted by Thewin
Посмотреть сообщение
You have a function that cleans all variables player that connects?
Nope I don't.
Reply
#4

Make this and try.
Reply
#5

Quote:
Originally Posted by Thewin
Посмотреть сообщение
Make this and try.
Alright done that. Now I have to wait for more players to register to ensure it works.
Reply
#6

Okay, remember to clean all the variables that you are implementing in the future.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)