How to Creat Gates?(HELP)
#1

Hi , i want to creat a gates with commands , so if someon can help me (give me the code or a tutorial)
Because i have a serious problems with the gates, i'm waithing for you .
Reply
#2

There are all kind of gate commands you can make. Specify one of them. =)
Command to close and other to open the gate?
Command to open and then close after x seconds?
Do one of the above using a key of your keyboard?
so on..
Reply
#3

My signature ?
Only use STRCMP .
Reply
#4

1є- You need to map them.
2є- Save the map.
3є- Convert the objects on converterffs.com or any other else.
4є- Open pawno with new.
5є- Delete all what is under the callback OnFilterScriptInit.
6є- Put #include <zcmd> in the top if your script, under #include <a_samp>.
7є- Search, downlaod and paste the include zcmd.inc in your pawno includes folder.
8є- Add the converted objects to pawno, in the OnFilterScriptInit callback.
9є- Take the positions of the gate opened, write them.
10є- Put this before the gate object. gatename = Object code.
Example:
pawn Code:
gatename = CreateObject(ObjectId, posX, posY, PosZ, ObjectRotX, ObjectRotY, ObjectRotZ);
11є- Put new gatename; on the top of script, under #include <zcmd>.
12є- Than, put this anywhere in your script.

pawn Code:
CMD:opengate(playerid, params[])
{
    MoveObject(gatename, PosX, PosY, PosZ, 2.0);
    SendClientMessage(playerid, 0xFFFFFF, "Gate Opened");
    return 1;
}
Replace PosX, PosY and PosZ with the positions of opened gates.
13є- Click F5 to compile the script.
Post here if you didn't understand something.
Reply
#5

thanx a lot ricardo !! it is 100% working without errors por warning
i devlopped the command:
pawn Code:
CMD:zombieo(playerid, params[])
{
if(gTeam[playerid] == TEAM_ZOMBIE)
{
    MoveObject(zombiegate, -2315.3188476563, -2169.1782226563, 35, 5);
    SendClientMessage(playerid, 0xFFFFFF, "You take remote console and open the gate...");
}
else
{
    SendClientMessage(playerid, 0xAA3333AA, "You don't Have remote console of this gate.");
}
    return 1;
}
Edite : How to check if the player is near the gate ?
Reply
#6

Yes. Use IsPlayerInRangeOfPoint.
pawn Code:
CMD:zombieo(playerid, params[])
{
if(gTeam[playerid] == TEAM_ZOMBIE)
{    
     if(IsPlayerInRangeOfPoint(playerid, 15, -2315.3188476563, -2169.1782226563, 35))
     {
     MoveObject(zombiegate, -2315.3188476563, -2169.1782226563, 35, 5);  
     SendClientMessage(playerid, 0xFFFFFF, "You take remote console and open the gate...");
     }
     else
     {
      SendClientMessage(playerid, 0XFFFFFF, "You need to be near the gate to open it");
      }
}
else
{      
     SendClientMessage(playerid, 0xAA3333AA, "You don't Have remote console of this gate.");
}    
     return 1;
}
Reply
#7

float:range is the distance to work
Reply
#8

Quote:
Originally Posted by Join7
View Post
float:range is the distance to work
Reply
#9

Float, Float:y, Float:z - are the coords. Use the x, y, z coords of your gate.

And for the Float:Range is the distance the player needs to be to open the gate. Try 5, 10 or 15..

EDIT:
For example:
pawn Code:
if(IsPlayerInRangeOfPoint(playerid, 15, -2315.3188476563, -2169.1782226563, 35))
Reply
#10

thank you Rssc ! but the problem is how to get x,Y,Z i mean , position of gate whene it is open or closed?
Reply
#11

Try closed. Put the coords of the gate closed.
Reply
#12

yea it is working, thank you again .
Reply
#13

No problem, anything just ask.
You can also make it play some sound while itґs opening/closing ^^

PlayerPlaySound(playerid, SoundID, X, Y, Z);

Use soundid 1153 which is indicated to this situation. (Sound of a gate moving)

So it will be : PlayerPlaySound(playerid, 1153, X, Y, Z);
Reply
#14

ok thanx
Reply
#15

i want stop the sound in 4 Sec how i do?
Reply
#16

I think the only way to control the sound duration is by controling the object(gate) movement speed.
The sound plays while the gate is moving. Can you show me your Gate Opened and Gate closed coords?
Reply
#17

it is open : -2315.3188476563, -2169.1782226563, 35, 5);
it is close : -2315.3188476563, -2169.1782226563, 41.085674285889, 5);
Reply
#18

Where did you got the coords of the opened one? Using MTA or just by subtracting?
The sound keeps playing when the gate is moving. If the gate is not there(so its opened) and it still is playing the sound, that means the gate is still moving try insted of 35 (Z) 36,37,38 and so on. Using MTA, is far easier and faster. In order to open the gate you dont need to move it very far.. Just a bit.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)