SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 08/12/2018, 03:28 PM   #1
GameOvr
Big Clucker
 
Join Date: Jun 2018
Posts: 148
Reputation: 0
Default A little help! (Y_INI not saving properly)

Hello I made a Zone capture system it's also saving zone data on gamemode exit. But the problem is it's not saving the correct data on the file at gamemode exit plz someone help me here's the code

pawn Code:
//OnGameModeInit
new fstr[50];
    for(new i = 0; i < sizeof(ZONEINFO); i++)
    {
        ZONEID[i] = GangZoneCreate( ZONEINFO[i][zminx], ZONEINFO[i][zminy], ZONEINFO[i][zmaxx], ZONEINFO[i][zmaxy]);
        DZONEID[i] = CreateDynamicRectangle( ZONEINFO[i][zminx], ZONEINFO[i][zminy], ZONEINFO[i][zmaxx], ZONEINFO[i][zmaxy]);
        format(fstr, sizeof(fstr), ZONEPATH, i + 1);
        if(!fexist(fstr))
        {
            new INI:zfile = INI_Open(fstr);
            INI_SetTag(zfile, "Zone data");
            INI_WriteString(zfile, "Zone_Name", ZONEINFO[i][zname]);
            INI_WriteBool(zfile, "Zone_Owned", false);
            INI_WriteHex(zfile, "Zone_Color", 0xC0C0C066);
            INI_WriteInt(zfile, "Zone_Owned_Team_ID", -1);
            INI_WriteString(zfile, "Zone_Owned_Team", "No_Team");
            INI_Close(zfile);

            INI_ParseFile(fstr, "LoadZoneData", .bExtra = true, .extra = i);
        }
        else
        {
            INI_ParseFile(fstr, "LoadZoneData", .bExtra = true, .extra = i);
        }
    }

//loading data from file (Im not loading zone name because it's not changing [Zone names are in the script])
forward LoadZoneData(i, name[], value[]);
public LoadZoneData(i, name[], value[])
{
    INI_Bool("Zone_Owned", ZONEINFO[i][zowned]);
    INI_Hex("Zone_Color", ZONEINFO[i][zcolor]);
    INI_Int("Zone_Owned_Team_ID", ZONEINFO[i][zteamid]);
    INI_String("Zone_Owned_Team", ZONEINFO[i][zteam], 45);
    return 1;
}

//When someone captured the zone
    ZONEINFO[i][zteamid] = ZoneAttacker[i];
    ZONEINFO[i][zcolor] = GetTeamZoneColor(ZoneAttacker[i]);
    ZONEINFO[i][zteam] = GetTeamName(ZoneAttacker[i]);
    ZONEINFO[i][zowned] = true;

//and when exiting gamemode
new fstr[128];
    for(new i = 0; i < sizeof(ZONEINFO); i++)
    {
        format(fstr, sizeof(fstr), ZONEPATH, i + 1);

        new INI:zfile = INI_Open(fstr);
        INI_SetTag(zfile, "Zone data");
        INI_WriteBool(zfile, "Zone_Owned", ZONEINFO[i][zowned]);
        INI_WriteHex(zfile, "Zone_Color", ZONEINFO[i][zcolor]);
        INI_WriteInt(zfile, "Zone_Owned_Team_ID", ZONEINFO[i][zteamid]);
        INI_WriteString(zfile, "Zone_Owned_Team", ZONEINFO[i][zteam]);
        INI_Close(zfile);
    }

I can't find anything wrong it save all zones like this(in default way)

Code:
[Zone data]
Zone_Name = //Zone name is here
Zone_Owned = false
Zone_Color = 0xC0C0C066
Zone_Owned_Team_ID = -1
Zone_Owned_Team = No_Team
__________________
Server Info :-
Host Name : ...::: Death Shadow CriticalWarZ :::...
Address : 173.249.49.62:7028
Mode : DSC v1.1: GW | ft. DM
Language : English

Description & Features :-
Gang Wars based server with default 6 gangs
Also there's a custom gang system
Featuring Death match (6 DMs)
Events like Gungame, LMS etc.
and much more ...

Discord : - https://discord.gg/Naudu9x
GameOvr is offline   Reply With Quote
Old 09/12/2018, 08:38 AM   #2
GameOvr
Big Clucker
 
Join Date: Jun 2018
Posts: 148
Reputation: 0
Default Re: A little help! (Y_INI not saving properly)

Bump..
Plz help
__________________
Server Info :-
Host Name : ...::: Death Shadow CriticalWarZ :::...
Address : 173.249.49.62:7028
Mode : DSC v1.1: GW | ft. DM
Language : English

Description & Features :-
Gang Wars based server with default 6 gangs
Also there's a custom gang system
Featuring Death match (6 DMs)
Events like Gungame, LMS etc.
and much more ...

Discord : - https://discord.gg/Naudu9x
GameOvr is offline   Reply With Quote
Old 09/12/2018, 09:32 AM   #3
Logic_
Banned
 
Join Date: Jun 2015
Posts: 1,514
Reputation: 305
Default Re: A little help! (Y_INI not saving properly)

Why do still people use INI - just make use of SQLite here.
Logic_ is offline   Reply With Quote
Old 09/12/2018, 04:20 PM   #4
GameOvr
Big Clucker
 
Join Date: Jun 2018
Posts: 148
Reputation: 0
Default Re: A little help! (Y_INI not saving properly)

Thanks,
And yes if I won't able to figure out what is the error
I will change it to sqlite
__________________
Server Info :-
Host Name : ...::: Death Shadow CriticalWarZ :::...
Address : 173.249.49.62:7028
Mode : DSC v1.1: GW | ft. DM
Language : English

Description & Features :-
Gang Wars based server with default 6 gangs
Also there's a custom gang system
Featuring Death match (6 DMs)
Events like Gungame, LMS etc.
and much more ...

Discord : - https://discord.gg/Naudu9x
GameOvr is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 06:43 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.