SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 31/10/2013, 04:44 PM   #1
tuuler
Big Clucker
 
Join Date: Apr 2011
Posts: 132
Reputation: 3
Exclamation Need help with safezone.

PROBLEM SOLVED

Last edited by tuuler; 02/11/2013 at 03:09 PM.
tuuler is offline   Reply With Quote
Old 01/11/2013, 12:04 PM   #2
tuuler
Big Clucker
 
Join Date: Apr 2011
Posts: 132
Reputation: 3
Default Re: Need help with safezone.

Anyone please ! Help me.
tuuler is offline   Reply With Quote
Old 01/11/2013, 01:23 PM   #3
LoLeC
Little Clucker
 
Join Date: Mar 2012
Posts: 15
Reputation: 0
Default Re: Need help with safezone.

Code:
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;
}
LoLeC is offline   Reply With Quote
Old 01/11/2013, 01:32 PM   #4
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,982
Reputation: 1392
Default Re: Need help with safezone.

pawn Code:
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 Code:
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!
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with safezone GAMER_PS2 Scripting Help 2 03/12/2011 06:42 AM
Safezone help Azzeto Scripting Help 2 18/10/2011 10:48 PM
safezone Jackass123 Help Archive 4 08/12/2009 05:20 PM
Safezone?!?!?!? [WF]Demon Help Archive 0 21/11/2009 11:08 PM
Safezone help whooper Help Archive 6 06/06/2009 11:29 PM


All times are GMT. The time now is 03:27 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.