SA-MP Forums Archive
How to create a DeathMatch zone with IsPlayerInArea? - 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: How to create a DeathMatch zone with IsPlayerInArea? (/showthread.php?tid=69663)



How to create a DeathMatch zone with IsPlayerInArea? - Remi-X - 19.03.2009

Hi, i've made last a DeathMatch area with IsPlayerInArea in my stunt server. It had work first, but suddenly it do'nt work anymore. So i was wondering wat the best method is to make a DeathMatch Zone?
Ive tried this for my zone, but is i explained, it didn't work anymore.
Код:
#include <a_samp>
new DM[MAX_PLAYERS];
new Area69report[MAX_PLAYERS];
forward DeathMatch(playerid);
forward IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy);
public OnGameModeInit()
{
SetTimer("Area69", 400, 1);
return 1;
}

public OnPlayerSpawn(playerid)
{
	DM[playerid] = 0;
	Area69report[playerid] = 0;
	SetPlayerArmour(playerid, 1000);
	SetPlayerHealth(playerid, 1000);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	DM[playerid] = 0;
	Area69report[playerid] = 0;
return 1;
}
public OnPlayerUpdate(playerid)
{
	if (DM[playerid] == 0)
	{
		new Float:Health;
		GetPlayerHealth(playerid,Health);
		if (Health < 100)
		{
			SetPlayerHealth(playerid,100);
		}
		if (IsPlayerInAnyVehicle(playerid) == 1)
		{
		  new PlayerCar;
		  new Float:CarHealth;
		  PlayerCar = GetPlayerVehicleID(playerid);
			GetVehicleHealth(PlayerCar,CarHealth);
			if (CarHealth < 1000)
			{
				SetVehicleHealth(PlayerCar, 1000.0);
 			}
 		}
	}
 return 1;

}

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;
    {
    	DM[playerid] = 1;
		}
    return 0;
}


public DeathMatch(playerid)
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
      if (IsPlayerInArea(i,-55.5792, 418.7632, 1664.8753, 2119.9753) == 1)
      {
        if (Area69report[i] == 0)
        {
        SendClientMessage(i, RED, "test");
        DM[playerid] = 1;
        Area69report[i] = 1;
				}
      }
    }
  }
  return 1;
}
But i think im going too far, there must be a easier way to do this?
This is what i want:
If you walk into the DM zone, godmode will be turned off. And if you walk out of the DM zone, DM wil be turned on. If you want to get out with a specefic vehicle, you will be killed. And i want to simply add new DM zones.

Is that possible? And how must i make that?

Sorry about my bad english...


Re: How to create a DeathMatch zone with IsPlayerInArea? - Sajtos - 22.05.2009

if (IsPlayerInArea(i,-55.5792, 418.7632, 1664.8753, 2119.9753) == 1


AddPlayerClass(180,3010.9258,-871.2566,-0.3437,271.4363,0,0,0,0,0,0); // gangwarzone1
AddPlayerClass(180,2847.8044,-2779.3528,-0.0705,185.8569,0,0,0,0,0,0); // gangwarzone2
AddPlayerClass(180,291.2917,-2780.7139,-0.4570,238.1683,0,0,0,0,0,0); // gangwarzone3
AddPlayerClass(180,282.6941,-965.3785,42.6009,189.6897,0,0,0,0,0,0); // gangwarzone4


i dont know how to take local on isplayerinarea