[Tutorial] Fully automatic gate[1st TUTORIAL]
#1

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

Good , but atleast give one example !
Reply
#3

Show the full script/ completed script.
Reply
#4

Terrible tutorial and terrible method.
Reply
#5

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)