GangZone - 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: GangZone (
/showthread.php?tid=645241)
GangZone -
Mamoru - 23.11.2017
Hi, how can I detect if I am inside a GangZone?
How to detect if I am within these coordinates?
pawn Код:
InfoZone[i][gMin_x]
InfoZone[i][gMin_y]
InfoZone[i][gMax_x]
InfoZone[i][gMax_y]
•••••••••••••••••••••••••••••••••••
Hola, como puedo hacer para detectar si estoy dentro de un GangZone?
-Como detectar si estoy dentro de estбs coordenadas?
pawn Код:
InfoZone[i][gMin_x]
InfoZone[i][gMin_y]
InfoZone[i][gMax_x]
InfoZone[i][gMax_y]
Re: GangZone -
FailerZ - 23.11.2017
PHP код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(x > InfoZone[i][gMin_x] && x < InfoZone[i][gMax_x] && y > InfoZone[i][gMin_y] && y < InfoZone[i][gMax_y])
{
//Player id is inside the zone. Do something.
}
else
{
//Player id is outside the zone. You could skip the whole else part.
}
Re: GangZone -
frouzen - 23.11.2017
PHP код:
IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if (x > minx && x < maxx && y > miny && y < maxy) return 1;
return 0;
}
PHP код:
for(new i; i<(the variable for your max gang zones); i++)
{
if(IsPlayerInArea(playerid, InfoZone[i][gMin_x], InfoZone[i][gMax_x], InfoZone[i][gMin_y], InfoZone[i][gMax_y]))
{
// do this
}
}
Re: GangZone -
Mamoru - 23.11.2017
Quote:
Originally Posted by FailerZ
PHP код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(x > InfoZone[i][gMin_x] && x < InfoZone[i][gMax_x] && y > InfoZone[i][gMin_y] && y < InfoZone[i][gMax_y])
{
//Player id is inside the zone. Do something.
}
else
{
//Player id is outside the zone. You could skip the whole else part.
}
|
Thank you!!
I did not know how to do something like that.
••••••••••••
Gracias, no sabнa como hacer algo asн.
Re: GangZone -
Mamoru - 23.11.2017
Quote:
Originally Posted by frouzen
PHP код:
IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if (x > minx && x < maxx && y > miny && y < maxy) return 1;
return 0;
}
PHP код:
for(new i; i<(the variable for your max gang zones); i++)
{
if(IsPlayerInArea(playerid, InfoZone[i][gMin_x], InfoZone[i][gMax_x], InfoZone[i][gMin_y], InfoZone[i][gMax_y]))
{
// do this
}
}
|

Thanks, it also helped me