Small problem - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Small problem (
/showthread.php?tid=187917)
Small problem -
zack3021 - 05.11.2010
I created this automatic gate, but it only closes, it dont open, when the GM is loaded, it sets the gate to the open position and when i go near the gate, it closes, but when i walk back, it dont open.
pawn Код:
public Gate()
{
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i,5.0,-505.5048828125, 2593.0556640625, 55.983978271484))State = 1;
}
if(State)MoveObject(hgate, -505.5048828125, 2593.0556640625, 55.983978271484,3.0);
else MoveObject(hgate, -505.65878295898, 2601.5754394531, 55.89282989502,5.0);
}
Re: Small problem -
zack3021 - 05.11.2010
Please help.
Re: Small problem -
MadeMan - 05.11.2010
pawn Код:
public Gate()
{
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i,5.0,-505.5048828125, 2593.0556640625, 55.983978271484))State = 1;
else State = 0;
}
if(State)MoveObject(hgate, -505.5048828125, 2593.0556640625, 55.983978271484,3.0);
else MoveObject(hgate, -505.65878295898, 2601.5754394531, 55.89282989502,5.0);
}
Re: Small problem -
zack3021 - 05.11.2010
Thanks it worked.
Re: Small problem -
zack3021 - 05.11.2010
It worked but it only work with a player who is not id 0 who to fix that?
Re: Small problem -
Mean - 05.11.2010
MovePlayerObject(playerid...);
https://sampwiki.blast.hk/wiki/MovePlayerObject
For all ID's
pawn Код:
public Gate()
{
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i,5.0,-505.5048828125, 2593.0556640625, 55.983978271484))State = 1;
else State = 0;
}
if(State)MovePlayerObject(playerid, hgate, -505.5048828125, 2593.0556640625, 55.983978271484,3.0);
else MovePlayerObject(playerid, hgate, -505.65878295898, 2601.5754394531, 55.89282989502,5.0);
}
let me know if it worked
Re: Small problem -
MadeMan - 05.11.2010
pawn Код:
public Gate()
{
State = 0;
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i,5.0,-505.5048828125, 2593.0556640625, 55.983978271484))State = 1;
}
if(State)MoveObject(hgate, -505.5048828125, 2593.0556640625, 55.983978271484,3.0);
else MoveObject(hgate, -505.65878295898, 2601.5754394531, 55.89282989502,5.0);
}
Re: Small problem -
zack3021 - 05.11.2010
@ Mean, yours did not work.
@ MadeMan, Thanks it worked.
In SAMP, is 5.0 distance like 1 meter? because when i use 5.0 as the distance, i was close to the gate for it to open.
Re: Small problem -
MadeMan - 05.11.2010
You can increase the 5.0 to 10.0 or 15.0 in IsPlayerInRangeOfPoint.
Re: Small problem -
zack3021 - 05.11.2010
Thanks.
![Smiley](images/smilies/smile.png)
<3