SA-MP Forums Archive
Saving - Loading - 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: Saving - Loading (/showthread.php?tid=385277)



Saving - Loading - SumX - 15.10.2012

Hello!
What's wrong here? The saving is working,but the loading isn't working.

PHP код:
//OnGameModeInIt
LoadTeamLimits();
//OnGameModeExit
SaveTeamLimits();
forward SaveTeamLimits();
public 
SaveTeamLimits()
{
        new 
INI:File INI_Open("Teams/TeamLimits.ini");
    
INI_WriteInt(File"SouthBoysMembers"SouthBoysM);
    
INI_WriteInt(File"YakooMembers"YakooM);
    
INI_WriteInt(File"TheTriadsMembers"TheTriadsM);
    
INI_WriteInt(File"MafiaMembers"MafiaM);
    
INI_WriteInt(File"VagosMembers"VagosM);
    
INI_WriteInt(File"CopsMembers"CopsM);
    
INI_WriteInt(File"HitmanMembers"HitmanM);
    
INI_WriteInt(File"NFSMembers"NFSM);
    
INI_WriteInt(File"MotoMembers"MotoM);
        
INI_Close(File);
        return 
1;
}
stock LoadTeamLimits(name[], value[])
{
        new 
INI:File INI_Open("Teams/TeamLimits.ini");
    
INI_Int("SouthBoysMembers",SouthBoysM);
    
INI_Int("YakooMembers",YakooM);
    
INI_Int("TheTriadsMembers"TheTriadsM);
    
INI_Int("MafiaMembers"MafiaM);
    
INI_Int("VagosMembers"VagosM);
    
INI_Int("CopsMembers"CopsM);
    
INI_Int("HitmanMembers"HitmanM);
    
INI_Int("NFSMembers"NFSM);
    
INI_Int("MotoMembers"MotoM);
    
INI_Close(File);
    return 
0;




AW: Saving - Loading - BiosMarcel - 15.10.2012

PHP код:
stock LoadTeamLimits()

        new 
INI:File INI_Open("Teams/TeamLimits.ini"); 
    
INI_Int("SouthBoysMembers",SouthBoysM); 
    
INI_Int("YakooMembers",YakooM); 
    
INI_Int("TheTriadsMembers"TheTriadsM); 
    
INI_Int("MafiaMembers"MafiaM); 
    
INI_Int("VagosMembers"VagosM); 
    
INI_Int("CopsMembers"CopsM); 
    
INI_Int("HitmanMembers"HitmanM); 
    
INI_Int("NFSMembers"NFSM); 
    
INI_Int("MotoMembers"MotoM); 
    
INI_Close(File); 
    return 
0




Re: Saving - Loading - CaRa - 15.10.2012

You forgot to load in ongamemodeinit

Код:
 INI_ParseFile("Teams/TeamLimits.ini", "LoadOneFile", .bPassTag = true);
Place it in OnGameModeInit


Re: AW: Saving - Loading - SumX - 15.10.2012

Quote:
Originally Posted by [Bios]Marcel
Посмотреть сообщение
PHP код:
stock LoadTeamLimits()

        new 
INI:File INI_Open("Teams/TeamLimits.ini"); 
    
INI_Int("SouthBoysMembers",SouthBoysM); 
    
INI_Int("YakooMembers",YakooM); 
    
INI_Int("TheTriadsMembers"TheTriadsM); 
    
INI_Int("MafiaMembers"MafiaM); 
    
INI_Int("VagosMembers"VagosM); 
    
INI_Int("CopsMembers"CopsM); 
    
INI_Int("HitmanMembers"HitmanM); 
    
INI_Int("NFSMembers"NFSM); 
    
INI_Int("MotoMembers"MotoM); 
    
INI_Close(File); 
    return 
0

Try this and you will get "undefined symbol name and value".

CaRa,what's this? LoadOneFile


AW: Saving - Loading - BiosMarcel - 15.10.2012

Nefore opening the File you must Load it(i think that he mean that)

[QOUTE]CaRa,what's this? LoadOneFile [/QOUTE]

Don't know that it says undefined symbol sry


Re: Saving - Loading - SumX - 15.10.2012

Anyone?
Or CaRa? Can you answer? Thank you!


Re: Saving - Loading - CaRa - 15.10.2012

Quote:
Originally Posted by CaRa
Посмотреть сообщение
You forgot to load in ongamemodeinit

Код:
 INI_ParseFile("Teams/TeamLimits.ini", "LoadOneFile", .bPassTag = true);
Place it in OnGameModeInit
So, with this you actually open the file, place it ongamemodeinit... Try TeamLimits.ini if doesn't work with team/teamlimits.ini


Re: Saving - Loading - SumX - 15.10.2012

I tried again something.But it isn't working.Only it saves ,loading failes,my variables are resetting to 0.

Hey!What's wrong here? It is saving but it is not loading.

PHP код:
new SouthBoysM;
new 
YakooM;
new 
TheTriadsM;
new 
MafiaM;
new 
VagosM;
new 
CopsM;
public 
OnGameModeInIt()
{
    
INI_ParseFile("Teams/TeamLimits.ini""LoadTeamLimits"falsetruetruefalse);
    return 
1;
}
public 
OnGameModeExit()
{
    
SaveTeamLimits();
    return 
1;
}
forward LoadTeamLimits(name[],value[]);
public 
LoadTeamLimits(name[],value[])
{
    if(!
strcmp(name"SouthBoysMembers"true)) { SouthBoysM strval(value); }
    if(!
strcmp(name"YakooMembers"true)) { YakooM strval(value); }
    if(!
strcmp(name"TheTriadsMembers"true)) { TheTriadsM strval(value); }
    if(!
strcmp(name"MafiaMembers"true)) { MafiaM strval(value); }
    if(!
strcmp(name"VagosMembers"true)) { VagosM strval(value); }
    if(!
strcmp(name"CopsMembers"true)) { CopsM strval(value); }
    return 
0;
}
stock SaveTeamLimits()
{
    new 
INI:File INI_Open("Teams/TeamLimits.ini");
    
INI_SetTag(File"Main");
    
INI_WriteInt(File"SouthBoysMembers"SouthBoysM);
    
INI_WriteInt(File"YakooMembers"YakooM);
    
INI_WriteInt(File"TheTriadsMembers"TheTriadsM);
    
INI_WriteInt(File"MafiaMembers"MafiaM);
    
INI_WriteInt(File"VagosMembers"VagosM);
    
INI_WriteInt(File"CopsMembers"CopsM);
    
INI_Close(File);
    return 
1;




Re: Saving - Loading - CaRa - 15.10.2012

Quote:
Originally Posted by SumX
Посмотреть сообщение
I tried again something.But it isn't working.Only it saves ,loading failes,my variables are resetting to 0.

Hey!What's wrong here? It is saving but it is not loading.

PHP код:
new SouthBoysM;
new 
YakooM;
new 
TheTriadsM;
new 
MafiaM;
new 
VagosM;
new 
CopsM;
public 
OnGameModeInIt()
{
    
INI_ParseFile("Teams/TeamLimits.ini""LoadTeamLimits"falsetruetruefalse);
    return 
1;
}
public 
OnGameModeExit()
{
    
SaveTeamLimits();
    return 
1;
}
forward LoadTeamLimits(name[],value[]);
public 
LoadTeamLimits(name[],value[])
{
    if(!
strcmp(name"SouthBoysMembers"true)) { SouthBoysM strval(value); }
    if(!
strcmp(name"YakooMembers"true)) { YakooM strval(value); }
    if(!
strcmp(name"TheTriadsMembers"true)) { TheTriadsM strval(value); }
    if(!
strcmp(name"MafiaMembers"true)) { MafiaM strval(value); }
    if(!
strcmp(name"VagosMembers"true)) { VagosM strval(value); }
    if(!
strcmp(name"CopsMembers"true)) { CopsM strval(value); }
    return 
0;
}
stock SaveTeamLimits()
{
    new 
INI:File INI_Open("Teams/TeamLimits.ini");
    
INI_SetTag(File"Main");
    
INI_WriteInt(File"SouthBoysMembers"SouthBoysM);
    
INI_WriteInt(File"YakooMembers"YakooM);
    
INI_WriteInt(File"TheTriadsMembers"TheTriadsM);
    
INI_WriteInt(File"MafiaMembers"MafiaM);
    
INI_WriteInt(File"VagosMembers"VagosM);
    
INI_WriteInt(File"CopsMembers"CopsM);
    
INI_Close(File);
    return 
1;

Change your parsefile with this. You did it ?

Код:
 INI_ParseFile("Teams/TeamLimits.ini"", "LoadOneFile", .bPassTag = true);



Re: Saving - Loading - SumX - 15.10.2012

Quote:
Originally Posted by CaRa
Посмотреть сообщение
Change your parsefile with this. You did it ?

Код:
 INI_ParseFile("Teams/TeamLimits.ini"", "LoadOneFile", .bPassTag = true);
what's LoadOneFile?