22.09.2012, 13:33
Here is my code.
When i spawn on the red team it works fine. If the player leaves the area it will teleport them back into the area.
But when i spawn onto the blue team it keeps spamming chat "Don't charge before the whistle blows" in chat which is saying the positions i have are wrong.. I have tried every possible way. Below is how i am doing it. am i doing it wrong?
I get the position of one corner. Then i get the position of the other corner.
They are my positions.
I take
and
and put them in the first part
Then i get the second Y part of the coords.
and
to make the full line.
Am i taking out the positions wrong ?
I will be very grateful for your help
Код:
public isPlayerInArea() { new Float:X, Float:Y, Float:Z; //We use this to store player position for(new i=0; i < MAX_PLAYERS; i++) //This line defines a name for all player, the name is "i" { GetPlayerPos(i, X, Y, Z); //Here we are storing the player position on the variables X, Y, and Z defined previously if(gTeam[i] == Blue) { if (X <= 421.3180 && X >= 466.3142 && Y <= 3016.6777 && Y >=3021.6487) { } else { SetPlayerPos(i, 445.8247,3018.9521,11.0578); SendClientMessage(i, COLOR_RED, "Don't Try and Charge Before The Whistle Blows!"); } } if(gTeam[i] == Red) { if (X <= 467.6861 && X >= 423.3671 && Y <= 3078.2888 && Y >= 3072.3367) { } else { SetPlayerPos(i, 443.5487,3075.1423,11.0578); //This will ensure, that our player gets killed if he tries to enter SendClientMessage(i, COLOR_RED, "Don't Try and Charge Before The Whistle Blows!"); } } } }
But when i spawn onto the blue team it keeps spamming chat "Don't charge before the whistle blows" in chat which is saying the positions i have are wrong.. I have tried every possible way. Below is how i am doing it. am i doing it wrong?
I get the position of one corner. Then i get the position of the other corner.
Quote:
AddPlayerClass(107,421.3180,3016.6777,12.9443,182. 7400,0,0,0,0,0,0); // a&y1st AddPlayerClass(107,466.3142,3021.6487,11.0578,275. 9059,0,0,0,0,0,0); // x&y2 |
I take
Quote:
421.3180 |
Quote:
466.3142 |
Quote:
if (X <= 421.3180 && X >= 466.3142 |
Quote:
3016.6777 |
Quote:
3021.6487 |
Quote:
if (X <= 421.3180 && X >= 466.3142 && Y <= 3016.6777 && Y >=3021.6487) |
I will be very grateful for your help