08.11.2013, 16:25
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
STEP:2
Now we need to create a bool called any thing for closing the gate and it's must be true.
STEP:3
Now creating a object but it be named any thing, create a name by "new"
Now create a object object will can be any thing.
STEP:4
Now creating a callback + timer for the millisecond of closing and opening the gate, create timer.
Now creating callback it's name must be the timer's name
STEP:5
Creating Opening process of the gate
1.Make sure object not moving
2.Make sure player is connected and in range of gate
3.Move the gate
STEP:6
The closing process's 2 steps are same like opening process only the 3rd step is like that
LAST STEP
last step is easy i last step you need to only close brace like:
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
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;
Now creating a object but it be named any thing, create a name by "new"
pawn Код:
new Gate;
pawn Код:
Gate = CreateObject(Objectid, PosX, PosY, PosZ, RotateX, RotateY, RotateZ, Speed);
Now creating a callback + timer for the millisecond of closing and opening the gate, create timer.
pawn Код:
SetTimer("TimerName", Millisecond, true);
pawn Код:
forward TimerName;
public TimerName()
Creating Opening process of the gate
1.Make sure object not moving
pawn Код:
if(!IsObjectMoving(Gate)){
pawn Код:
for(new i; i<GetMaxPlayers(); i++){
if(IsPlayerConnected(i) && == && IsPlayerInRangeOfPoint(i, 1, 0x000000FF, , )){
pawn Код:
if(GateClosed){
GateClosed = false;//false = Gate is not closed
MoveObject(Gate, , PosX, PosY, PosZ, RotateX, RotateY, RotateZ);
}
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 is easy i last step you need to only close brace like:
Код:
} }
THE END