SA-MP Forums Archive
Need help with enum vars - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help with enum vars (/showthread.php?tid=222864)



Need help with enum vars - sekol - 08.02.2011

So i want to load i.e Civilian spawn location from my djson file.
pawn Код:
enum Positions
{
    Float:pCivilianSpawnX,
    Float:pCivilianSpawnY,
    Float:pCivilianSpawnZ,
    pCivilianSpawnInterior
};
new PositionInfo[Positions];

public LoadPositions()
{
    PositionInfo[pCivilianSpawnX] = djFloat(POSITIONS_FILE, "Civilian/SpawnX");
    PositionInfo[pCivilianSpawnY] = djFloat(POSITIONS_FILE, "Civilian/SpawnX");
    PositionInfo[pCivilianSpawnZ] = djFloat(POSITIONS_FILE, "Civilian/SpawnX");
    PositionInfo[pCivilianSpawnInterior] = djInt(POSITIONS_FILE, "Civilian/SpawnInterior");
    return 1;
}
Everyone knows what this code do, right?
My prob starts here:
pawn Код:
SetPlayerPos(playerid, PositionInfo[pCivilianSpawnX], PositionInfo[pCivilianSpawnY], PositionInfo[pCivilianSpawnZ]);
            SetPlayerInterior(playerid, PositionInfo[pCivilianSpawnInterior]);
It spawns me in the middle of San Andreas... [0.0, 0.0, 0.0], while i made player spawn in LV...
What should i do? I think it doesn't read anything correctly from my djson file...


AW: Need help with enum vars - Nero_3D - 08.02.2011

You put your loading part in a public but do you call it ?


Re: Need help with enum vars - sekol - 08.02.2011

I call it on GameModeInit. So after restarting it should work. I tryed and nothing


AW: Need help with enum vars - Nero_3D - 08.02.2011

Than the dj functions think that there is something wrong

Print the DJSON_LastErrorCode (integer) and DJSON_LastError (string) for imformation
Explanation about the errorcode can be found in djson.inc


Re: Need help with enum vars - sekol - 08.02.2011

I was thinking about it and it can't be prob with djson... My Dynamic Faction spawning works fine.