forward CheckVehicleArea();
public CheckVehicleArea()
{
for(new i=0; i<MAX_PLAYERS; i++ )
{
if(IsPlayerConnected(i) && IsPlayerInArea(i,2440.7849,2414.9807,-1409.5649,-1433.7346) && ShitInfo[i][pVehReg] == 0) // CHECK:if the player is in the area
{
new Float:x,Float:y,Float:z;
GetPlayerPos(i,x,y,z);
if(z <= 29.7)
{
SendClientMessage(i,COLOR_GREEN,"( ! ) Welcome to the Vehicle Registeration Area !");
ShitInfo[i][pVehReg] = 1;
}
else if(ShitInfo[i][pVehReg] == 1)
{
SendClientMessage(i,COLOR_GREEN,"( ! ) You leave the Vehicle Registeration Area !");
ShitInfo[i][pVehReg] = 0;
}
}
else if(IsPlayerConnected(i) && !IsPlayerInArea(i,2440.7849,2414.9807,-1409.5649,-1433.7346) && ShitInfo[i][pVehReg] == 1)
{
SendClientMessage(i,COLOR_YELLOW,"( ! ) You leave the Vehicle Registeration Area !");
ShitInfo[i][pVehReg] = 0;
return 1;
}
}
return 1;
}
forward CheckBank();
public CheckBank()
{
for(new i=0; i<MAX_PLAYERS; i++ )
{
if(IsPlayerConnected(i) && IsPlayerInArea(i,1744.2325,1700.6185,-1637.5604,-1678.7394 ) && ShitInfo[i][pBank] == 0 && GetPlayerInterior(i) != 0) // CHECK:if the player is in the area
{
new Float:x,Float:y,Float:z;
GetPlayerPos(i,x,y,z);
if(z <= 34.4585)
{
scm(i,COLOR_RED,"( ! ) Fighting & Killing is Forbidden Here !");
SendClientMessage(i,COLOR_GREEN,"( ! ) Welcome to the Bank !");
ShitInfo[i][pBank] = 1;
}
else if(ShitInfo[i][pBank] == 1)
{
SendClientMessage(i,COLOR_GREEN,"( ! ) You leave the Bank !");
ShitInfo[i][pBank] = 0;
}
}
else if(IsPlayerConnected(i) && !IsPlayerInArea(i,1744.2325,1700.6185,-1637.5604,-1678.7394 ) && ShitInfo[i][pBank] == 1)
{
SendClientMessage(i,COLOR_YELLOW,"( ! ) You leave the Bank !");
ShitInfo[i][pBank] = 0;
return 1;
}
}
return 1;
}
#define MAX_PLAYERS_EX 50 //change to server slot limit forward PlaceChecker(); public OnGameModeInit() { SetTimer("PlaceChecker",1000,true);//Start timer } public PlaceChecker() { for(new p;p<MAX_PLAYERS_EX;p++) { if(!IsPlayerConnected(p) || IsPlayerNPC(p))continue; // jump to next ID when OFFLINE or NPC new interior = GetPlayerInterior(p); switch(interior) { case 0:// the world { if(IsPlayerInArea(p,2440.7849,2414.9807,-1409.5649,-1433.7346))// Enter the place { // ... }else if(ShitInfo[i][pVehReg])// Leave the place { ShitInfo[i][pVehReg] = 0; } if(IsPlayerInArea(p,x,y,z))// Next place enter.. { // ... }else if(ShitInfo[i][pBank])// NextPlaceLeave { ShitInfo[i][pBank] = 0; } } } } }
At first you should stop use MAX_PLAYERS for loops.
Код:
#define MAX_PLAYERS_EX 50 //change to server slot limit forward PlaceChecker(); public OnGameModeInit() { SetTimer("PlaceChecker",1000,true);//Start timer } public PlaceChecker() { for(new p;p<MAX_PLAYERS_EX;p++) { if(!IsPlayerConnected(p) || IsPlayerNPC(p))continue; // jump to next ID when OFFLINE or NPC new interior = GetPlayerInterior(p); switch(interior) { case 0:// the world { if(IsPlayerInArea(p,2440.7849,2414.9807,-1409.5649,-1433.7346))// Enter the place { // ... }else if(ShitInfo[i][pVehReg])// Leave the place { ShitInfo[i][pVehReg] = 0; } if(IsPlayerInArea(p,x,y,z))// Next place enter.. { // ... }else if(ShitInfo[i][pBank])// NextPlaceLeave { ShitInfo[i][pBank] = 0; } } } } } |