Problem with make area - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with make area (
/showthread.php?tid=336214)
Problem with make area -
jcvag44800 - 21.04.2012
Hi guys.
Here, I tried to make an area where the player can exit his vehicle.
Here's the script:
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(PlayerInfo[playerid][pWorld] == 3)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
if(GetPlayerTeam(playerid) == 1) // Rouges
{
if (x <= 436.3784 && x >= -81.0595)
{
SendClientMessage(playerid,COLOR_GREY,"Test");
}
else
{
return false;
}
}
if(GetPlayerTeam(playerid) == 2) // Verts
{
}
}
return 1;
}
The problem is that it makes me always the message, and it never comes in the "else"
Here is a screenshot of where I took the positions.
Quote:
436.3784,2528.7734,17.0038
|
http://imageshack.us/photo/my-images/151/samp000vh.png/
Quote:
-81.0595,2476.4946,16.4844
|
http://imageshack.us/photo/my-images...amp001ary.png/
AW: Problem with make area -
Nero_3D - 21.04.2012
create some function, so you only need to input the coordinates
pawn Код:
stock IsXYInArea(Float: X, Float: Y, const Float: min_x, const Float: max_x, const Float: min_y, const Float: max_y) {
return (
(min_x <= X <= max_x) &&
(min_y <= Y <= max_y)
);
}
In your example it would be
pawn Код:
// x, y, min_x, max_x, min_y, max_y
if(IsXYInArea(x, y, -81.0595, 436.3784, 2476.4946, 2528.7734)) {
SendClientMessage(playerid,COLOR_GREY,"Test");
}
Re: Problem with make area -
jcvag44800 - 21.04.2012
Thanks you man