last call for help
#1

Then ill give up this shit....im getting gray hair about this!
its about zone messages that NEVER wants to work, i have tested plenty of codes etc.

So if you are interested to help me fix this so i can get on with other things in the GM, i would be VERY happy
PM me if so.
Reply
#2

PHP код:
new bool:ZoneShowed[MAX_PLAYERS];//set on connect to 0!
SetTimer("CheckZone"20001);
forward CheckZone(); 
PHP код:
public CheckZone()
{
for(new 
i=0i<MAX_PLAYERSi++)
{
    if(
IsPlayerConnected(i))
    {
        if(
IsPlayerInArea(iminxmaxxminymaxy))
        {
                       if(
ZoneShowed[i] == false)
                       {
            
GameTextForPlayer(i"~r~Zone name"30003);
            
ZoneShowed[i] = true;
            }
        }
        else
        {
        
ZoneShowed[i] = false;
        }
    }
    }
    return 
1;
}
IsPlayerInArea(playeridFloat:minxFloat:maxxFloat:minyFloat:maxy)
{
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(playeridxyz);
    if (
minx && maxx && miny && maxy) return 1;
    return 
0;

keep up your hair!
Reply
#3

Quote:
Originally Posted by LZLo
Посмотреть сообщение
PHP код:
new bool:ZoneShowed[MAX_PLAYERS];//set on connect to 0!
SetTimer("CheckZone"20001);
forward CheckZone(); 
PHP код:
public CheckZone()
{
for(new 
i=0i<MAX_PLAYERSi++)
{
    if(
IsPlayerConnected(i))
    {
        if(
IsPlayerInArea(iminxmaxxminymaxy))
        {
                       if(
ZoneShowed[i] == false)
                       {
            
GameTextForPlayer(i"~r~Zone name"30003);
            
ZoneShowed[i] = true;
            }
        }
        else
        {
        
ZoneShowed[i] = false;
        }
    }
    }
    return 
1;
}
IsPlayerInArea(playeridFloat:minxFloat:maxxFloat:minyFloat:maxy)
{
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(playeridxyz);
    if (
minx && maxx && miny && maxy) return 1;
    return 
0;

keep up your hair!
Lol i can try keep it up :P

But even this doesn't working
on checkzone i have this, but i doesn't get the message, it might be because the "ZoneShowed"? because the zones are always visible.
pawn Код:
public CheckZone()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
    {
        if(IsPlayerInArea(i, 817, 607, 2931, 2896))
        {
                       if(ZoneShowed[i] == false)
                       {
            GameTextForPlayer(i, "~r~You are entering hostile ground and airspace", 3000, 3);
            ZoneShowed[i] = true;
            }
        }
        else
        {
        ZoneShowed[i] = false;
        }
    }
    }
    return 1;
}
EDIT: the coordinates is the same as the zones, so they should be correct even in IsPlayerInArea?
Reply
#4

you will (only) get the message if you enter the zone

and set the bool on onplayerconnect to 0
Reply
#5

Quote:
Originally Posted by LZLo
Посмотреть сообщение
you will (only) get the message if you enter the zone

and set the bool on onplayerconnect to 0
Yeah i know that.
and i forgot to put that on OnPlayerConnect
is this right? because i getting a warning on it
pawn Код:
ZoneShowed[playerid] = 0;
Reply
#6

Quote:
Originally Posted by cruising
Посмотреть сообщение
Yeah i know that.
and i forgot to put that on OnPlayerConnect
is this right? because i getting a warning on it
pawn Код:
ZoneShowed[playerid] = 0;
with false
pawn Код:
ZoneShowed[playerid] = false;
you need it because somebody disconnect form your server and from that area
and then somebody will connect, the one who connected isnt going to see the gametext
Reply
#7

Quote:
Originally Posted by LZLo
Посмотреть сообщение
with false
pawn Код:
ZoneShowed[playerid] = false;
you need it because somebody disconnect form your server and from that area
and then somebody will connect, the one who connected isnt going to see the gametext
Works now BUT.... it doesn't gives the message at the edges of the zone, and the IsPlayerInArea has the same coordinates as the zone, is it because a delay or something? it is like it would be smaller then the zone but still have the same coordinates

EDIT:
CODE:
pawn Код:
if(IsPlayerInArea(i, -2907, -1027, -607, 1646))
GangZoneCreate(-2907.791, -1027.653, -607.2495, 1646.58);
EDIT 2: i also have added the other 2 zones, but only the first one is giving a message.
Reply
#8

Now i have done this so far, i have added all 3 zones to make them give you a warning when enter enemy zones, and to make the zones flash when inside it.

BUT... why does only the first one work? (the Thunderbirds one)
Airwolves and Bluefoxes do not work, the Thunderbirds do work for all players as it should do.

And i also had to change the coordinates manual for Thunderbirds to be bigger then the zone to make it sync with the zone, how come?

So why does only the first one working?
CODE:
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
    {
        if(IsPlayerInArea(i, -2907, -600, -1025, 1646)) //Thunderbirds
        {
            if(GetPlayerTeam(i) != 3)
            {
                if(ZoneShowed[i] == false)
                {
                    GangZoneFlashForPlayer(i,ZoneThunderbirds,COLOR_RED);
                    GameTextForPlayer(i, "~r~You are entering hostile ground and airspace", 6000, 3);
                    ZoneShowed[i] = true;
                    }
                }
            }
        else if(IsPlayerInArea(i, 817, 607, 2931, 2896))//Airwolves
        {
            if(GetPlayerTeam(i) != 1)
            {
                if(ZoneShowed[i] == false)
                {
                    GangZoneFlashForPlayer(i,ZoneAirwolves,COLOR_RED);
                    GameTextForPlayer(i, "~r~You are entering hostile ground and airspace", 6000, 3);
                    ZoneShowed[i] = true;
                    }
                }
            }
        else if(IsPlayerInArea(i, 81, -2931, 2977, -840))//Bluefoxes
        {
            if(GetPlayerTeam(i) != 2)
            {
                if(ZoneShowed[i] == false)
                {
                    GangZoneFlashForPlayer(i,ZoneBluefoxes,COLOR_RED);
                    GameTextForPlayer(i, "~r~You are entering hostile ground and airspace", 6000, 3);
                    ZoneShowed[i] = true;
                    }
                }
            }
        else
        {
            ZoneShowed[i] = false;
            GangZoneStopFlashForPlayer(i, ZoneThunderbirds);
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)