[HELP]Open and Close gate - Commands[zcmd] - 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)
+--- Thread: [HELP]Open and Close gate - Commands[zcmd] (
/showthread.php?tid=433519)
[HELP]Open and Close gate - Commands[zcmd] -
NathNathii - 27.04.2013
How can I create a command to open and close a gate?
Re: [HELP]Open and Close gate - Commands[zcmd] -
fanta291327 - 27.04.2013
Depends do you want anyone to open it or just a faction or?
Re: [HELP]Open and Close gate - Commands[zcmd] -
NathNathii - 27.04.2013
Gonna add a place for trucker's to unload their load and I want only them to access there by gate commands.
Like: /opengate and /closegate
Re: [HELP]Open and Close gate - Commands[zcmd] -
Goldilox - 27.04.2013
This is general kind of syntax of how to create a gate. I have added the comments so you know what is going on. Change the X, Y, Z and Speed of your choice.
pawn Код:
// You should have some variable which creates the gate. I have given a sample as Gate1
new Gate1 = CreateObject(objectid, X, Y, Z); // Variable Gate1 has given value of creating a gate.
if (strcmp("/opengate", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 15.0, X, Y, Z)) // the range till where player can use this command.
{
MoveObject(Gate1, X, Y, Z, Speed); // Move the object to where it looks it's opened.
SendClientMessage(playerid, 0xFAFAFAAA, "Gate opened");
return 1;
}
}
if (strcmp("/closegate", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, X, Y, Z))
{
MoveObject(Gate1,X, Y, Z, Speed); //You will need to paste same coords as you make for Gate1 value.
SendClientMessage(playerid, COLOR_GREEN, "Gate closed");
return 1;
}
return 1;
}