SA-MP Forums Archive
Random saving problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Random saving problem (/showthread.php?tid=319103)



Random saving problem - Tanush123 - 17.02.2012

Well for some reason people info won't save, its like the same and nothing saves.
pawn Код:
GetPlayerName(playerid,pname,sizeof(pname));
        //----------------------Accounts---------------------//
        format(query,sizeof(query),"SELECT * FROM accounts WHERE Name = '%s'",pname);
        mysql_query(query);

        format(query,sizeof(query),"UPDATE accounts SET AdminLevel = %d,vip = %d,Member = %d,Leader = %d,Genre = %d,Saveskin = %d,Pot = %d,Crack = %d,Hours = %d,Minutes = %d,Bank = %d,Level = %d,CarLicense = %d,Achievement = %d,Fishingrod = %d,Fishingline = %d,Fishingbaits = %d,Cig = %d,Lighter = %d,Soda = %d,Bag = %d,Civilskin = %d,Ipod = %d,Job = %d,Glasses = %d,President = %d,FStyle = %d,Guard = %d,OwnBus = %d,OwnBusID = %d,Cell = %d,Radio = %d,Number = %d,Passport = %d WHERE Name = '%s'",
        PlayerData[playerid][AdminLevel],PlayerData[playerid][vip],PlayerData[playerid][Member],PlayerData[playerid][Leader],PlayerData[playerid][Genre],PlayerData[playerid][Saveskin],PlayerData[playerid][Pot],PlayerData[playerid][Crack],PlayerData[playerid][Hours],PlayerData[playerid][Minutes],PlayerData[playerid][Bank],GetPlayerScore(playerid),PlayerData[playerid][CarLicense],PlayerData[playerid][Achievement],
        PlayerData[playerid][Fishingrod],PlayerData[playerid][Fishingline],PlayerData[playerid][Fishingbaits],PlayerData[playerid][Cig],PlayerData[playerid][Lighter],PlayerData[playerid][Soda],PlayerData[playerid][Bag],PlayerData[playerid][Civilskin],PlayerData[playerid][Ipod],PlayerData[playerid][Job],PlayerData[playerid][Glasses],PlayerData[playerid][President],PlayerData[playerid][FStyle],PlayerData[playerid][Guard],PlayerData[playerid][OwnBus],PlayerData[playerid][OwnBusID],
        PlayerData[playerid][Cell],PlayerData[playerid][Radio],PlayerData[playerid][Number],PlayerData[playerid][Passport],pname);
        mysql_query(query);

        format(query,sizeof(query),"UPDATE accounts SET GunLicense = %d,GunID = %d,TruckLicense = %d WHERE Name = '%s'",
        PlayerData[playerid][GunLicense],PlayerData[playerid][GunID],PlayerData[playerid][TruckLicense],pname);
        mysql_query(query);
This is under onplayerdisconnect...


Re: Random saving problem - [MG]Dimi - 18.02.2012

There is no reason to select anything from accounts. Only update label.
pawn Код:
format(query,sizeof(query),"UPDATE `accounts` SET `AdminLevel` = '%d',`vip` = '%d',`Member` = '%d',`Leader` = '%d',`Genre` = '%d',`Saveskin` = '%d',`Pot` = '%d',\
`Crack` = '%d',`Hours` = '%d',`Minutes` = '%d',`Bank` = '%d',`Level` = '%d',`CarLicense` = '%d',`Achievement` = '%d',`Fishingrod` = '%d',`Fishingline` = '%d',`Fishingbaits` = '%d',\
`Cig` = '%d',`Lighter` = '%d',`Soda` = '%d',`Bag` = '%d',`Civilskin` = '%d',`Ipod` = '%d',`Job` = '%d',`Glasses` = '%d',`President` = '%d',`FStyle` = '%d',`Guard` = '%d',`OwnBus` = '%d',\
`OwnBusID` = '%d',`Cell` = '%d',`Radio` = '%d',`Number` = '%d',`Passport` = '%d' WHERE `Name` = '%s'"
, PlayerData[playerid][AdminLevel],PlayerData[playerid][vip],PlayerData[playerid][Member],
PlayerData[playerid][Leader],PlayerData[playerid][Genre],PlayerData[playerid][Saveskin],PlayerData[playerid][Pot],PlayerData[playerid][Crack],PlayerData[playerid][Hours],PlayerData[playerid][Minutes],PlayerData[playerid][Bank],GetPlayerScore(playerid),PlayerData[playerid][CarLicense],PlayerData[playerid][Achievement],
PlayerData[playerid][Fishingrod],PlayerData[playerid][Fishingline],PlayerData[playerid][Fishingbaits],PlayerData[playerid][Cig],PlayerData[playerid][Lighter],PlayerData[playerid][Soda],PlayerData[playerid][Bag],PlayerData[playerid][Civilskin],PlayerData[playerid][Ipod],PlayerData[playerid][Job],PlayerData[playerid][Glasses],PlayerData[playerid][President],PlayerData[playerid][FStyle],PlayerData[playerid][Guard],PlayerData[playerid][OwnBus],PlayerData[playerid][OwnBusID],
PlayerData[playerid][Cell],PlayerData[playerid][Radio],PlayerData[playerid][Number],PlayerData[playerid][Passport],pname);
mysql_query(query);
format(query,sizeof(query),"UPDATE `accounts` SET `GunLicense` = '%d',`GunID` = '%d',`TruckLicense` = '%d' WHERE `Name` = '%s'",
PlayerData[playerid][GunLicense],PlayerData[playerid][GunID],PlayerData[playerid][TruckLicense],pname);
mysql_query(query);
Also, for 1561515631 time, All Table and COlumn names put between grave ( ` ) so it doesn't mix with SQL Syntax.


Re: Random saving problem - Slash_ - 18.02.2012

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение
There is no reason to select anything from accounts. Only update label.
pawn Код:
format(query,sizeof(query),"UPDATE `accounts` SET `AdminLevel` = '%d',`vip` = '%d',`Member` = '%d',`Leader` = '%d',`Genre` = '%d',`Saveskin` = '%d',`Pot` = '%d',\
`Crack` = '%d',`Hours` = '%d',`Minutes` = '%d',`Bank` = '%d',`Level` = '%d',`CarLicense` = '%d',`Achievement` = '%d',`Fishingrod` = '%d',`Fishingline` = '%d',`Fishingbaits` = '%d',\
`Cig` = '%d',`Lighter` = '%d',`Soda` = '%d',`Bag` = '%d',`Civilskin` = '%d',`Ipod` = '%d',`Job` = '%d',`Glasses` = '%d',`President` = '%d',`FStyle` = '%d',`Guard` = '%d',`OwnBus` = '%d',\
`OwnBusID` = '%d',`Cell` = '%d',`Radio` = '%d',`Number` = '%d',`Passport` = '%d' WHERE `Name` = '%s'"
, PlayerData[playerid][AdminLevel],PlayerData[playerid][vip],PlayerData[playerid][Member],
PlayerData[playerid][Leader],PlayerData[playerid][Genre],PlayerData[playerid][Saveskin],PlayerData[playerid][Pot],PlayerData[playerid][Crack],PlayerData[playerid][Hours],PlayerData[playerid][Minutes],PlayerData[playerid][Bank],GetPlayerScore(playerid),PlayerData[playerid][CarLicense],PlayerData[playerid][Achievement],
PlayerData[playerid][Fishingrod],PlayerData[playerid][Fishingline],PlayerData[playerid][Fishingbaits],PlayerData[playerid][Cig],PlayerData[playerid][Lighter],PlayerData[playerid][Soda],PlayerData[playerid][Bag],PlayerData[playerid][Civilskin],PlayerData[playerid][Ipod],PlayerData[playerid][Job],PlayerData[playerid][Glasses],PlayerData[playerid][President],PlayerData[playerid][FStyle],PlayerData[playerid][Guard],PlayerData[playerid][OwnBus],PlayerData[playerid][OwnBusID],
PlayerData[playerid][Cell],PlayerData[playerid][Radio],PlayerData[playerid][Number],PlayerData[playerid][Passport],pname);
mysql_query(query);
format(query,sizeof(query),"UPDATE `accounts` SET `GunLicense` = '%d',`GunID` = '%d',`TruckLicense` = '%d' WHERE `Name` = '%s'",
PlayerData[playerid][GunLicense],PlayerData[playerid][GunID],PlayerData[playerid][TruckLicense],pname);
mysql_query(query);
Also, for 1561515631 time, All Table and COlumn names put between grave ( ` ) so it doesn't mix with SQL Syntax.
Rep+