SA-MP Forums Archive
When player leave LS - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: When player leave LS (/showthread.php?tid=93294)



When player leave LS - radeee - 24.08.2009

Hey all,

can someone code me script so when player leav borders of LS then he got wanted level


Sry for my bad English


Re: When player leave LS - MenaceX^ - 24.08.2009

No.. Go to Script Request Thread.


Re: When player leave LS - James_Alex - 24.08.2009

first use this include
http://forum.sa-mp.com/index.php?topic=44902.0
then detecte if the player in the zone
set a timer in "OnGameModeInit" wuch have the interval 100 and it repeats itself
then check the zone by using "IsPlayerInZone"
this is an example
pawn Код:
//put this in "OnGameModeInit()"
SetTimer("CheckZone", 100, true);

forward CheckZone();
public CheckZone()
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
if(!IsPlayerInZone(i, "Los Santos"))
{
SetPlayerWantedLevel(i, 1), // change the 1 with the desired wanted level
}
}
}
}



Re: When player leave LS - radeee - 24.08.2009

OK, I added forward CheckZone(); at the top of script under all defines, then I added
Код:
public CheckZone()
{
	for(new i = 0; i < MAX_PLAYERS; i ++)
	{
		if(IsPlayerConnected(i))
		{
			if(!IsPlayerInZone(i, "Los Santos"))
			{
				new string[256];
				WantedPoints[i]+=2;
				format(string, sizeof(string), "You left Los Santos! The Police is looking for you!!!");
				SendClientMessage(i, COLOR_RED, string);
			}
		}
	}
}
above OnGameModeInit() and I added SetTimer("CheckZone", 100, true); in OnGameModeInit() and I got when I enter server immediately it start to write You left Los Santos! The Police is looking for you!!! every second :S


Re: When player leave LS - James_Alex - 24.08.2009

so try to change "if(!InPlayer..." by "if(IsPlayer..."


Re: When player leave LS - Correlli - 24.08.2009

This will just give player wanted level 1 and spam him with message "You left Los Santos! The Police is looking for you!!!" every 100 miliseconds.


Re: When player leave LS - radeee - 24.08.2009

Quote:
Originally Posted by Don Correlli
This will just give player wanted level 1 and spam him with message "You left Los Santos! The Police is looking for you!!!" every 100 miliseconds.
True...

Nothing changed


Re: When player leave LS - radeee - 24.08.2009

Код:
new broj[MAX_PLAYERS];
public CheckZone()
{
	for(new i = 0; i < MAX_PLAYERS; i ++)
	{
		if(IsPlayerConnected(i))
		{
			if(IsPlayerInArea(i, 2721.616210, -513.000244, 2326.376708, -364.872253) || IsPlayerInArea(i, 2971.905273, -115.112945, -671.811584, -2803.755126))
			{
			}else {
			  if(broj[i] > 0)
			  {
			  	new string[256];
			  	format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~You Left ~w~Los Santos~b~ ! Police is looking for you !!!");
			  	GameTextForPlayer(i,string,600,3);
				}else {
				  if(IsACop(i))
				  {
				    new string[256];
				    format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~You Left ~w~Los Santos~b~ !");
			  		GameTextForPlayer(i,string,600,3);
					}else {
   					WantedPoints[i]+=3; SetPlayerCriminal(i,255, "Left Los Santos");
						broj[i]++;
						new string[256];
						format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~You Left ~w~Los Santos~b~ ! Police is looking for you !!!");
			  		GameTextForPlayer(i,string,600,3);
  				}
				}
			}
		}
	}
}
And I think this works...