SA-MP Forums Archive
My trouble with loading system - 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: My trouble with loading system (/showthread.php?tid=346424)



My trouble with loading system - wmt - 28.05.2012

Could you explain me how to load data from .ini file located in /scriptfiles/save using dini? The name of the file is the name of the player.


Re: My trouble with loading system - ViniBorn - 28.05.2012

This can help you

http://forum.sa-mp.com/showthread.ph...highlight=dini


Re: My trouble with loading system - TzAkS. - 28.05.2012

Код:
forward LoadPlayerData(playerid);
public LoadPlayerData(playerid)
{
	new pname[MAX_PLAYER_NAME];
	new file[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(file, sizeof(file), "%s.ini", pname);
	if(!dini_Exists(file))
    {
		dini_Create(file);
	}
	else
	{
		PlayerInfo[playerid][pLevel] = dini_Int(file,"Level");
		// and others..
        }
}
I did for load the level,,but you need to add your function there.


Re: My trouble with loading system - wmt - 28.05.2012

TzAkS., this doesn't work. Pawno says:
Код:
D:\Серверы\EDUC\gamemodes\grandlarc.pwn(555) : error 017: undefined symbol "PlayerInfo"
D:\Серверы\EDUC\gamemodes\grandlarc.pwn(555) : warning 215: expression has no effect
D:\Серверы\EDUC\gamemodes\grandlarc.pwn(555) : error 001: expected token: ";", but found "]"
D:\Серверы\EDUC\gamemodes\grandlarc.pwn(555) : error 029: invalid expression, assumed zero
D:\Серверы\EDUC\gamemodes\grandlarc.pwn(555) : fatal error 107: too many error messages on one line

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


4 Errors.
Here is my code on pastebin: click!

Viniborn, I am just a newbie, so could you give me the ready code? This lesson didn't help me.


Re: My trouble with loading system - SuperViper - 28.05.2012

Don't use dini, it's very inefficient. I recommend Y_INI if you're planning to use file-based saving instead of SQL.

To define PlayerInfo, you need to do something like this:

pawn Код:
enum e_PlayerInfo
{
    pVariable1,
    pVariable2,
    Float: pVariable3,
}

new PlayerInfo[MAX_PLAYERS][e_PlayerInfo];



Re: My trouble with loading system - wmt - 28.05.2012

SuperViper, could you look through the code on pastebin (link) and tell me why doesn't it work?