SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 17/11/2009, 06:11 PM   #1
jamesb93
Huge Clucker
 
Join Date: May 2009
Posts: 216
Reputation: 0
Default MySQL Saving ON gmx

Hey,

Currently on my mysql TDM server. Players are losing their cars and their stats on a restart. Could I make like a SavePlayers(); and SaveVehicles(); under OnGameModeExit. Currently I have this:

pawn Code:
public SavePlayer(playerid)
{
    CheckSQL();
    new query[512];
    format(query,sizeof(query),"UPDATE `players` SET rank=%d,reborn=%d,exp=%d,van=%d,kills=%d,tkills=%d,gkill=%d,mp5kill=%d,kkill=%d,mgoal=%d,hgoal=%d,agoal=%d,mapgoal=%d,deaths=%d,admin=%d,gm=%d,premium=%d,money=%d WHERE playerid=%d",
      PlayerInfo[playerid][pRank],PlayerInfo[playerid][pReborn],PlayerInfo[playerid][pExp],PlayerInfo[playerid][pVan],PlayerInfo[playerid][pKills],PlayerInfo[playerid][pTKills],PlayerInfo[playerid][pGrenadekill],PlayerInfo[playerid][pMp5kill],
      PlayerInfo[playerid][pKnucklekill],PlayerInfo[playerid][pMenugoal],PlayerInfo[playerid][pHeligoal],PlayerInfo[playerid]         [pArmourgoal],PlayerInfo[playerid][pMapgoal],PlayerInfo[playerid][pDeaths],PlayerInfo[playerid][pAdmin],
      PlayerInfo[playerid][pGM],PlayerInfo[playerid][pPremium],PlayerInfo[playerid][pCash],PlayerInfo[playerid][pSQLId]);
    mysql_query(query);
    return 1;
}

and

pawn Code:
public SaveVehicle(vehid)
{
    new query[256];
    format(query,sizeof(query),"UPDATE `vehicles` SET model=%d,x=%f,y=%f,z=%f,a=%f,col1=%d,col2=%d,type=%d,price=%d,ownerid=%d WHERE vehid=%d",
        vInfo[vehid][vModelId],vInfo[vehid][vPos_X],vInfo[vehid][vPos_Y],vInfo[vehid][vPos_Z],vInfo[vehid][vPos_A],vInfo[vehid][vColor1],
        vInfo[vehid][vColor2],vInfo[vehid][vBuyAble],vInfo[vehid][vPrice],vInfo[vehid][vOwnerId],vInfo[vehid][vSQLId]);
    mysql_query(query);
    return 1;
}

Can anyone help me make a fucntion to save all players stats and vehicles on a restart?
jamesb93 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySql Saving IP? BurrodaZero Help Archive 0 22/05/2010 01:22 PM
saving ip in mysql database swredder Help Archive 2 12/05/2010 06:42 PM
Saving IP addresses in mysql JeroenGFX Help Archive 0 03/05/2010 06:06 PM
mysql saving prob WardenCS Help Archive 1 17/04/2010 07:37 PM
mysql score saving. ajwar Help Archive 2 26/01/2010 02:00 PM


All times are GMT. The time now is 12:36 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.