Using isPlayerInArea in another script, is this possible?
#1

I am working on a DM zone and currently using Bomber FS by Mauzen.
Also, I have set isPlayerInArea function in my gamemode, that enables players to only have weapons when they are in the Area 69 DM zone. Now I want to combine (?) this. I want players to only be able to drop bombs from the airplanes, when they are in the Area 69 zone.

Here is my anti weapon code:
Код:
public isPlayerInArea()
{
	new Float:X, Float:Y, Float:Z;
 	for(new i=0; i < MAX_PLAYERS; i++)
  	{
   		GetPlayerPos(i, X, Y, Z);
     	if (X <= 464.0057 && X >= -117.3833 && Y <= 2111.7815 && Y >= 1568.7208)
	   	{
       	}
       	else
		{
		   		ResetPlayerWeapons(i);
		}
   	}
}
and here is the Bomber FS: http://pastebin.com/0r7ZyS9B

Can anyone help me?
Thanks in advance
Reply
#2

There is a function, called: IsPlayerAllowedToDropBomb just replace the original:

pawn Код:
IsPlayerAllowedToDropBomb(playerid)
{
    #pragma unused playerid
    // This is used to restrict the use of bombs for single players
    // For example to make them available for special teams only, ...
    // bptype[playerid] is the index of the selected bomb
    return 1;
}

with:
pawn Код:
IsPlayerAllowedToDropBomb(playerid)
{
    new Float:X, Float:Y, Float:Z; 
    GetPlayerPos(playerid, X, Y, Z);
    if (X <= 464.0057 && X >= -117.3833 && Y <= 2111.7815 && Y >= 1568.7208) return 1;  //In the Area, returns 1.
    else return 0;  //not in area, returns 0.
}
I hope I could help you.

Jeffry
Reply
#3

Just combine IsPlayerInVehicle and some isPlayerInArea. Also if you want it to be in the GM first step for you would be to combine the FS to the GM.

EDIT: NVM Jeffery's method is actually better.
Reply
#4

or
pawn Код:
IsPlayerAllowedToDropBomb(playerid)
{
    new Float:X, Float:Y, Float:Z;  
    GetPlayerPos(playerid, X, Y, Z);
    return (X <= 464.0057 && X >= -117.3833 && Y <= 2111.7815 && Y >= 1568.7208);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)