First you need to create a stock to check if
isPlayerInArea. This Stock will be equal to the top of the building. Like that:
pawn Код:
stock IsPlayerInCity(playerid)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid, x, y, z);
if(x >= 44.60 && y >= -2892.90 && x <= 2997.00 && y <= -768.00) return 1;
else return 0;
}
After this, you can create a variable to the players that get in the CarDerby Like:
pawn Код:
new InCarDerby[MAX_PLAYERS];
If the player went to the CarDerby, the variable will be:
pawn Код:
InCarDerby[playerid] = 1;
Else
pawn Код:
InCarDerby[playerid] = 0;
So, you make a settime + public, like:
pawn Код:
//In the OnGameModeInit:
SetTimer("SearchCarDerby",1000,1);
//In the End of the GameMode
forward SearchCarDerby();
public SearchCarDerby()
{
for(new i=0; i<MAX_PLAYERS; i++)//For every players
{
if(IsPlayerConnected(i) && IsPlayerInCity(i))//It will check if the player is in the City and connected ?
{
if(InCarDerby[playerid] == 1)//If the player is In Derby
{
SetPlayerHealth(i, 100);//He will Die
} }
}
}
I hope t have helped