Gang Zones
#1

Hi guys, I know how to create "Gang Zone" but i want to do something when they "Enter" the gang zone, and when they "Leave" the Gang Zone.

Something like OnPlayerEnterGangZone
// // OnPlayerLeaveGangZone

help me guys & thank you.
Reply
#2

This might be useful:

https://sampwiki.blast.hk/wiki/Areacheck
Reply
#3

And when player is not in area?
Reply
#4

When the player is not in the area it won't do anything.
Reply
#5

Just make something similar as IsPlayerInArea. Otherwise you could put a else statement in IsPlayerInArea.
Reply
#6

I mean if the player enter the area, he will have god mode, and when he exit the area he won't have god mode?
Reply
#7

Ah, just add something like
else disable godmode
Reply
#8

Код:
public 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 true;
/* This line is the important one!. Here, is where you change those numbers, by the ones
you get from the /pos command. As you can see, those coordinates, are only the X and Y ones, the Z
doesnt matter*/
{
    new weapons[MAX_PLAYERS][13][2];
	//When the player enters a zone
	for (new i = 0; i < 13; i++) GetPlayerWeaponData(playerid, i, weapons[playerid][i][0], weapons[playerid][i][1]);
	ResetPlayerWeapons(playerid);
	}else{
 	for (new i = 0; i < 13; i++) if(weapons[playerid][i][0] != 0) GivePlayerWeapon(playerid, weapons[playerid][i][0], weapons[playerid][i][1]);
	}
	 return 0;
}
I get 1 error:

Код:
error 029: invalid expression, assumed zero
On this line:

Код:
	}else{
Reply
#9

Код:
public 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) 
/* This line is the important one!. Here, is where you change those numbers, by the ones
you get from the /pos command. As you can see, those coordinates, are only the X and Y ones, the Z
doesnt matter*/
{
    new weapons[MAX_PLAYERS][13][2];
	//When the player enters a zone
	for (new i = 0; i < 13; i++) GetPlayerWeaponData(playerid, i, weapons[playerid][i][0], weapons[playerid][i][1]);
	ResetPlayerWeapons(playerid);
	}
else{
 	for (new i = 0; i < 13; i++) if(weapons[playerid][i][0] != 0) GivePlayerWeapon(playerid, weapons[playerid][i][0], weapons[playerid][i][1]);
	}
	 return 0;
}
Tell me if this works.
Reply
#10

No errors, but when i enter the Area, i dont lost my weapons and get it back... (NO KILL ZONE)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)