I have a problem with my automatic gate system.
I'm supposed to open the gate to a particular player, but is open exclusively to me ..
pawn Code:
new barrackgate;
new portarogate1;
//new portarogate2;
public OnGameModeInit()
{
SetTimer("BaracchiGate",1000,true); //setto il timer per il cancello di barrack
SetTimer("PortaroGate",1000,true); //setto il timer per il cancello di portaro
barrackgate = CreateObject(976, -225.27685546875, 2614.13671875, 61.708999633789, 0, 0, 0, 500);
//CreateObject(976, -225.27685546875, 2614.13671875, 57.709098815918, 0, 0, 0, 500);
portarogate1 = CreateObject(976, 997.58355712891, 1687.7630615234, 5.921875, 0, 0, 270);
//CreateObject(976, 997.58355712891, 1687.7630615234, 10.199999809265, 0, 0, 270);
}
forward BaracchiGate(playerid);
public BaracchiGate(playerid)
{
new barrackgate_status;
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
for(new Mauro_Baracchi; Mauro_Baracchi<MAX_PLAYER_NAME; Mauro_Baracchi++)
{
if(!IsPlayerConnected(Mauro_Baracchi)) continue;
if(IsPlayerInRangeOfPoint(playerid, 10.0, -225.27685546875, 2614.13671875, 61.708999633789))barrackgate_status=1;
}
if(barrackgate_status)MoveObject(barrackgate,-225.27685546875, 2614.13671875, 57.709098815918, 2);
else MoveObject(barrackgate, -225.27685546875, 2614.13671875, 61.708999633789, 2);
}
forward PortaroGate(playerid);
public PortaroGate(playerid)
{
new portarogate_status;
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
for(new Andrea_Portaro; Andrea_Portaro<MAX_PLAYER_NAME; Andrea_Portaro++)
{
if(!IsPlayerConnected(Andrea_Portaro)) continue;
if(IsPlayerInRangeOfPoint(playerid, 10.0, 997.58355712891, 1687.7630615234, 10.199999809265))portarogate_status=1;
}
if(portarogate_status)MoveObject(portarogate1, 997.58355712891, 1687.7630615234, 5.921875, 2);
else MoveObject(portarogate1, 997.58355712891, 1687.7630615234, 10.199999809265, 2);
}
P.S. Sorry for my bad english