GangZone won't load
#1

I'm creating a turf war server
but this one is different. The zone saves in a file.

I've the file but it doesn't work.

Here is the code

pawn Код:
enum GangInfo
{
    Owner[100],
    TeamID,
    ID,
    Float:MinX,
    Float:MinY,
    Float:MaxX,
    Float:MaxY,
    Float:TakeX,
    Float:TakeY,
    Float:TakeZ,
    Color,
    CP,
    MID
};
new gInfo[MAX_ZONES][GangInfo];

public loadzone_data(idx, name[], value[])
{
    INI_String("Owner", gInfo[idx][Owner], 100);
    INI_Int("ID", gInfo[idx][ID]);
    INI_Int("TeamID", gInfo[idx][TeamID]);
    INI_Hex("Color", gInfo[idx][Color]);
    INI_Int("CheckpointID", gInfo[idx][CP]);
    INI_Int("MapID", gInfo[idx][MID]);
    INI_Float("MaxX", gInfo[idx][MaxX]);
    INI_Float("MaxY", gInfo[idx][MaxY]);
    INI_Float("MinX", gInfo[idx][MinX]);
    INI_Float("MinY", gInfo[idx][MinY]);
    INI_Float("TakeX", gInfo[idx][TakeX]);
    INI_Float("TakeY", gInfo[idx][TakeY]);
    INI_Float("TakeZ", gInfo[idx][TakeZ]);
    return 1;
}

public OnGameModeInit()
{
    //=====================[Script]=====================//

    new str[40];
    for(new idx = 0; idx < sizeof(gInfo); idx++)
    {
        format(str, sizeof(str), GangPath, idx);
        INI_ParseFile(str, "loadzone_%s", .bExtra = true, .extra = idx);
        gInfo[idx][CP] = CreateDynamicCP(gInfo[idx][TakeX], gInfo[idx][TakeY], gInfo[idx][TakeZ], 3.0, -1, -1, -1, 40.0);
        gInfo[idx][MID] = CreateDynamicMapIcon(gInfo[idx][TakeX], gInfo[idx][TakeY], gInfo[idx][TakeZ], 19, COLOR_WHITE, -1, -1, -1, 40.0);
        gInfo[idx][ID] = GangZoneCreate(gInfo[idx][MinX], gInfo[idx][MinY], gInfo[idx][MaxX], gInfo[idx][MaxY]);
    }
   
    print("[Debug] OnGameModeInit is called, Los Santos Turf War");
    return 1;
}

public OnPlayerConnect(playerid)
{
for(new idx = 0; idx < sizeof(gInfo); idx++)
{
    GangZoneShowForPlayer(playerid, gInfo[idx][ID], gInfo[idx][Color]);
}
        return 1;
}

stock SaveZones(id)
{
    new file[256], owner[100];
    format(file, sizeof(file), GangPath, id);
    new INI:File = INI_Open(file);
    INI_SetTag(File, "Zones");
    switch(gInfo[id][TeamID])
    {
        case 0: owner = "Ballas";
        case 1: owner = "Grove Street";
        case 2: owner = "Los Vagos";
        case 3: owner = "Las Aztecas";
    }
    INI_WriteString(File, "Owner", owner);
    INI_WriteInt(File, "ID", gInfo[id][ID]);
    INI_WriteInt(File, "TeamID", gInfo[id][TeamID]);
    INI_WriteHex(File, "Color", gInfo[id][Color]);
    INI_WriteInt(File, "CheckpointID", gInfo[id][CP]);
    INI_WriteInt(File, "MapID", gInfo[id][MID]);
    INI_WriteFloat(File, "MaxX", gInfo[id][MaxX]);
    INI_WriteFloat(File, "MaxY", gInfo[id][MaxY]);
    INI_WriteFloat(File, "MinX", gInfo[id][MinX]);
    INI_WriteFloat(File, "MinY", gInfo[id][MinY]);
    INI_WriteFloat(File, "TakeX", gInfo[id][TakeX]);
    INI_WriteFloat(File, "TakeY", gInfo[id][TakeY]);
    INI_WriteFloat(File, "TakeZ", gInfo[id][TakeZ]);
    INI_Close(File);
    return 1;
}
here is the file i used to test with.

Path: "LS Turf/GangZone/0.ini"

Код:
[Zones]
Owner = Ballas
ID = 0
TeamID = 0
Color = 0x00FF00FF
CheckpointID = 0
MapID = 19
MaxX = 1972.1477
MaxY = -2191.7231
MinX = 1950.7703
MinY = -2156.0007
TakeX = 1953.7517
TakeY = -2188.3179
TakeZ = 13.5469
Reply


Messages In This Thread
GangZone won't load - by JaKe Elite - 12.01.2013, 06:57
Re: GangZone won't load - by EAsT-OAK_510 - 12.01.2013, 07:01
Re: GangZone won't load - by JaKe Elite - 12.01.2013, 07:02
Re: GangZone won't load - by JaKe Elite - 12.01.2013, 07:08
Re: GangZone won't load - by JaKe Elite - 17.01.2013, 07:30
Re: GangZone won't load - by JaKe Elite - 17.01.2013, 08:07

Forum Jump:


Users browsing this thread: 2 Guest(s)