Automatic Gate
#1

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;
}
Reply
#2

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).
Reply
#3

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?
Reply
#4

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.
Reply
#5

Код:
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
Reply
#6

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;
}
Reply
#7

Код:
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
Reply
#8

Oh its works! Thanks!
But now i need a closing fuction.

MoveObject(Vartaii, -1631.78, 688.24, 8.68, 3);
Reply
#9

Код:
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
Reply
#10

You gave me the same Move object.. Give me the CreateObject
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)