Automatic Gate -
Osviux - 12.07.2010
How to make an Automatic Gate?
I tried this but it didnt work.
if(IsPlayerInRangeOfPoint(25,playerid,-1631.78, 688.24, 8.6

)
{
MoveObject(Vartaii,-1631.78, 688.24, 8.68,3);
return 1;
}
Re: Automatic Gate -
Donny_k - 12.07.2010
Quote:
Originally Posted by Osviux
How to make an Automatic Gate?
I tried this but it didnt work.
if(IsPlayerInRangeOfPoint(25,playerid,-1631.78, 688.24, 8.6  )
{
MoveObject(Vartaii,-1631.78, 688.24, 8.68,3);
return 1;
}
|
I'm sure the "playerid" argument is the first one, (playerid, range, x, y, z);
To move it back you can use "OnObjectMoved" as it's called when an object stops moving (gets to it's destination).
Re: Automatic Gate -
Osviux - 12.07.2010
if(IsPlayerInRangeOfPoint(playerid, 25, -1631.78, 688.24, 8.6

)
{
MoveObject(Vartaii, -1631.78, 688.24, 15.68,3);
return 1;
}
Still doesnt work. Maybe i need to add a timer or something?
Re: Automatic Gate -
Donny_k - 12.07.2010
Quote:
Originally Posted by Osviux
if(IsPlayerInRangeOfPoint(playerid, 25, -1631.78, 688.24, 8.6  )
{
MoveObject(Vartaii, -1631.78, 688.24, 15.68,3);
return 1;
}
Still doesnt work. Maybe i need to add a timer or something? 
|
Well if it's in a command such as "/open" then no timer is needed but if you just want it to open whenever you are close like your title hints at then yes a timer would indeed be required for it to repeatedly check the code and fire it etc.
Re: Automatic Gate -
TouR - 12.07.2010
Код:
SetTimer("GateTimer", 1000, true); //under OnGameModeInit
forward GateTimer(); //somewhere in the script
public GateTimer()
{
if(IsPlayerInRangeOfPoint(playerid, 25, -1631.78, 688.24, 8.6)
{
MoveObject(Vartaii, -1631.78, 688.24, 15.68,3);
return 1;
}
If you have the right coordinates it will work
Re: Automatic Gate -
Osviux - 12.07.2010
C:\Documents and Settings\Kompiuteris\Desktop\Kuriamas\gamemodes\GR P.pwn(16013) : error 030: compound statement not closed at the end of file (started at line 1600

Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
public GateTimer(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 25, -1631.78, 688.24, 68.6))
{
MoveObject(Vartaii, -1631.78, 688.24, 15.68,3);
return 1;
}
Re: Automatic Gate -
TouR - 12.07.2010
Код:
public GateTimer(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 25, -1631.78, 688.24, 68.6))
{
MoveObject(Vartaii, -1631.78, 688.24, 15.68,3);
}
return 1;
}
I am sorry for this
Re: Automatic Gate -
Osviux - 12.07.2010
Oh its works! Thanks!
But now i need a closing fuction.
MoveObject(Vartaii, -1631.78, 688.24, 8.68, 3);
Re: Automatic Gate -
TouR - 12.07.2010
Код:
forward GateTimer(); //somewhere in the script
public GateTimer()
{
if(IsPlayerInRangeOfPoint(playerid, 25, -1631.78, 688.24, 8.6)
{
MoveObject(Vartaii, -1631.78, 688.24, 15.68,3);
SetTimer("GateClose", 10000, 0);
return 1;
}
forward GateClose(); //somewhere in the script
public GateClose()
{
MoveObject(Vartaii, -1631.78, 688.24, 8.68, 3);
}
Try this
Re: Automatic Gate -
TouR - 12.07.2010
You gave me the same Move object.. Give me the CreateObject