PDA

View Full Version : Query Mysql


fabriziobondi
21/11/2011, 11:51 AM
Someone can create me a query mysql to save player stats when a player quit the game?
Here u are the line of DB:

mysql_get_field("Money", fetch);
PlayerAccount[playerid][Money] = strval(fetch);
mysql_get_field("CurrentHealth", fetch);
PlayerAccount[playerid][Health] = strval(fetch);
mysql_get_field("Level", fetch);
PlayerAccount[playerid][Level] = strval(fetch);
mysql_get_field("HouseKey", fetch);
PlayerAccount[playerid][HouseKey] = strval(fetch);
mysql_get_field("BizKey", fetch);
PlayerAccount[playerid][BizKey] = strval(fetch);
mysql_get_field("Cigarettes", fetch);
PlayerAccount[playerid][Cigarettes] = strval(fetch);
mysql_get_field("Rope", fetch);
PlayerAccount[playerid][Rope] = strval(fetch);
mysql_get_field("HasGlasses", fetch);
PlayerAccount[playerid][HasGlasses] = strval(fetch);
mysql_get_field("Skin", fetch);
PlayerAccount[playerid][Skin] = strval(fetch);
mysql_get_field("CurrentX", fetch);
PlayerAccount[playerid][pPos][0] = strval(fetch);
mysql_get_field("CurrentY", fetch);
PlayerAccount[playerid][pPos][1] = strval(fetch);
mysql_get_field("CurrentZ", fetch);
PlayerAccount[playerid][pPos][2] = strval(fetch);
mysql_get_field("CurrentInt", fetch);
PlayerAccount[playerid][CurrentInt] = strval(fetch);
mysql_get_field("CurrentVW", fetch);
PlayerAccount[playerid][CurrentVW] = strval(fetch);
mysql_get_field("ID", fetch);
PlayerAccount[playerid][ID] = strval(fetch);
mysql_get_field("HasMask", fetch);
PlayerAccount[playerid][HasMask] = strval(fetch);
mysql_get_field("HasHelmet", fetch);
PlayerAccount[playerid][HasHelmet] = strval(fetch);
mysql_get_field("PhoneCredit", fetch);
PlayerAccount[playerid][PhoneCredit] = strval(fetch);
mysql_get_field("CurrentArmour", fetch);
AccountData[playerid][pArmour] = strval(fetch);
mysql_get_field("Sex", fetch);
PlayerAccount[playerid][psex] = strval(fetch);
mysql_get_field("Drug", fetch);
PlayerAccount[playerid][Drug] = strval(fetch);
mysql_get_field("Materials", fetch);
PlayerAccount[playerid][Materials] = strval(fetch);
mysql_get_field("FightStyle", fetch);
PlayerAccount[playerid][FightStyle] = strval(fetch);
mysql_get_field("Walk", fetch);
PlayerAccount[playerid][Walk] = strval(fetch);
mysql_get_field("Premium", fetch);
PlayerAccount[playerid][Premium] = strval(fetch);
mysql_get_field("WalkieTalkie", fetch);
PlayerAccount[playerid][WalkieTalkie] = strval(fetch);
mysql_get_field("Phone", fetch);
PlayerAccount[playerid][Phone] = strval(fetch);
mysql_get_field("Clan", fetch);
PlayerAccount[playerid][Clan] = strval(fetch);
mysql_get_field("ClanLeader", fetch);
PlayerAccount[playerid][ClanLeader] = strval(fetch);
mysql_get_field("Faction", fetch);
PlayerAccount[playerid][Faction] = strval(fetch);
mysql_get_field("CurrentDuty", fetch);
PlayerAccount[playerid][CurrentDuty] = strval(fetch);
mysql_get_field("Rank", fetch);
PlayerAccount[playerid][Rank] = strval(fetch);
mysql_get_field("CurrentDutySkin", fetch);
PlayerAccount[playerid][CurrentDutySkin] = strval(fetch);
mysql_get_field("Subfaction", fetch);
PlayerAccount[playerid][Subfaction] = strval(fetch);
mysql_get_field("Bank", fetch);
PlayerAccount[playerid][Bank] = strval(fetch);
mysql_get_field("Prestito", fetch);
PlayerAccount[playerid][Prestito] = strval(fetch);
mysql_get_field("Pay", fetch);
PlayerAccount[playerid][Pay] = strval(fetch);
mysql_get_field("Jailed", fetch);
PlayerAccount[playerid][Jailed] = strval(fetch);
mysql_get_field("JailTime", fetch);
PlayerAccount[playerid][JailCell] = strval(fetch);
mysql_get_field("JailCell", fetch);
PlayerAccount[playerid][JailTime] = strval(fetch);
mysql_get_field("Exp", fetch);
PlayerAccount[playerid][Exp] = strval(fetch);
mysql_get_field("Years", fetch);
PlayerAccount[playerid][Years] = strval(fetch);
mysql_get_field("Pills", fetch);
PlayerAccount[playerid][Pills] = strval(fetch);
mysql_get_field("TutorialDone", fetch);
PlayerAccount[playerid][TutorialDone] = strval(fetch);
mysql_get_field("Admin", fetch);
PlayerAccount[playerid][AdminLevel] = strval(fetch);
mysql_get_field("Banned", fetch);
PlayerAccount[playerid][Banned] = strval(fetch);
mysql_get_field("GPS", fetch);
PlayerAccount[playerid][GPS] = strval(fetch);
mysql_get_field("Clock", fetch);
PlayerAccount[playerid][Clock] = strval(fetch);
mysql_get_field("Poste", fetch);
PlayerAccount[playerid][Poste] = strval(fetch);
mysql_get_field("Worker", fetch);
PlayerAccount[playerid][Worker] = strval(fetch);
mysql_get_field("Capelli", fetch);
PlayerAccount[playerid][Capelli] = strval(fetch);
mysql_get_field("Helper", fetch);
PlayerAccount[playerid][Helper] = strval(fetch);
mysql_get_field("MotorBikeLic", fetch);
PlayerAccount[playerid][License][0] = strval(fetch);
mysql_get_field("CarLic", fetch);
PlayerAccount[playerid][License][1] = strval(fetch);
mysql_get_field("TruckLic", fetch);
PlayerAccount[playerid][License][2] = strval(fetch);
mysql_get_field("BusLic", fetch);
PlayerAccount[playerid][License][3] = strval(fetch);
mysql_get_field("BoatLic", fetch);
PlayerAccount[playerid][License][4] = strval(fetch);
mysql_get_field("FlyLic", fetch);
PlayerAccount[playerid][License][5] = strval(fetch);
mysql_get_field("Spawned", fetch);
PlayerAccount[playerid][Spawned] = strval(fetch);
mysql_get_field("Spawn", fetch);
PlayerAccount[playerid][Spawn] = strval(fetch);
mysql_get_field("Activity", fetch);
PlayerAccount[playerid][Activity] = strval(fetch);
mysql_get_field("ActivityLeader", fetch);
PlayerAccount[playerid][ActivityLeader] = strval(fetch);
mysql_get_field("exgm", fetch);
PlayerAccount[playerid][exgm] = strval(fetch);
mysql_get_field("WepLic", fetch);
PlayerAccount[playerid][License][6] = strval(fetch);
mysql_get_field("District", fetch);
PlayerAccount[playerid][District] = strval(fetch);
mysql_get_field("SubDistrict", fetch);
PlayerAccount[playerid][SubDistrict] = strval(fetch);
mysql_get_field("WeaponString", PlayerAccount[playerid][WepString]);
mysql_get_field("BanDays", PlayerAccount[playerid][BanDays]);
mysql_get_field("PremDays", PlayerAccount[playerid][PremDays]);

I need to know where I have to put the query that u'll create. Under OnPlayerDisconnect?
I need this query because when a player quit the game and relog, his account are restored. House and business result at the name of the player that bought these but in /stats appear house 999 and the house menu and business menu don't go.
Thanks for your help.

FarSe.
21/11/2011, 12:07 PM
format(str,sizeof(str),"UPDATE `players` SET `Money=%d,CurrentHealth=%d,Level=%d,HouseKey=%d,Bi zKey=%d,Cigarettes=%d,Rope=%d,HasGlasses=%d,Skin=% d,CurrentX=%d,CurrentY=%d,",
PlayerAccount[playerid][Money],PlayerAccount[playerid][Health],PlayerAccount[playerid][Level],PlayerAccount[playerid][HouseKey],PlayerAccount[playerid][BizKey],PlayerAccount[playerid][Cigarettes],PlayerAccount[playerid][Rope],PlayerAccount[playerid][HasGlasses],PlayerAccount[playerid][Skin],PlayerAccount[playerid][pPos][0],PlayerAccount[playerid][pPos][1]);

format(str,sizeof(str),"%sCurrentZ=%d,CurrentInt=%d,CurrentVW=%d,ID=%d,Has Mask=%d,HasHelmet=%d,PhoneCredit=%d,CurrentArmour= %d,Sex=%d,Drug=%d,Materials=%d,FightStyle=%d,",str,
PlayerAccount[playerid][pPos][2],PlayerAccount[playerid][CurrentInt],PlayerAccount[playerid][CurrentVW],PlayerAccount[playerid][ID],PlayerAccount[playerid][HasMask],PlayerAccount[playerid][HasHelmet],PlayerAccount[playerid][PhoneCredit],AccountData[playerid][pArmour],PlayerAccount[playerid][psex],PlayerAccount[playerid][Drug],PlayerAccount[playerid][Materials],PlayerAccount[playerid][FightStyle]);

format(str,sizeof(str),"%sWalk=%d,Premium=%d,WalkieTalkie=%d,Phone=%d,Clan =%d,ClanLeader=%d,Faction=%d,CurrentDuty=%d,Rank=% d,CurrentDutySkin=%d,Subfaction=%d,",str,
PlayerAccount[playerid][Walk],PlayerAccount[playerid][Premium],PlayerAccount[playerid][WalkieTalkie],PlayerAccount[playerid][Phone],PlayerAccount[playerid][Clan],PlayerAccount[playerid][ClanLeader],PlayerAccount[playerid][Faction],PlayerAccount[playerid][CurrentDuty],PlayerAccount[playerid][Rank],PlayerAccount[playerid][CurrentDutySkin],PlayerAccount[playerid][Subfaction]);

format(str,sizeof(str),"%sBank=%d,Prestito=%d,Pay=%d,Jailed=%d,JailTime=%d ,JailCell=%d,Exp=%d,Years=%d,Pills=%d,TutorialDone =%d,Admin=%d,Banned=%d,GPS=%d,",str,
PlayerAccount[playerid][Bank],PlayerAccount[playerid][Prestito],PlayerAccount[playerid][Pay],PlayerAccount[playerid][Jailed],PlayerAccount[playerid][JailCell],PlayerAccount[playerid][JailTime],PlayerAccount[playerid][Exp],PlayerAccount[playerid][Years],PlayerAccount[playerid][Pills],PlayerAccount[playerid][TutorialDone],PlayerAccount[playerid][AdminLevel],PlayerAccount[playerid][Banned],PlayerAccount[playerid][GPS]);

format(str,sizeof(str),"%sClock=%d,Poste=%d,Worker=%d,Capelli=%d,Helper=%d ,MotorBikeLic=%d,CarLic=%d,TruckLic=%d,BusLic=%d,B oatLic=%d,FlyLic=%d,Spawned=%d,",str,
PlayerAccount[playerid][Clock],PlayerAccount[playerid][Poste],PlayerAccount[playerid][Worker],PlayerAccount[playerid][Capelli],PlayerAccount[playerid][Helper],PlayerAccount[playerid][License][0],PlayerAccount[playerid][License][1],PlayerAccount[playerid][License][2],PlayerAccount[playerid][License][3],PlayerAccount[playerid][License][4],PlayerAccount[playerid][License][5],PlayerAccount[playerid][Spawned]);

format(str,sizeof(str),"%sSpawn=%d,Activity=%d,ActivityLeader=%d,exgm=%d,W epLic=%d,District=%d,SubDistrict=%d,WeaponString", ='%s',BanDays", ='%s',PremDays='%s'",str,
PlayerAccount[playerid][Spawn],PlayerAccount[playerid][Activity],PlayerAccount[playerid][ActivityLeader],PlayerAccount[playerid][exgm],PlayerAccount[playerid][License][6],PlayerAccount[playerid][District],PlayerAccount[playerid][SubDistrict],PlayerAccount[playerid][WepString],PlayerAccount[playerid][BanDays],PlayerAccount[playerid][PremDays]);
format(str,sizeof(str),"%s WHERE `name`='%s';",str,NAME);
Viva la REGEX.

fabriziobondi
21/11/2011, 12:10 PM
format(str,sizeof(str),"UPDATE `players` SET `Money=%d,CurrentHealth=%d,Level=%d,HouseKey=%d,Bi zKey=%d,Cigarettes=%d,Rope=%d,HasGlasses=%d,Skin=% d,CurrentX=%d,CurrentY=%d,",
PlayerAccount[playerid][Money],PlayerAccount[playerid][Health],PlayerAccount[playerid][Level],PlayerAccount[playerid][HouseKey],PlayerAccount[playerid][BizKey],PlayerAccount[playerid][Cigarettes],PlayerAccount[playerid][Rope],PlayerAccount[playerid][HasGlasses],PlayerAccount[playerid][Skin],PlayerAccount[playerid][pPos][0],PlayerAccount[playerid][pPos][1]);

format(str,sizeof(str),"%sCurrentZ=%d,CurrentInt=%d,CurrentVW=%d,ID=%d,Has Mask=%d,HasHelmet=%d,PhoneCredit=%d,CurrentArmour= %d,Sex=%d,Drug=%d,Materials=%d,FightStyle=%d,",str,
PlayerAccount[playerid][pPos][2],PlayerAccount[playerid][CurrentInt],PlayerAccount[playerid][CurrentVW],PlayerAccount[playerid][ID],PlayerAccount[playerid][HasMask],PlayerAccount[playerid][HasHelmet],PlayerAccount[playerid][PhoneCredit],AccountData[playerid][pArmour],PlayerAccount[playerid][psex],PlayerAccount[playerid][Drug],PlayerAccount[playerid][Materials],PlayerAccount[playerid][FightStyle]);

format(str,sizeof(str),"%sWalk=%d,Premium=%d,WalkieTalkie=%d,Phone=%d,Clan =%d,ClanLeader=%d,Faction=%d,CurrentDuty=%d,Rank=% d,CurrentDutySkin=%d,Subfaction=%d,",str,
PlayerAccount[playerid][Walk],PlayerAccount[playerid][Premium],PlayerAccount[playerid][WalkieTalkie],PlayerAccount[playerid][Phone],PlayerAccount[playerid][Clan],PlayerAccount[playerid][ClanLeader],PlayerAccount[playerid][Faction],PlayerAccount[playerid][CurrentDuty],PlayerAccount[playerid][Rank],PlayerAccount[playerid][CurrentDutySkin],PlayerAccount[playerid][Subfaction]);

format(str,sizeof(str),"%sBank=%d,Prestito=%d,Pay=%d,Jailed=%d,JailTime=%d ,JailCell=%d,Exp=%d,Years=%d,Pills=%d,TutorialDone =%d,Admin=%d,Banned=%d,GPS=%d,",str,
PlayerAccount[playerid][Bank],PlayerAccount[playerid][Prestito],PlayerAccount[playerid][Pay],PlayerAccount[playerid][Jailed],PlayerAccount[playerid][JailCell],PlayerAccount[playerid][JailTime],PlayerAccount[playerid][Exp],PlayerAccount[playerid][Years],PlayerAccount[playerid][Pills],PlayerAccount[playerid][TutorialDone],PlayerAccount[playerid][AdminLevel],PlayerAccount[playerid][Banned],PlayerAccount[playerid][GPS]);

format(str,sizeof(str),"%sClock=%d,Poste=%d,Worker=%d,Capelli=%d,Helper=%d ,MotorBikeLic=%d,CarLic=%d,TruckLic=%d,BusLic=%d,B oatLic=%d,FlyLic=%d,Spawned=%d,",str,
PlayerAccount[playerid][Clock],PlayerAccount[playerid][Poste],PlayerAccount[playerid][Worker],PlayerAccount[playerid][Capelli],PlayerAccount[playerid][Helper],PlayerAccount[playerid][License][0],PlayerAccount[playerid][License][1],PlayerAccount[playerid][License][2],PlayerAccount[playerid][License][3],PlayerAccount[playerid][License][4],PlayerAccount[playerid][License][5],PlayerAccount[playerid][Spawned]);

format(str,sizeof(str),"%sSpawn=%d,Activity=%d,ActivityLeader=%d,exgm=%d,W epLic=%d,District=%d,SubDistrict=%d,WeaponString", ='%s',BanDays", ='%s',PremDays='%s'",str,
PlayerAccount[playerid][Spawn],PlayerAccount[playerid][Activity],PlayerAccount[playerid][ActivityLeader],PlayerAccount[playerid][exgm],PlayerAccount[playerid][License][6],PlayerAccount[playerid][District],PlayerAccount[playerid][SubDistrict],PlayerAccount[playerid][WepString],PlayerAccount[playerid][BanDays],PlayerAccount[playerid][PremDays]);
format(str,sizeof(str),"%s WHERE `name`='%s';",str,NAME);
Viva la REGEX.

Sotto OnPlayerDisconnect? Altrimenti, dove?
Under OnPlayerDisconnect? If not, where?

iJumbo
21/11/2011, 12:24 PM
If u need to save players stats is better use Disconnect ... or you can make it update when player do someting like saving ..

fabriziobondi
21/11/2011, 12:46 PM
My account has been restored after the relog.

This two elements was undefined. I added this two new:

new str[1024];
new NAME[MAX_PLAYER_NAME];

Someone know what could be?

FarSe.
21/11/2011, 12:47 PM
OnPlayerDisconnect...
new ....
GetPlayerName(playerid,NAME,25);
format....
mysql_query....
...
...
...
..
....

fabriziobondi
21/11/2011, 12:55 PM
OnPlayerDisconnect...
new ....
GetPlayerName(playerid,NAME,25);
format....
mysql_query....
...
...
...
..
....

public OnPlayerDisconnect(playerid, reason) {
new str[1024];
GetPlayerName(playerid,NAME,25);
format(str,sizeof(str),"UPDATE `players` SET `Money=%d,CurrentHealth=%d,Level=%d,HouseKey=%d,Bi zKey=%d,Cigarettes=%d,Rope=%d,HasGlasses=%d,Skin=% d,CurrentX=%d,CurrentY=%d,",
PlayerAccount[playerid][Money],PlayerAccount[playerid][Health],PlayerAccount[playerid][Level],PlayerAccount[playerid][HouseKey],PlayerAccount[playerid][BizKey],PlayerAccount[playerid][Cigarettes],PlayerAccount[playerid][Rope],PlayerAccount[playerid][HasGlasses],PlayerAccount[playerid][Skin],PlayerAccount[playerid][pPos][0],PlayerAccount[playerid][pPos][1]);
format(str,sizeof(str),"%sCurrentZ=%d,CurrentInt=%d,CurrentVW=%d,ID=%d,Has Mask=%d,HasHelmet=%d,PhoneCredit=%d,CurrentArmour= %d,Sex=%d,Drug=%d,Materials=%d,FightStyle=%d,",str,
PlayerAccount[playerid][pPos][2],PlayerAccount[playerid][CurrentInt],PlayerAccount[playerid][CurrentVW],PlayerAccount[playerid][ID],PlayerAccount[playerid][HasMask],PlayerAccount[playerid][HasHelmet],PlayerAccount[playerid][PhoneCredit],AccountData[playerid][pArmour],PlayerAccount[playerid][psex],PlayerAccount[playerid][Drug],PlayerAccount[playerid][Materials],PlayerAccount[playerid][FightStyle]);
format(str,sizeof(str),"%sWalk=%d,Premium=%d,WalkieTalkie=%d,Phone=%d,Clan =%d,ClanLeader=%d,Faction=%d,CurrentDuty=%d,Rank=% d,CurrentDutySkin=%d,Subfaction=%d,",str,
PlayerAccount[playerid][Walk],PlayerAccount[playerid][Premium],PlayerAccount[playerid][WalkieTalkie],PlayerAccount[playerid][Phone],PlayerAccount[playerid][Clan],PlayerAccount[playerid][ClanLeader],PlayerAccount[playerid][Faction],PlayerAccount[playerid][CurrentDuty],PlayerAccount[playerid][Rank],PlayerAccount[playerid][CurrentDutySkin],PlayerAccount[playerid][Subfaction]);
format(str,sizeof(str),"%sBank=%d,Prestito=%d,Pay=%d,Jailed=%d,JailTime=%d ,JailCell=%d,Exp=%d,Years=%d,Pills=%d,TutorialDone =%d,Admin=%d,Banned=%d,GPS=%d,",str,
PlayerAccount[playerid][Bank],PlayerAccount[playerid][Prestito],PlayerAccount[playerid][Pay],PlayerAccount[playerid][Jailed],PlayerAccount[playerid][JailCell],PlayerAccount[playerid][JailTime],PlayerAccount[playerid][Exp],PlayerAccount[playerid][Years],PlayerAccount[playerid][Pills],PlayerAccount[playerid][TutorialDone],PlayerAccount[playerid][AdminLevel],PlayerAccount[playerid][Banned],PlayerAccount[playerid][GPS]);
format(str,sizeof(str),"%sClock=%d,Poste=%d,Worker=%d,Capelli=%d,Helper=%d ,MotorBikeLic=%d,CarLic=%d,TruckLic=%d,BusLic=%d,B oatLic=%d,FlyLic=%d,Spawned=%d,",str,
PlayerAccount[playerid][Clock],PlayerAccount[playerid][Poste],PlayerAccount[playerid][Worker],PlayerAccount[playerid][Capelli],PlayerAccount[playerid][Helper],PlayerAccount[playerid][License][0],PlayerAccount[playerid][License][1],PlayerAccount[playerid][License][2],PlayerAccount[playerid][License][3],PlayerAccount[playerid][License][4],PlayerAccount[playerid][License][5],PlayerAccount[playerid][Spawned]);
format(str,sizeof(str),"%s WHERE `name`='%s';",str,NAME);

Right?

AndreT
21/11/2011, 01:02 PM
Actually, that is VERY bad. The only variables that need updating on player disconnect are the ones being constantly modified (like money, online time, coordinates, health whatever). Most of things like licenses, jail times, bank amounts can be updated in the database ONLY WHEN NECESSARY.

Let me show some pseudocode to perhaps make it more clear...

// Your current solution
function, where licenses are modified(playerid)
{
licensevariable[playerid] = ...;
}

public OnPlayerDisconnect(playerid)
{
query to update all variables (including license variables for example)
}

// desired and better solution
function, where licenses are modified(playerid)
{
licensevariable[playerid] = ...;
query to update the player's license in the database
}

public OnPlayerDisconnect(playerid)
{
query to update only necessary variables (definitely excluding license variables which have already been set)
}

Not the best way to put it, but I hope you understand!

fabriziobondi
21/11/2011, 01:13 PM
Actually, that is VERY bad. The only variables that need updating on player disconnect are the ones being constantly modified (like money, online time, coordinates, health whatever). Most of things like licenses, jail times, bank amounts can be updated in the database ONLY WHEN NECESSARY.

Let me show some pseudocode to perhaps make it more clear...

// Your current solution
function, where licenses are modified(playerid)
{
licensevariable[playerid] = ...;
}

public OnPlayerDisconnect(playerid)
{
query to update all variables (including license variables for example)
}

// desired and better solution
function, where licenses are modified(playerid)
{
licensevariable[playerid] = ...;
query to update the player's license in the database
}

public OnPlayerDisconnect(playerid)
{
query to update only necessary variables (definitely excluding license variables which have already been set)
}

Not the best way to put it, but I hope you understand!

So how could I put this query correctly under OnPlayerDisconnect?
Can u post me your code using the line that I putted before?

fabriziobondi
21/11/2011, 01:44 PM
public OnPlayerDisconnect(playerid, reason) {
new str[1024];
GetPlayerName(playerid,NAME,25);
format(str,sizeof(str),"UPDATE `players` SET `Money=%d,CurrentHealth=%d,Level=%d,HouseKey=%d,Bi zKey=%d,Cigarettes=%d,Rope=%d,HasGlasses=%d,Skin=% d,CurrentX=%d,CurrentY=%d,",
PlayerAccount[playerid][Money],PlayerAccount[playerid][Health],PlayerAccount[playerid][Level],PlayerAccount[playerid][HouseKey],PlayerAccount[playerid][BizKey],PlayerAccount[playerid][Cigarettes],PlayerAccount[playerid][Rope],PlayerAccount[playerid][HasGlasses],PlayerAccount[playerid][Skin],PlayerAccount[playerid][pPos][0],PlayerAccount[playerid][pPos][1]);
format(str,sizeof(str),"%sCurrentZ=%d,CurrentInt=%d,CurrentVW=%d,ID=%d,Has Mask=%d,HasHelmet=%d,PhoneCredit=%d,CurrentArmour= %d,Sex=%d,Drug=%d,Materials=%d,FightStyle=%d,",str,
PlayerAccount[playerid][pPos][2],PlayerAccount[playerid][CurrentInt],PlayerAccount[playerid][CurrentVW],PlayerAccount[playerid][ID],PlayerAccount[playerid][HasMask],PlayerAccount[playerid][HasHelmet],PlayerAccount[playerid][PhoneCredit],AccountData[playerid][pArmour],PlayerAccount[playerid][psex],PlayerAccount[playerid][Drug],PlayerAccount[playerid][Materials],PlayerAccount[playerid][FightStyle]);
format(str,sizeof(str),"%sWalk=%d,Premium=%d,WalkieTalkie=%d,Phone=%d,Clan =%d,ClanLeader=%d,Faction=%d,CurrentDuty=%d,Rank=% d,CurrentDutySkin=%d,Subfaction=%d,",str,
PlayerAccount[playerid][Walk],PlayerAccount[playerid][Premium],PlayerAccount[playerid][WalkieTalkie],PlayerAccount[playerid][Phone],PlayerAccount[playerid][Clan],PlayerAccount[playerid][ClanLeader],PlayerAccount[playerid][Faction],PlayerAccount[playerid][CurrentDuty],PlayerAccount[playerid][Rank],PlayerAccount[playerid][CurrentDutySkin],PlayerAccount[playerid][Subfaction]);
format(str,sizeof(str),"%sBank=%d,Prestito=%d,Pay=%d,Jailed=%d,JailTime=%d ,JailCell=%d,Exp=%d,Years=%d,Pills=%d,TutorialDone =%d,Admin=%d,Banned=%d,GPS=%d,",str,
PlayerAccount[playerid][Bank],PlayerAccount[playerid][Prestito],PlayerAccount[playerid][Pay],PlayerAccount[playerid][Jailed],PlayerAccount[playerid][JailCell],PlayerAccount[playerid][JailTime],PlayerAccount[playerid][Exp],PlayerAccount[playerid][Years],PlayerAccount[playerid][Pills],PlayerAccount[playerid][TutorialDone],PlayerAccount[playerid][AdminLevel],PlayerAccount[playerid][Banned],PlayerAccount[playerid][GPS]);
format(str,sizeof(str),"%sClock=%d,Poste=%d,Worker=%d,Capelli=%d,Helper=%d ,Spawned=%d,",str,
PlayerAccount[playerid][Clock],PlayerAccount[playerid][Poste],PlayerAccount[playerid][Worker],PlayerAccount[playerid][Capelli],PlayerAccount[playerid][Helper],PlayerAccount[playerid][License][0],PlayerAccount[playerid][License][1],PlayerAccount[playerid][License][2],PlayerAccount[playerid][License][3],PlayerAccount[playerid][License][4],PlayerAccount[playerid][License][5],PlayerAccount[playerid][Spawned]);
format(str,sizeof(str),"%s WHERE `name`='%s';",str,NAME);

Right?