My trouble with loading system
#1

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

This can help you

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

Код:
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.
Reply
#4

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

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];
Reply
#6

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


Forum Jump:


Users browsing this thread: 3 Guest(s)