[HELP]Open and Close gate - Commands[zcmd]
#1

How can I create a command to open and close a gate?
Reply
#2

Depends do you want anyone to open it or just a faction or?
Reply
#3

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)