Save problem
#1

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"?
Reply
#2

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.
Reply
#3

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 ?
Reply
#4

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
Reply
#5

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.
Reply
#6

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

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.
Reply
#8

Download the latest "foreach.inc".

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

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?
Reply
#10

In your includes.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)