Help! Help! System gate
#1

Hello, I need help to do a script that once you s'pproche a grid it opens with ProxDetector. Thank you contact me.
Reply
#2

Do you mean like a player approaches a gate, and it automatically opens for them?
Reply
#3

Yes for example for the grid SFPD or a building mapped
Reply
#4

Under the OnPlayerUpdate callback you do this.
pawn Код:
public OnPlayerUpdate(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid,range,x,y,z))
    {
        MoveObject(objectid,x,y,z,speed)
    }
    return 1;
}
================================================== =============
================================================== =============
pawn Код:
if(IsPlayerInRangeOfPoint(playerid,range,x,y,z))
This checks if the player is in range of a point. You would put the object coordinates here.
pawn Код:
MoveObject(objectid,x,y,z,speed)
This moves the object only if the player is in range of it.
So it should look like this.
pawn Код:
public OnPlayerUpdate(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid,range,x,y,z))
    {
        MoveObject(objectid,x,y,z,speed)
    }
    return 1;
}
Basically, this is what it is saying.
"If a player is in range of this point, then move this object."
Reply
#5

thank you
Reply
#6

You should add in a timer that when it ends the gate auto-closes...Also should add a boolean (or regular var if you want) that will not make it open twice etc
Reply
#7

OnPlayerUpdate isnt a good idea because it is called 36 times per seconds
Reply
#8

then if the OnPlayerUpdate is not a good idea you are one for me?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)