PDA

View Full Version : Problem - Job functions


NoDi522
28/03/2015, 06:13 PM
Hello.

I am making my job system and i've got some errors which i couldn't fix. So if you could help me i would appreciate.

Job enum:

enum pPosao
{
pID, //Job ID
pZaposlen, //employed
pLevel // Skill/exp in job
};
new PlayerPosao[MAX_PLAYERS][pPosao];

Saving:

new INI:pFile = INI_Open(PosaoPath(playerid));
INI_SetTag(pFile,"data");
INI_WriteInt(pFile,"ID",PlayerPosao[playerid][pID]);
INI_WriteInt(pFile,"Zaposlen",PlayerPosao[playerid][pZaposlen]);
INI_WriteInt(pFile,"Level",PlayerPosao[playerid][pLevel]);
INI_Close(pFile);

Loading:

public LoadPosao_data(playerid,name[],value[])
{
INI_Int("ID",PlayerPosao[playerid][pID]);
INI_Int("Zaposlen",PlayerPosao[playerid][pZaposlen]);
INI_Int("Level",PlayerPosao[playerid][pLevel]);
return 1;
}


Loading - gamemodeinit:

public OnGameModeInit()
INI_ParseFile(PosaoPath(playerid), "LoadPosao_%s", .bExtra = true, .extra = playerid);

Errors:

C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(218) : error 037: invalid string (possibly non-terminated string)
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(218) : error 029: invalid expression, assumed zero
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(218) : error 017: undefined symbol "ini"
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(218) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.



lines:

stock PosaoPath(playerid)
{
new poruka[128],ime[MAX_PLAYER_NAME];
GetPlayerName(playerid,ime,sizeof(ime));
format(poruka,sizeof(poruka),pPATH,ime); // error line
return poruka;
}

Wassimo
28/03/2015, 06:21 PM
Where is the line 218 ?

NoDi522
28/03/2015, 06:28 PM
format(poruka,sizeof(poruka),pPATH,ime); // error line

Wassimo
28/03/2015, 06:30 PM
Try this:

format(poruka, sizeof(poruka), pPATH, ime); // Try this

NoDi522
28/03/2015, 06:40 PM
same problem. Any other ideas?

Tanky
28/03/2015, 06:41 PM
Show us how pPATH is defined.

Loot
28/03/2015, 06:42 PM
How did you defined "pPATH"?

NoDi522
28/03/2015, 07:49 PM
I fixed this:

#define pPATH "/Poslovi/Posao_%s.ini // missing "

to this

#define pPATH "/Poslovi/Posao_%s.ini"

And now i got error:

C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(965) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


965 - INI_ParseFile(PosaoPath(playerid), "LoadPosao_%s", .bExtra = true, .extra = playerid); // Its under ongamemodeinit

Tanky
28/03/2015, 07:58 PM
Ongamemodeinit - gets called when the gamemode starts - there isn't any player online, so whose data are you trying to load?

Move that code under OnPlayerConnect.

Or you probably want to load it after the player logs in, so move it there.

NoDi522
28/03/2015, 08:07 PM
Yeah... Sorry my mistake :)
However thanks!