30.07.2013, 13:53
Hey guys, I'm scripting a zombie survival server for fun, don't know if I'll ever finish it but I came across a pretty annoying problem: When someone disconnects MYSQL doesn't save their stats.
When players register it does, but when they disconnect the stats don't refresh. I tried editing values in phpMyAdmin then logging in and out, the value stays the same so it's not even ,,zeroing" all the values on exit.
It saves all the player files if the player is Logged in ( if(PlayerInfo[playerid][pLogged] == 1) ), and the script itself works ( I've put a sendclientmessage in the end and it displayed it, but didn't save the other stuff ).
The script looks like this:
If this isn't enough information I can PM you my skype if you can help me out.
Thanks in advance!
EDIT:
Removed the Walk and Fighting style saves, but it still does not work.
When players register it does, but when they disconnect the stats don't refresh. I tried editing values in phpMyAdmin then logging in and out, the value stays the same so it's not even ,,zeroing" all the values on exit.
It saves all the player files if the player is Logged in ( if(PlayerInfo[playerid][pLogged] == 1) ), and the script itself works ( I've put a sendclientmessage in the end and it displayed it, but didn't save the other stuff ).
The script looks like this:
pawn Код:
format(mainstring,sizeof(mainstring),"UPDATE `players` SET 'Logged'=%d,'Admin'=%d,'Money'=%d,'Credit'=%d,'Diamond'=%d,'Level'=%d,'ZLevel'=%d,'PlayHours'=%d,'Rep'=%d,'VIP'=%d,'VIPLevel'=%d,'VIPTime'=%d,'Class'=%d,'IsHuman'=%d,'Faction'=%d,'FactionRank'=%d,'HumanKills'=%d,'ZombieKills'=%d,'Infects'=%d,'Infected'=%d,'InfectionTimer'=%d,'AmpArm'=%d,'AmpLeg'=%d,'WalkStyle'=%d,'FightStyle'=%d,'Skin'=%d WHERE Name = '%s'",
PlayerInfo[playerid][pLogged],
PlayerInfo[playerid][pAdmin],
PlayerInfo[playerid][pMoney],
PlayerInfo[playerid][pCredit],
PlayerInfo[playerid][pDiamond],
PlayerInfo[playerid][pLevel],
PlayerInfo[playerid][pZLevel],
PlayerInfo[playerid][pPlayHours],
PlayerInfo[playerid][pRep],
PlayerInfo[playerid][pVIP],
PlayerInfo[playerid][pVIPLevel],
PlayerInfo[playerid][pVIPTime],
PlayerInfo[playerid][pClass],
PlayerInfo[playerid][pIsHuman],
PlayerInfo[playerid][pFaction],
PlayerInfo[playerid][pFactionRank],
PlayerInfo[playerid][pHumanKills],
PlayerInfo[playerid][pZombieKills],
PlayerInfo[playerid][pInfects],
PlayerInfo[playerid][pInfected],
PlayerInfo[playerid][pInfectionTimer],
PlayerInfo[playerid][pAmpArm],
PlayerInfo[playerid][pAmpLeg],
PlayerInfo[playerid][pWalkStyle],
GetPlayerFightingStyle(playerid),
PlayerInfo[playerid][pSkin],
GetName(playerid));
mysql_query(mainstring);
Thanks in advance!
EDIT:
Removed the Walk and Fighting style saves, but it still does not work.