30.10.2010, 15:51
I see 2 problems in your code.
First is that it only works for playerid 0.
To fix that:
And secondly, your coordinates are messed up.
Max should be bigger than Min.
2989.536 is smaller than 4063.901, so it's wrong.
Should be like this:
First is that it only works for playerid 0.
To fix that:
pawn Код:
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");
}
}
}
}
Max should be bigger than Min.
pawn Код:
#define FORBIDZONE1_X_MAX -4087.256
#define FORBIDZONE1_X_MIN -864.1628
#define FORBIDZONE1_Y_MAX 2989.536
#define FORBIDZONE1_Y_MIN 4063.901
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