SA-MP Forums Archive
Help! Help! System gate - 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: Help! Help! System gate (/showthread.php?tid=315989)



Help! Help! System gate - Esmaelo - 05.02.2012

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


Re: Help! Help! System gate - ReneG - 05.02.2012

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


Re : Help! Help! System gate - Esmaelo - 05.02.2012

Yes for example for the grid SFPD or a building mapped


Re: Help! Help! System gate - ReneG - 05.02.2012

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."


Re : Help! Help! System gate - Esmaelo - 05.02.2012

thank you


Re: Help! Help! System gate - [ABK]Antonio - 05.02.2012

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


AW: Help! Help! System gate - Tigerkiller - 05.02.2012

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


Re : Help! Help! System gate - Esmaelo - 06.02.2012

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