08.11.2010, 17:16
pawn Код:
#include <a_samp>
new pKill[MAX_PLAYERS];
new pCount[MAX_PLAYERS];
public OnFilterScriptInit()
{
SetTimer("Area_Check", 5000, true);
}
forward Area_Check();
public Area_Check()
{
for(new i; i < MAX_PLAYERS +1; i++)
{
if(IsPlayerInArea(i, 997, 917, 2046, 2182))
{
if(!IsPlayerAdmin(i))
{
pKill[i] = SetTimerEx("KillTime", 15000, false, "i", i);
}
}
else if(!IsPlayerInArea(i, 997, 917, 2046, 2182))
{
KillTimer(pKill[i]);
pCount[i] = 15;
}
}
return 1;
}
forward KillTime(playerid);
public KillTime(playerid)
{
pCount[playerid]--;
if(pCount[playerid] > 15)
{
SetPlayerHealth(playerid, 0.0);
pCount[playerid] = 15;
}
}
stock 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;
return 0;
}