SA-MP Forums Archive
How to Creat Gates?(HELP) - 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: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to Creat Gates?(HELP) (/showthread.php?tid=278332)



How to Creat Gates?(HELP) - ServerScripter - 21.08.2011

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 .


Re: How to Creat Gates?(HELP) - Rssc - 21.08.2011

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


Re: How to Creat Gates?(HELP) - Darnell - 21.08.2011

My signature ?
Only use STRCMP .


Re: How to Creat Gates?(HELP) - ricardo178 - 21.08.2011

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.


Re: How to Creat Gates?(HELP) - ServerScripter - 21.08.2011

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 ?


Re: How to Creat Gates?(HELP) - Rssc - 21.08.2011

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;
}



Re: How to Creat Gates?(HELP) - Join7 - 21.08.2011

float:range is the distance to work


Re: How to Creat Gates?(HELP) - ServerScripter - 21.08.2011

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



Re: How to Creat Gates?(HELP) - Rssc - 21.08.2011

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))



Re: How to Creat Gates?(HELP) - ServerScripter - 21.08.2011

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


Re: How to Creat Gates?(HELP) - Rssc - 21.08.2011

Try closed. Put the coords of the gate closed.


Re: How to Creat Gates?(HELP) - ServerScripter - 21.08.2011

yea it is working, thank you again .


Re: How to Creat Gates?(HELP) - Rssc - 21.08.2011

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);


Re: How to Creat Gates?(HELP) - ServerScripter - 21.08.2011

ok thanx


Re: How to Creat Gates?(HELP) - ServerScripter - 21.08.2011

i want stop the sound in 4 Sec how i do?


Re: How to Creat Gates?(HELP) - Rssc - 21.08.2011

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?


Re: How to Creat Gates?(HELP) - ServerScripter - 21.08.2011

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


Re: How to Creat Gates?(HELP) - Rssc - 22.08.2011

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.