Можно использовать такого типа функцию:
Code
#define MAX_TEAMS 8 //replace 8 with the max number of teams
new GangAreas[MAX_TEAMS];
public OnGameModeInit()
{
GameModeInit(); //needed for the callbacks
GangAreas[0]=AddRectangleArea(X_Start, Y_Start, X_End, Y_End);
GangAreas[1]=AddRectangleArea(X_Start, Y_Start, X_End, Y_End);
// ... and so on. The last Gangzone is
GangAreas[(MAX_TEAMS-1)]=AddRectangleArea(X_Start, Y_Start, X_End, Y_End);
return 1;
}
public OnPlayerConnect(playerid)
{
Players[playerid][Cur_Team]=0; //this sets the player to team 0
return 1;
}
public OnPlayerEnterArea(playerid, areaid)
{
new cur_team=Players[playerid][Cur_Team];
if(GangAreas[cur_team]==areaid) //if the player is in the area of his/her team
{
SendClientMessage(playerid, 0xFFFFFFFF, "Welcome home");
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "oh, dude, that's the wrong place");
}
return 1;
}
public OnPlayerLeaveArea(playerid, areaid)
{
new cur_team=Players[playerid][Cur_Team];
if(GangAreas[cur_team]==areaid) //if the player left his/her team-area
{
SendClientMessage(playerid, 0xFFFFFFFF, "you left your base");
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "you got out of the enemy-area");
}
return 1;
}
Автор: Larcius.