Problem with gang zone
#1

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?
Reply
#2

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;
}
Reply
#3

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

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

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);
}
Reply
#6

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


Forum Jump:


Users browsing this thread: 2 Guest(s)