SA-MP Forums Archive
Problem - Job functions - 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: Problem - Job functions (/showthread.php?tid=569169)



Problem - Job functions - NoDi522 - 28.03.2015

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:

PHP код:
enum pPosao
{
    
pID//Job ID
    
pZaposlen//employed
    
pLevel // Skill/exp in job
};
new 
PlayerPosao[MAX_PLAYERS][pPosao]; 
Saving:

PHP код:
    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:

PHP код:
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:

PHP код:
public OnGameModeInit()
    
INI_ParseFile(PosaoPath(playerid), "LoadPosao_%s", .bExtra true, .extra playerid); 
Errors:

PHP код:
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(218) : error 037invalid string (possibly non-terminated string)
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(218) : error 029invalid expressionassumed zero
C
:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(218) : error 017undefined symbol "ini"
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(218) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
4 Errors

lines:

PHP код:
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;




Re : Problem - Job functions - Wassimo - 28.03.2015

Where is the line 218 ?


Re: Problem - Job functions - NoDi522 - 28.03.2015

format(poruka,sizeof(poruka),pPATH,ime); // error line


Re : Problem - Job functions - Wassimo - 28.03.2015

Try this:

Код:
format(poruka, sizeof(poruka), pPATH, ime); // Try this



Re: Problem - Job functions - NoDi522 - 28.03.2015

same problem. Any other ideas?


Re: Problem - Job functions - Tanky - 28.03.2015

Show us how pPATH is defined.


Re: Problem - Job functions - Loot - 28.03.2015

How did you defined "pPATH"?


Re: Problem - Job functions - NoDi522 - 28.03.2015

I fixed this:

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

to this

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

And now i got error:

PHP код:
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(965) : error 017undefined symbol "playerid"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase 
965 -
PHP код:
INI_ParseFile(PosaoPath(playerid), "LoadPosao_%s", .bExtra true, .extra playerid); 
// Its under ongamemodeinit


Re: Problem - Job functions - Tanky - 28.03.2015

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.


Re: Problem - Job functions - NoDi522 - 28.03.2015

Yeah... Sorry my mistake
However thanks!