SA-MP Forums Archive
Need help with safezone. - 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)
+--- Thread: Need help with safezone. (/showthread.php?tid=472930)



Need help with safezone. - tuuler - 31.10.2013

PROBLEM SOLVED


Re: Need help with safezone. - tuuler - 01.11.2013

Anyone please ! Help me.


Re: Need help with safezone. - LoLeC - 01.11.2013

Код:
public OnGameModeInit()
{
SetTimer("safezone",1000,true);
return 1;
}

forward safezone();
public safezone()
{
	for(new i;i<MAX_PLAYERS;i++)
	{
	    if(IsPlayerConnected(i) && !IsPlayerNPC(i))
	    {
		    if(IsPlayerInRangeOfPoint(i,range,x,y,z)) // put here your coordinates
		    {
	        	Kick(i);
		    }
	    }
	}
	return 1;
}



Re: Need help with safezone. - Konstantinos - 01.11.2013

pawn Код:
stock IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, 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;
}
In OnPlayerDeath:
pawn Код:
if( killerid != INVALID_PLAYER_ID && IsPlayerInArea( killerid, -2144.53125, 750, -1511.71875, 1062.5 ) )
{
    // do your code, he killed inside the safezone
    // Kick( killerid );
}
The use of timer is totally unnecessary!