Automatic gate - 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)
+--- Thread: Automatic gate (
/showthread.php?tid=597382)
Automatic gate -
GeneralAref - 30.12.2015
i have this but gate 2 not works.how to fix it?
PHP код:
forward areagatecheck();
public areagatecheck()
{
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 15, 134.7061, 1941.5814, 21.6600))
{
if(gTeam[i] != TEAM_Internationalforces) return;
if(areagate1o == false)
{
MoveObject(areagate1, 121.6021, 1941.5845, 21.6600, 5);
areagate1o = true;
}
return;
}
else if(IsPlayerInRangeOfPoint(i, 15, 205.4922, 1730.3516, 17.8281))
{
if(gTeam[i] != TEAM_Internationalforces) return;
if(areagate2o == false)
{
MoveObject(areagate2, 286.0697, 1833.7720, 19.9611, 5);
areagate2o = true;
}
return;
}
return;
}
if(areagate1o == true)
{
MoveObject(areagate1, 134.7061, 1941.5814, 21.6600, 5);
areagate1o = false;
return;
}
if(areagate2o == true)
{
MoveObject(areagate2, 205.4922, 1730.3516, 17.8281, 5);
areagate2o = false;
return;
}
return;
}
Re: Automatic gate -
IceBilizard - 30.12.2015
try this
PHP код:
forward areagatecheck();
public areagatecheck()
{
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 15, 134.7061, 1941.5814, 21.6600))
{
if(gTeam[i] == TEAM_Internationalforces)
{
if(areagate1o == false)
{
MoveObject(areagate1, 121.6021, 1941.5845, 21.6600, 5);
areagate1o = true;
}
}
}
if(IsPlayerInRangeOfPoint(i, 15, 205.4922, 1730.3516, 17.8281))
{
if(gTeam[i] == TEAM_Internationalforces)
{
if(areagate2o == false)
{
MoveObject(areagate2, 286.0697, 1833.7720, 19.9611, 5);
areagate2o = true;
}
}
}
if(!IsPlayerInRangeOfPoint(i, 15, 134.7061, 1941.5814, 21.6600))
{
if(areagate1o == true)
{
MoveObject(areagate1, 134.7061, 1941.5814, 21.6600, 5);
areagate1o = false;
}
}
if(!IsPlayerInRangeOfPoint(i, 15, 205.4922, 1730.3516, 17.8281))
{
if(areagate2o == false)
{
MoveObject(areagate2, 286.0697, 1833.7720, 19.9611, 5);
areagate2o = true;
}
}
}
Re: Automatic gate -
GeneralAref - 30.12.2015
not works and you forget return;
The second is my problem.
Re: Automatic gate -
IceBilizard - 30.12.2015
are you sure you have correct moving points of gates?
use it via any command see if it works then i will make some changes in that code.
Re: Automatic gate -
GeneralAref - 30.12.2015
open:
286.0697, 1833.7720, 19.9611
close:
286.05475, 1819.83301, 19.96110