Saving goes corrupt
#1

Hello.
Sometimes when i save, i get someone elses name, as my age.
I have no clue where it's coming from, but it's really pissing me off.
This is the code:

PHP код:
savePlayer(playerid)
{
if(
PLAYERLIST_authed[playerid] == 0)
{
return 
1;
}
else
{
new 
query[500];
format(query,sizeof(query),
"UPDATE user SET level='%i',money='%i',skin='%i',forumname='%s',power='%i',helper='%i',radio='%i',freq1='%i',freq2='%i',freq3='%i',freq4='%i',freq5='%i',playerteam='%i',rpoints='%i',playertime='%i',bank='%i',accent='%s',age='%i',gotphone='%i',phonenumber='%i',jail='%i',jailtime='%i',bail='%i',jailreason='%s' WHERE id = '%i' ",PlayerInfo[playerid][playerlvl],PlayerTemp[playerid][sm],PlayerInfo[playerid][Skin],PlayerInfo[playerid][forumname],
PlayerInfo[playerid][power],PlayerInfo[playerid][helper],PlayerInfo[playerid][radio],PlayerInfo[playerid][freq1],PlayerInfo[playerid][freq2],PlayerInfo[playerid][freq3],PlayerInfo[playerid][freq4],PlayerInfo[playerid][freq5],PlayerInfo[playerid][playerteam]
,
PlayerInfo[playerid][rpoints],PlayerInfo[playerid][playertime],PlayerInfo[playerid][bank],PlayerInfo[playerid][accent],PlayerInfo[playerid][age],PlayerInfo[playerid][gotphone],PlayerInfo[playerid][phonenumber],PlayerInfo[playerid][jail],PlayerInfo[playerid][jailtime],PlayerInfo[playerid][bail],PlayerInfo[playerid][jailreason],PlayerInfo[playerid][dbid]);
mysql_function_query(dbhandle,query,false,"","");
       return 
1;
       }

Reply
#2

Wtf it just randomly sets my level to 114, nowhere in the code to be found, LOL
Reply
#3

Try changing %i to %d?
Reply
#4

Quote:
Originally Posted by oMa37
Посмотреть сообщение
Try changing %i to %d?
%i & %d are both integers, so that won't make a diffrence, right?
Reply
#5

Make sure you clear the variables when players disconnect.
Example: Setting them all back to 0, so when someone else connects using that ID, it will all be fresh.
Reply
#6

Quote:
Originally Posted by cuzido
Посмотреть сообщение
Make sure you clear the variables when players disconnect.
Example: Setting them all back to 0, so when someone else connects using that ID, it will all be fresh.
yez i already thought about that, i recoded all the variables to 0 OnPlayerDisconnect, seems to work now.
Thanks for the thinking
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)