SA-MP Forums Archive
why doesn't this work? - 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: why doesn't this work? (/showthread.php?tid=154411)



why doesn't this work? - ted80 - 13.06.2010

why doesn't this work?
Код:
public isPlayerInArea2()
{
	new Float:X, Float:Y, Float:Z;
	for(new i=0; i < MAX_PLAYERS; i++)
	{
		GetPlayerPos(i, X, Y, Z);
        if (X <= 2858 && X >= 2342 && Y <= -2319 && Y >= -2742)
        if (X <= -576 && X >= -763 && Y <= 1039 && Y >= 845 && Z <= 20 && Z >= 0)
		{
		}
		else
		{
             ResetPlayerWeapons(i);
		}
	}
}



Re: why doesn't this work? - DJDhan - 13.06.2010

This doesn't make any sense to me. Describe in words, what you are trying to do.


Re: why doesn't this work? - ted80 - 14.06.2010

i am trying to make two deathmatches.


Re: why doesn't this work? - DJDhan - 14.06.2010

And what do want this code to do? If you want it to check if a player is near an area then why do you have two x,y and z co-ordinates?


Re: why doesn't this work? - Cameltoe - 14.06.2010

Try this:

Код:
#include <a_samp>
#define green 0x33AA33AA
#define red 0xAA3333AA
new IsIn[MAX_PLAYERS], IsOut[MAX_PLAYERS];
forward Areacheck();
public Areacheck()
{
	for(new i=0; i < MAX_PLAYERS; i++)
	{
	if (IsPlayerInArea(i, 2858,2342,-2319,-2742) && IsIn[i] == 0)
	{
	IsIn[i] = 1;
	IsOut[i] = 1;
	SendClientMessage(i,green, "Welcome to the Dm area!");
	}
	if (!IsPlayerInArea(i, 2858,2342,-2319,-2742) && IsOut[i] == 1)
	{
	IsIn[i] = 0;
	IsOut[i] = 0;
	SendClientMessage(i,red, "You left the Dm area!");
	}
	}
	return 1;
}
// IsPlayerInArea Function.
stock IsPlayerInArea(playerid, Float:max_x, Float:min_x, Float:max_y, Float:min_y)
{
	new Float:X, Float:Y, Float:Z;
	GetPlayerPos(playerid, X, Y, Z);
	if(X <= max_x && X >= min_x && Y <= max_y && Y >= min_y) return 1;
	return 0;
}
You also need to set a timer to use this though..


Re: why doesn't this work? - ted80 - 15.06.2010

but how can i add another one deathmatch to this?


Re: why doesn't this work? - Cameltoe - 15.06.2010

Like u want 2 deathmatch zones?


Re: why doesn't this work? - ted80 - 19.07.2010

yes that is what i want.


Re: why doesn't this work? - ted80 - 20.07.2010

does anybody know how to make that?


Re: why doesn't this work? - nuriel8833 - 20.07.2010

Tell us what is that suppost to do and then well probadly fix this