How to create a gates with command (and for admins only)?
#2

Put this just under the #include
pawn Код:
#include <a_samp>

new admingate;
Now, put this in before return 1; in public OnGameModeInit, like so:
pawn Код:
public OnGameModeInit()
{
    SetGameModeText("Your Script");
    AddPlayerClass(0, 5.0, 5.0, 5.0, 269.1425, 0, 0, 0, 0, 0, 0);
    admingate = CreateObject(969, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0);
    return 1;
}
Now, here comes the somewhat hard part. I'll use strcmp, the native PAWN command processor, forsake of experience of your scripting.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/move", cmdtext, true, 10) == 0)
    {
        MoveObject(admingate, 0.0, 0.0, 10.0, 1.6);
        SendClientMessage(playerid, 0xFFFFFF, "The gate has magically moved!");
        return 1;
    }
    return 0;
}
To close, all you have to do is basically reverse it!

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/moveback", cmdtext, true, 10) == 0)
    {
        MoveObject(admingate, 0.0, 0.0, 3.0, 1.6);
        SendClientMessage(playerid, 0xFFFFFF, "The gate has magically moved back down!");
        return 1;
    }
    return 0;
}
And all you have to do is change the coordinates!

NOTE:THIS COMMAND IS FOR EVERYONE.
(Rep please, lol)
Reply


Messages In This Thread
How to create a gates with command (and for admins only)? - by igor_andrusenko - 02.08.2011, 18:27
Re: How to create a gates with command (and for admins only)? - by Ruffles. - 02.08.2011, 19:25
Re: How to create a gates with command (and for admins only)? - by Michael@Belgium - 02.08.2011, 19:36
Re: How to create a gates with command (and for admins only)? - by igor_andrusenko - 02.08.2011, 21:50

Forum Jump:


Users browsing this thread: 1 Guest(s)