Gates - 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: Gates (
/showthread.php?tid=290189)
Gates -
viosteaua98 - 14.10.2011
So i want to do this
i have this coordonates for gates
Gate closed
pawn Код:
CreateObject(976,908.09997559,727.90002441,9.80000019,0.00000000,0.00000000,109.99511719); //object(phils_compnd_gate) (1)
CreateObject(976,913.20001221,713.00000000,9.69999981,0.00000000,0.00000000,109.48974609); //object(phils_compnd_gate) (2)
And gate open
pawn Код:
CreateObject(976,905.50000000,734.59997559,9.80000019,0.00000000,0.00000000,110.00000000); //object(phils_compnd_gate) (1)
CreateObject(976,911.09997559,719.20001221,9.69999981,0.00000000,0.00000000,109.49523926); //object(phils_compnd_gate) (2)
And i want theese gates move automatly when i am near i mean open how should i do ?
I need help please
Re: Gates -
hittt - 14.10.2011
https://sampwiki.blast.hk/wiki/GetPlayerDistanceFromPoint
Re: Gates -
Tom1412 - 14.10.2011
Easyer is to do a pickup,
Basicly instead of a command once you enter the pickup, It works like auto
Re: Gates -
viosteaua98 - 14.10.2011
look at topic name i need help how to do that !!!
Re: Gates -
DRIFT_HUNTER - 14.10.2011
pawn Код:
#include <a_samp>
new Gate1, Gate2;//These are variables where we store our Gate's Object ID
new Gate1Moving,Gate2Moving;//We dont rely need to check these but kust to make sure there is no bugs...
public OnFilterScriptInit()
{
Gate1 = CreateObject(976,908.09997559,727.90002441,9.80000019,0.00000000,0.00000000,109.99511719);//Gate 1 (Closed)
Gate2 = CreateObject(976,913.20001221,713.00000000,9.69999981,0.00000000,0.00000000,109.48974609);//Gate 2 (Closed)
return 1;
}
public OnPlayerUpdate(playerid)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
//Gate 1
if(IsPlayerInRangeOfPoint(playerid, 10, 908.09997559, 727.90002441, 9.80000019))//Range is 10
{
if(Gate1Moving != 1)
{
Gate1Moving = 1;
MoveObject(Gate1, 905.50000000, 734.59997559, 9.80000019, 5);//Speed is 5
}
}
else if(IsPlayerInRangeOfPoint(playerid, 10, 913.20001221, 713.00000000, 9.69999981))//Range is 10
{
if(Gate2Moving != 1)
{
Gate2Moving = 1;
MoveObject(Gate2, 911.09997559,719.20001221,9.69999981, 5);//Speed is 5
}
}
return 1;
}
public OnObjectMoved(objectid)
{
if(objectid == Gate1) Gate1Moving = 0;
if(objectid == Gate2) Gate2Moving = 0;
return 1;
}
Next time search there is about 2-3 tutorials about gates out there and there is on the wiki one tutorial about automatic gates....