SA-MP Forums Archive
[Tutorial] Fully automatic gate[1st TUTORIAL] - 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)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Fully automatic gate[1st TUTORIAL] (/showthread.php?tid=474521)



Fully automatic gate[1st TUTORIAL] - coool - 08.11.2013

Information
I seen many scripters was scripting a command gate, but automatic gate is easily for players, In automatic gate when a player will near the gate will open automaticlly. This is my first tutorial plz not give bad comments
STEP:1
First we need to include a_samp which is commong
pawn Код:
#include a_samp
STEP:2
Now we need to create a bool called any thing for closing the gate and it's must be true.
pawn Код:
new Gatebool:GateClosed = true;
STEP:3
Now creating a object but it be named any thing, create a name by "new"
pawn Код:
new Gate;
Now create a object object will can be any thing.
pawn Код:
Gate = CreateObject(Objectid, PosX, PosY, PosZ, RotateX, RotateY, RotateZ, Speed);
STEP:4
Now creating a callback + timer for the millisecond of closing and opening the gate, create timer.
pawn Код:
SetTimer("TimerName", Millisecond, true);
Now creating callback it's name must be the timer's name
pawn Код:
forward TimerName;
public TimerName()
STEP:5
Creating Opening process of the gate
1.Make sure object not moving
pawn Код:
if(!IsObjectMoving(Gate)){
2.Make sure player is connected and in range of gate
pawn Код:
for(new i; i<GetMaxPlayers(); i++){
                if(IsPlayerConnected(i) &&  ==  && IsPlayerInRangeOfPoint(i, 1, 0x000000FF, , )){
3.Move the gate
pawn Код:
if(GateClosed){
                    GateClosed = false;//false = Gate is not closed
                    MoveObject(Gate, , PosX, PosY, PosZ, RotateX, RotateY, RotateZ);
                }
STEP:6
The closing process's 2 steps are same like opening process only the 3rd step is like that
pawn Код:
else{
                    GateClosed = true;//True = Gate is closed
                    MoveObject(Gate, PosX, PosY, PosZ, RotateX, RotateY, RotateZ);
            }
LAST STEP
last step is easy i last step you need to only close brace like:
Код:
      }
    }
THE END



Re: Fully automatic gate[1st TUTORIAL] - iAnonymous - 08.11.2013

Good , but atleast give one example !


Re: Fully automatic gate[1st TUTORIAL] - Tuntun - 08.11.2013

Show the full script/ completed script.


Re: Fully automatic gate[1st TUTORIAL] - Pottus - 08.11.2013

Terrible tutorial and terrible method.


Re: Fully automatic gate[1st TUTORIAL] - kristo - 08.11.2013

Quote:
Originally Posted by coool
Посмотреть сообщение
pawn Код:
if(IsPlayerConnected(i) &&  ==  && IsPlayerInRangeOfPoint(i, 1, 0x000000FF, , )){
Just what...


Re: Fully automatic gate[1st TUTORIAL] - Konstantinos - 08.11.2013

I've to agree that the tutorial is not that good. The explanation is poor and it can be done without the use of a timer.