SA-MP Forums Archive
Actions inside a Gang-Zones - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Actions inside a Gang-Zones (/showthread.php?tid=64930)



Actions inside a Gang-Zones - GeKo - 08.02.2009

Hello community,

I have a problem with my gang zones.
I would like to create a godzone, but i dont know how it is defined.
I can create gang zones...
How can I define what happens in there gang zone...

Can you help me there?

Sorry for my bad English knowledge...


Re: Actions inside a Gang-Zones - SmartyPants - 08.02.2009

IsPlayerInArea

pawn Код:
public IsPlayerInArea(playerid, Float:data[4])
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(X >= data[0] && X <= data[2] && Y >= data[1] && Y <= data[3]) {
return 1;
}
return 0;
}



Re: Actions inside a Gang-Zones - GeKo - 08.02.2009

thnx carlos

data 4 is the SetPlayerHealth line right?


Re: Actions inside a Gang-Zones - LarzI - 08.02.2009

No it's not, and would that function even work?
Cuz you need to set both minx, miny, maxx and maxy...

pawn Код:
public IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    if(X >= data[0] && X <= data[2] && Y >= data[1] && Y <= data[3])
        return 1;
    return 0;
}
Use a timer to check if a player is inside that area


Re: Actions inside a Gang-Zones - GeKo - 08.02.2009

Hm...But how can I make that the player have godmode


Re: Actions inside a Gang-Zones - SmartyPants - 08.02.2009

yeah liek this

pawn Код:
public GodArea(playerid)
{
    if(IsPlayerInArea(playerid, 1109.398, 116.7788, 1331.278, 303.6248))//change cords to ur own
    {
    SetPlayerHealth(playerid, 99999);
    }
    return 1;
}
pawn Код:
stock IsPlayerInArea(playerid, Float:max_x, Float:min_x, Float:max_y, Float:min_y)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(X <= max_x && X >= min_x && Y <= max_y && Y >= min_y) return 1;
return 0;
}
pawn Код:
SetTimer("GodArea",2000,0);