SA-MP Forums Archive
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:xFloat:yFloat:z;
GetPlayerPos(playeridxyz);
if(
InfoZone[i][gMin_x] && InfoZone[i][gMax_x] && InfoZone[i][gMin_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(playeridFloat:minxFloat:maxxFloat:minyFloat:maxy)
{
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(playeridxyz);
    if (
minx && maxx && miny && maxy) return 1;
    return 
0;

PHP код:
for(new ii<(the variable for your max gang zones); i++)
{
        if(
IsPlayerInArea(playeridInfoZone[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:xFloat:yFloat:z;
GetPlayerPos(playeridxyz);
if(
InfoZone[i][gMin_x] && InfoZone[i][gMax_x] && InfoZone[i][gMin_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(playeridFloat:minxFloat:maxxFloat:minyFloat:maxy)
{
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(playeridxyz);
    if (
minx && maxx && miny && maxy) return 1;
    return 
0;

PHP код:
for(new ii<(the variable for your max gang zones); i++)
{
        if(
IsPlayerInArea(playeridInfoZone[i][gMin_x], InfoZone[i][gMax_x], InfoZone[i][gMin_y], InfoZone[i][gMax_y]))
        {
                
// do this
        
}

Thanks, it also helped me