public OnGameModeInit()
{
SetTimer("IsPlayerInArea",1000,true);
// other shit, vehicles objects, new gangzones that represent forbid zones etc
}
public IsPlayerInArea(playerid)
{
SendClientMessage(playerid,COLOR_WHITE,"Timer test - Message is showing every one second !");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if (x > FORBIDZONE1_X_MIN && x < FORBIDZONE1_X_MAX && y > FORBIDZONE1_Y_MIN && y < FORBIDZONE1_Y_MAX)
{
return SendClientMessage(playerid,COLOR_WHITE,"Your in the area lol");
}
if (x > FORBIDZONE2_X_MIN && x < FORBIDZONE2_X_MAX && y > FORBIDZONE2_Y_MIN && y < FORBIDZONE2_Y_MAX)
{
return SendClientMessage(playerid,COLOR_WHITE,"Your in the area lol");
}
if (x > FORBIDZONE3_X_MIN && x < FORBIDZONE3_X_MAX && y > FORBIDZONE3_Y_MIN && y < FORBIDZONE3_Y_MAX)
{
return SendClientMessage(playerid,COLOR_WHITE,"Your in the area lol");
}
if (x > FORBIDZONE4_X_MIN && x < FORBIDZONE4_X_MAX && y > FORBIDZONE4_Y_MIN && y < FORBIDZONE4_Y_MAX)
{
return SendClientMessage(playerid,COLOR_WHITE,"Your in the area lol");
}
if (x > FORBIDZONE5_X_MIN && x < FORBIDZONE5_X_MAX && y > FORBIDZONE5_Y_MIN && y < FORBIDZONE5_Y_MAX)
{
return SendClientMessage(playerid,COLOR_WHITE,"Your in the area lol");
}
return 0;
}
#define FORBIDZONE1_X_MAX -4087.256
#define FORBIDZONE1_X_MIN -864.1628
#define FORBIDZONE1_Y_MAX 2989.536
#define FORBIDZONE1_Y_MIN 4063.901
#define FORBIDZONE2_X_MAX 2627.522
#define FORBIDZONE2_X_MIN -2977.858
#define FORBIDZONE2_Y_MAX 2977.858
#define FORBIDZONE2_Y_MIN 2837.724
#define FORBIDZONE3_X_MAX -3316.517
#define FORBIDZONE3_X_MIN -2989.536
#define FORBIDZONE3_Y_MAX 2989.536
#define FORBIDZONE3_Y_MIN -2662.556
#define FORBIDZONE4_X_MAX -3012.892
#define FORBIDZONE4_X_MIN -2966.18
#define FORBIDZONE4_Y_MAX 58.38938
#define FORBIDZONE4_Y_MIN 3082.959
#define FORBIDZONE5_X_MAX -3188.06
#define FORBIDZONE5_X_MIN -2989.536
#define FORBIDZONE5_Y_MAX 934.23
#define FORBIDZONE5_Y_MIN -1996.917
public IsPlayerInArea()
{
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
SendClientMessage(i,COLOR_WHITE,"Timer test - Message is showing every one second !");
new Float:x, Float:y, Float:z;
GetPlayerPos(i, x, y, z);
if (x > FORBIDZONE1_X_MIN && x < FORBIDZONE1_X_MAX && y > FORBIDZONE1_Y_MIN && y < FORBIDZONE1_Y_MAX)
{
SendClientMessage(i,COLOR_WHITE,"Your in the area lol");
}
if (x > FORBIDZONE2_X_MIN && x < FORBIDZONE2_X_MAX && y > FORBIDZONE2_Y_MIN && y < FORBIDZONE2_Y_MAX)
{
SendClientMessage(i,COLOR_WHITE,"Your in the area lol");
}
if (x > FORBIDZONE3_X_MIN && x < FORBIDZONE3_X_MAX && y > FORBIDZONE3_Y_MIN && y < FORBIDZONE3_Y_MAX)
{
SendClientMessage(i,COLOR_WHITE,"Your in the area lol");
}
if (x > FORBIDZONE4_X_MIN && x < FORBIDZONE4_X_MAX && y > FORBIDZONE4_Y_MIN && y < FORBIDZONE4_Y_MAX)
{
SendClientMessage(i,COLOR_WHITE,"Your in the area lol");
}
if (x > FORBIDZONE5_X_MIN && x < FORBIDZONE5_X_MAX && y > FORBIDZONE5_Y_MIN && y < FORBIDZONE5_Y_MAX)
{
SendClientMessage(i,COLOR_WHITE,"Your in the area lol");
}
}
}
}
#define FORBIDZONE1_X_MAX -4087.256
#define FORBIDZONE1_X_MIN -864.1628
#define FORBIDZONE1_Y_MAX 2989.536
#define FORBIDZONE1_Y_MIN 4063.901
#define FORBIDZONE1_X_MAX -864.1628
#define FORBIDZONE1_X_MIN -4087.256
#define FORBIDZONE1_Y_MAX 4063.901
#define FORBIDZONE1_Y_MIN 2989.536
North max y *------* min x | | max x | | *------* min y South
Код:
North max y *------* min x | | max x | | *------* min y South |
2989.536 is smaller than 4063.901, so it's wrong. Should be like this: pawn Код:
|
#define FORBIDZONE1_X_MAX -864.1628
#define FORBIDZONE1_X_MIN -4087.256
#define FORBIDZONE1_Y_MAX 4063.901
#define FORBIDZONE1_Y_MIN 2989.536
#define FORBIDZONE2_X_MAX 2627.522
#define FORBIDZONE2_X_MIN -2977.858
#define FORBIDZONE2_Y_MAX 2977.858
#define FORBIDZONE2_Y_MIN 2837.724
#define FORBIDZONE3_X_MAX -2989.536 //-3316.517
#define FORBIDZONE3_X_MIN -3316.517 //-2989.536
#define FORBIDZONE3_Y_MAX 2989.536
#define FORBIDZONE3_Y_MIN -2662.556
#define FORBIDZONE4_X_MAX -2966.18 //-3012.892
#define FORBIDZONE4_X_MIN -3012.892 //-2966.18
#define FORBIDZONE4_Y_MAX 3082.959 //58.38938
#define FORBIDZONE4_Y_MIN 58.38938 // 3082.959
#define FORBIDZONE5_X_MAX -2989.536 //-3188.06
#define FORBIDZONE5_X_MIN -3188.06 //-2989.536
#define FORBIDZONE5_Y_MAX 934.23 //934.23
#define FORBIDZONE5_Y_MIN -1996.917 //-1996.917
// you can ignore the commented lines above
public OnGameModeInit()
{
SetTimer("IsPlayerInArea", 1000, true);
Forbidzone1 = GangZoneCreate(-864.1628, -4087.256, 4063.901, 2989.536);
Forbidzone2 = GangZoneCreate(-2977.858, 2627.522, 2837.724, 2977.858);
Forbidzone3 = GangZoneCreate(-2989.536, -3316.517, -2662.556, 2989.536);
Forbidzone4 = GangZoneCreate(-2966.18, -3012.892, 3082.959, 58.38938);
Forbidzone5 = GangZoneCreate(-2989.536, -3188.06, -1996.917, 934.23);
GangZoneShowForAll(Forbidzone1, COLOR_BLACK);
GangZoneShowForAll(Forbidzone2, COLOR_BLACK);
GangZoneShowForAll(Forbidzone3, COLOR_BLACK);
GangZoneShowForAll(Forbidzone4, COLOR_BLACK);
GangZoneShowForAll(Forbidzone5, COLOR_BLACK);
// other shit
public IsPlayerInArea()
{
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new Float:x, Float:y, Float:z;
GetPlayerPos(i, x, y, z);
if (x > FORBIDZONE1_X_MIN && x < FORBIDZONE1_X_MAX && y > FORBIDZONE1_Y_MIN && y < FORBIDZONE1_Y_MAX)
{
SendClientMessage(i,COLOR_WHITE,"Your in the area lol");
}
if (x > FORBIDZONE2_X_MIN && x < FORBIDZONE2_X_MAX && y > FORBIDZONE2_Y_MIN && y < FORBIDZONE2_Y_MAX)
{
SendClientMessage(i,COLOR_WHITE,"Your in the area lol");
}
if (x > FORBIDZONE3_X_MIN && x < FORBIDZONE3_X_MAX && y > FORBIDZONE3_Y_MIN && y < FORBIDZONE3_Y_MAX)
{
SendClientMessage(i,COLOR_WHITE,"Your in the area lol");
}
if (x > FORBIDZONE4_X_MIN && x < FORBIDZONE4_X_MAX && y > FORBIDZONE4_Y_MIN && y < FORBIDZONE4_Y_MAX)
{
SendClientMessage(i,COLOR_WHITE,"Your in the area lol");
}
if (x > FORBIDZONE5_X_MIN && x < FORBIDZONE5_X_MAX && y > FORBIDZONE5_Y_MIN && y < FORBIDZONE5_Y_MAX)
{
SendClientMessage(i,COLOR_WHITE,"Your in the area lol");
}
}
}
}