13.01.2012, 17:34
To avoid the flood of timers/messages... Add in top of your script:
And change:
I also fixed a mistake in the Kill function
pawn Код:
new bool:OutOfBounds[MAX_PLAYERS];
pawn Код:
forward Bounds();
public Bounds()
{
/*
{ "Bone County", -480.50, 596.30, -242.90, 869.40, 2993.80, 900.00},
{ "Tierra Robada", -2997.40, 1659.60, -242.90, -480.50, 2993.80, 900.00},
{ "Tierra Robada", -1213.90, 596.30, -242.90, -480.50, 1659.60, 900.00},
*/
foreach(Player, playerid) //Change to "for(new playerid; playerid < MAX_PLAYERS; playerid++)" if you don't have foreach
{
if(OutOfBounds[playerid]) continue; //Skips the player if we already sent the message and set the timer
if(!IsPlayerInArea(playerid, -480.50, 596.30, 869.40, 2993.80) && !IsPlayerInArea(playerid, -2997.40, 1659.60, -480.50, 2993.80) && !IsPlayerInArea(playerid, -1213.90, 596.30, -480.50, 1659.60))
{
SendClientMessage(playerid, 0xFF0000FF /*(Red)*/, "You have 5 seconds to go back or you will DIE!"); //<----------
//Anything else you want to add
SetTimerEx("Kill", 5000, false, "d", playerid);
OutOfBounds[playerid] = true;
return 1;
}
}
return 1;
}
pawn Код:
forward Kill(playerid);
public Kill(playerid)
{
if(IsPlayerInArea(playerid, -480.50, 596.30, 869.40, 2993.80) || IsPlayerInArea(playerid, -2997.40, 1659.60, -480.50, 2993.80) || IsPlayerInArea(playerid, -1213.90, 596.30, -480.50, 1659.60))
{
OutOfBounds[playerid] = false;
return 1; // Do nothing
}
else
{
SetPlayerHealth(playerid, 0);
OutOfBounds[playerid] = false;
}
return 1;
}