Showing zone color?
#1

I have this

pawn Код:
//top
#define     ArmyZoneID      4
#define     TerrorZoneID    5
#define     MafiaZoneID     6

enum gzInfo
{
    Float:MinX,
    Float:MinY,
    Float:MaxX,
    Float:MaxY,
    ZoneID
}
new GangZone[][gzInfo] =
{
    {49.7817, 1663.5907, 404.7234, 2120.2429, ArmyZoneID},
    {-769.4115, 2157.6770, -321.8503, 2339.4497, MafiaZoneID},
    {-346.4589, 2546.4268, -0.6197, 2816.84625, TerrorZoneID},
    //and so on...
}

//gamemodeinit
    for(new gz = 0; gz < sizeof(GangZone); gz++)
    {
        GangZoneCreate(GangZone[gz][MinX],GangZone[gz][MinY],GangZone[gz][MaxX],GangZone[gz][MaxY]);
    }

//onplayerconnect
    for(new gz = 0; gz < sizeof(GangZone); gz++)
    {
        GangZoneShowForPlayer(playerid,GangZone[gz][ArmyZoneID],0x0000FF55); //errors
        GangZoneShowForPlayer(playerid,GangZone[gz][TerrorZoneID],0xFF000055); //errors
        GangZoneShowForPlayer(playerid,GangZone[gz][MafiaZoneID],0xFF800055); //errors
    }
Errors/Warnings
Код:
warning 213: tag mismatch
warning 213: tag mismatch
error 032: array index out of bounds (variable "GangZone")
warning 213: tag mismatch
error 032: array index out of bounds (variable "GangZone")
Reply
#2

Wrong saw to late you defined gz!
Reply
#3

up..
Reply
#4

https://sampwiki.blast.hk/wiki/GangZoneShowForPlayer


as u see u didn't define the gangzone in terms of
pawn Код:
for(new gz = 0; gz < sizeof(GangZone); gz++)
    {
        GangZone[gz][ZoneID] = GangZoneCreate(GangZone[gz][MinX],GangZone[gz][MinY],GangZone[gz][MaxX],GangZone[gz][MaxY]);
    }

for(new gz = 0; gz < sizeof(GangZone); gz++)
    {
        GangZoneShowForPlayer(playerid,GangZone[gz][ZoneID],0x0000FF55);
        GangZoneShowForPlayer(playerid,GangZone[gz][ZoneID],0xFF000055);
        GangZoneShowForPlayer(playerid,GangZone[gz][ZoneID],0xFF800055);
    }
Reply
#5

all the errors and warnings you should give a value here.

pass the variable must be Float.



pawn Код:
#define MAX_GANG 3

new Float:GangZone[MAX_GANG][gzInfo] =
{
    {49.7817, 1663.5907, 404.7234, 2120.2429, ArmyZoneID},
    {-769.4115, 2157.6770, -321.8503, 2339.4497, MafiaZoneID},
    {-346.4589, 2546.4268, -0.6197, 2816.84625, TerrorZoneID},
    //and so on...
}
Reply
#6

@Glad2BeHere: It only shows this color 0xFF800055 (the last one)
@cesar_******: It doesn't matter if I want to put a value there or not...
Reply
#7

pawn Код:
#include a_samp

//top
#define     ArmyZoneID      4
#define     TerrorZoneID    5
#define     MafiaZoneID     6

enum gzInfo
{
    Float:MinX,
    Float:MinY,
    Float:MaxX,
    Float:MaxY,
    TeamID,
    ZoneID

}
new GangZone[][gzInfo] =
{
    {49.7817, 1663.5907, 404.7234, 2120.2429, ArmyZoneID},
    {-769.4115, 2157.6770, -321.8503, 2339.4497, MafiaZoneID},
    {-346.4589, 2546.4268, -0.6197, 2816.84625, TerrorZoneID}
    //and so on...
};

public OnGameModeInit()
{
    //gamemodeinit
    for(new gz = 0; gz < sizeof(GangZone); gz++)
    {
    GangZone[gz][ZoneID] = GangZoneCreate(GangZone[gz][MinX],GangZone[gz][MinY],GangZone[gz][MaxX],GangZone[gz][MaxY]);
    }
   
   
}

public OnPlayerConnect(playerid)
{
    for(new i=0; i< sizeof GangZone; i++)
    {
        GangZoneShowForPlayer(playerid, GangZone[i][TeamID], GetTeamColor(GangZone[i][TeamID]));
    }
    return 1;
}

GetTeamColor(team)
{
    switch(team)
    {
        case ArmyZoneID  : return 0x0000FF55;
        case TerrorZoneID: return 0xFF000055;
        case MafiaZoneID : return 0xFF800055;
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)