SA-MP Forums Archive
Problem with gang zone - 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 with gang zone (/showthread.php?tid=660295)



Problem with gang zone - ProfessorX - 30.10.2018

On OngameModeInit, i am loading the turfs using y_ini. then once i get the data i create a zone this is the code:
pawn Код:
for(new f = 0; f  < sizeof(TurfsInfo); f++)//Creates a loop, that goes through all of the businesses.
{
     new strs[40];
     format(strs, sizeof(strs), TPATH, f);//formats the file path, with the biz ID
     INI_ParseFile(strs, "loadturf_%s", .bExtra = true, .extra = f );

     TurfsInfo[f][TurfID] = GangZoneCreate(TurfsInfo[f][minx], TurfsInfo[f][miny], TurfsInfo[f][maxx], TurfsInfo[f][maxy], TurfsInfo[f][TurfsColor], -1, -1, 0, -1);
     printf("[debug] Turf %d: %x", f, TurfsInfo[f][TurfsColor]);
}
This is the color in the file: 0xFFFF00AA
but its color in game is white? why?


Re: Problem with gang zone - ProfessorX - 30.10.2018

I know now the problem but help me.
From the file: tColor = 0xFFFF00AA
but when it loads it becomes FFFF00AA
the "0x" gets removed, help me pls

this is save code:
pawn Код:
forward SaveTurf(id);
public SaveTurf(id)
{
    new file4[40];
    format(file4, sizeof(file4), TPATH, id);
    new INI:File = INI_Open(file4);
    INI_SetTag(File,"data");
    INI_WriteHex(File,"tColor", TurfsInfo[id][TurfsColor]);
    INI_Close(File);
    return 1;
}
loading the turf code:
pawn Код:
forward loadturf_data(idx, name[], value[]);
public loadturf_data(idx, name[], value[])
{
        INI_Hex("tColor", TurfsInfo[idx][TurfsColor]);
    return 1;
}



Re: Problem with gang zone - GameOvr - 30.10.2018

idk much about pawn but what if you do something like this
Код:
format(str, 14, "0x%s", TurfsInfo[idx][TurfsColor]);

now str will store the hex as u want
another solution

You can change the write hex into write string
because hex is with RRGGBB format but in samp colors comes with 0x

Or change ur debug
Код:
printf("[debug] Turf %d: %x", f, TurfsInfo[f][TurfsColor]);

to this

printf("[debug] Turf %d: %s", f, TurfsInfo[f][TurfsColor]);
Check that even now it shows with 0x


Re: Problem with gang zone - ProfessorX - 30.10.2018

I will get an error if i set the color with a string.


Re: Problem with gang zone - UFF - 30.10.2018

GangZoneCreate has only 4 parameters minx, miny,maxx,maxy

So Under OnGamemodeInit
pawn Код:
for(new f = 0; f  < sizeof(TurfsInfo); f++)//Creates a loop, that goes through all of the businesses.
{
     new strs[40];
     format(strs, sizeof(strs), TPATH, f);//formats the file path, with the biz ID
     INI_ParseFile(strs, "loadturf_%s", .bExtra = true, .extra = f );

     TurfsInfo[f][TurfID] = GangZoneCreate(TurfsInfo[f][minx], TurfsInfo[f][miny], TurfsInfo[f][maxx], TurfsInfo[f][maxy]);
     printf("[debug] Turf %d: %x", f, TurfsInfo[f][TurfsColor]);
}
You should use GangZoneShowForPlayer(playerid, zoneid, zonecolor); Under OnPlayerSpawn.

So, Under OnPlayerSpawn
pawn Код:
for(new f = 0; f  < sizeof(TurfsInfo); f++)
{
         new colour[15];
         format(colour, 15, "%s50", TurfsInfo[f][TurfsColor]);
         GangZoneShowForPlayer(playerid, TurfsInfo[f][TurfID], colour);
}



Re: Problem with gang zone - ProfessorX - 30.10.2018

I am using Gammix's gangzone include. Pretty sure it has 9 parameters.