08.01.2015, 06:34
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:
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);
}
}