Problem - Job functions
#1

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;

Reply
#2

Where is the line 218 ?
Reply
#3

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

Try this:

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

same problem. Any other ideas?
Reply
#6

Show us how pPATH is defined.
Reply
#7

How did you defined "pPATH"?
Reply
#8

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
Reply
#9

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

Yeah... Sorry my mistake
However thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)