SA-MP Forums Archive
Save 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: Save problem (/showthread.php?tid=387390)



Save problem - raamiix - 24.10.2012

Hello

I have a problem and that is when I open my server, and to turn it off or restart it (gmx) will lose all their money and lands on less money and you die, how can I fix it so it becomes as an "autosave"?


Re: Save problem - gtakillerIV - 24.10.2012

Use:

PHP код:
public OnRconCommand(cmd[])
{
    if(!
strcmp(cmd"gmx"true))
    {
         for (new 
i=0i<MAX_PLAYERSi++)
           {
             if(
IsPlayerConnected(i))
               {
                new 
INI:File INI_Open(UserPath(i));
                
INI_SetTag(File,"data");
                
INI_WriteInt(File,"Cash",GetPlayerMoney(i));
                
INI_WriteInt(File,"Admin",PlayerInfo[i][pAdmin]);
                
INI_WriteInt(File,"Vip",PlayerInfo[i][pVip]);
                
INI_WriteInt(File,"Kills",PlayerInfo[i][pKills]);
                
INI_WriteInt(File,"Score"PlayerInfo[i][pScore]);
                
INI_WriteInt(File"Ip"PlayerInfo[i][pIp]);
                
INI_WriteInt(File,"Deaths",PlayerInfo[i][pDeaths]);
                
INI_Close(File);
            }
        }
    }
    return 
1;

Change the saving part to suite your GM.


Re: Save problem - raamiix - 26.10.2012

Quote:
Originally Posted by gtakillerIV
Посмотреть сообщение
Use:

PHP код:
public OnRconCommand(cmd[])
{
    if(!
strcmp(cmd"gmx"true))
    {
         for (new 
i=0i<MAX_PLAYERSi++)
           {
             if(
IsPlayerConnected(i))
               {
                new 
INI:File INI_Open(UserPath(i));
                
INI_SetTag(File,"data");
                
INI_WriteInt(File,"Cash",GetPlayerMoney(i));
                
INI_WriteInt(File,"Admin",PlayerInfo[i][pAdmin]);
                
INI_WriteInt(File,"Vip",PlayerInfo[i][pVip]);
                
INI_WriteInt(File,"Kills",PlayerInfo[i][pKills]);
                
INI_WriteInt(File,"Score"PlayerInfo[i][pScore]);
                
INI_WriteInt(File"Ip"PlayerInfo[i][pIp]);
                
INI_WriteInt(File,"Deaths",PlayerInfo[i][pDeaths]);
                
INI_Close(File);
            }
        }
    }
    return 
1;

Change the saving part to suite your GM.
Where in the gamemode need i put this ?


Re: Save problem - CoaPsyFactor - 26.10.2012

where ever you want, but first check do you already have OnRconCommand function, if you didn't delete anything after New Project in pawno you should have it


Re: Save problem - raamiix - 26.10.2012

Quote:
Originally Posted by CoaPsyFactor
Посмотреть сообщение
where ever you want, but first check do you already have OnRconCommand function, if you didn't delete anything after New Project in pawno you should have it
I got error:

H:\Users\Ramin\Desktop\samp03e_svr_R2_win32\gamemo des\NS-RP.pwn(368 : error 017: undefined symbol "INI_Open"
H:\Users\Ramin\Desktop\samp03e_svr_R2_win32\gamemo des\NS-RP.pwn(368 : warning 213: tag mismatch
H:\Users\Ramin\Desktop\samp03e_svr_R2_win32\gamemo des\NS-RP.pwn(3689) : error 017: undefined symbol "INI_SetTag"
H:\Users\Ramin\Desktop\samp03e_svr_R2_win32\gamemo des\NS-RP.pwn(3690) : error 017: undefined symbol "INI_WriteInt"
H:\Users\Ramin\Desktop\samp03e_svr_R2_win32\gamemo des\NS-RP.pwn(3691) : error 017: undefined symbol "INI_WriteInt"
H:\Users\Ramin\Desktop\samp03e_svr_R2_win32\gamemo des\NS-RP.pwn(3692) : error 017: undefined symbol "INI_WriteInt"
H:\Users\Ramin\Desktop\samp03e_svr_R2_win32\gamemo des\NS-RP.pwn(3693) : error 017: undefined symbol "INI_WriteInt"
H:\Users\Ramin\Desktop\samp03e_svr_R2_win32\gamemo des\NS-RP.pwn(3694) : error 017: undefined symbol "INI_WriteInt"
H:\Users\Ramin\Desktop\samp03e_svr_R2_win32\gamemo des\NS-RP.pwn(3695) : error 017: undefined symbol "INI_WriteInt"
H:\Users\Ramin\Desktop\samp03e_svr_R2_win32\gamemo des\NS-RP.pwn(3696) : error 017: undefined symbol "INI_WriteInt"
H:\Users\Ramin\Desktop\samp03e_svr_R2_win32\gamemo des\NS-RP.pwn(3697) : error 017: undefined symbol "INI_Close"
H:\Users\Ramin\Desktop\samp03e_svr_R2_win32\gamemo des\NS-RP.pwn(368 : warning 204: symbol is assigned a value that is never used: "File"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


10 Errors.


Re: Save problem - Faisal_khan - 26.10.2012

Get the include Ini. Download the YSI package. And don't forget to add this:
pawn Код:
#include <YSI/y_ini>



Re: Save problem - raamiix - 26.10.2012

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
Get the include Ini. Download the YSI package. And don't forget to add this:
pawn Код:
#include <YSI/y_ini>
Thanks, now i only got one error:

H:\Users\Ramin\Desktop\samp03e_svr_R2_win32\pawno\ include\YSI\y_iterate.inc(202) : fatal error 111: user error: "Old foreach.inc files are no longer compatible with YSI."


Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


Re: Save problem - gtakillerIV - 26.10.2012

Download the latest "foreach.inc".

https://sampforum.blast.hk/showthread.php?tid=92679


Re: Save problem - raamiix - 26.10.2012

Quote:
Originally Posted by gtakillerIV
Посмотреть сообщение
Download the latest "foreach.inc".

https://sampforum.blast.hk/showthread.php?tid=92679
And where in the folder need i put it?


Re: Save problem - Faisal_khan - 26.10.2012

In your includes.