Help with a moving gate
#1

Was wondering if anyone would be willing to make a movable gate at a spot on my server. If u can do it ILL pm u the details and REP++++++.
Reply
#2

These kind of requests go to script request thread.

You can make moving gates with CreateObject and MoveObject, thats all you need.
Reply
#3

can you make the command script for this for a specific player and ill edit
Reply
#4

Not sure about it at all, haven't even tested it.
Make sure to edit your gate position and everything.


pawn Код:
#include <a_samp>
new
    gate,
    playaName[25],
    gateStatus = 0;


public OnFilterScriptInit()
{
    gate = CreateObject(987, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/gate", true))
    {
        GetPlayerName(playerid, playaName, 24);
        if(!strcmp(playaName,"SAMP_Player",true))
        {
            if(!gateStatus)
            {
                MoveObject(gate, 0.0, 0.0, -3.0, 2.5);
                gateStatus = 1;
                return 1;
            }
            else
            {
                MoveObject(gate, 0.0, 0.0, 0.0, 2.5);
                gateStatus = 0;
                return 1;
            }
           
        }
    }
    return 1;
}
EDIT: Mistaken, it does work as a standalone FS if you fix the coordinates for gate & it's position after /gate.
Reply
#5

Where do i put my USername on the server
Reply
#6

Replace "SAMP_Player" with your name ( example : "Zach7" )
Reply
#7

this is so confusing im going to have to get someone to do it for me its so confusing
Reply
#8

pawn Код:
#include <a_samp>

//****** Add these just under your includes. (#include) ******
new gate1, gate2;
new bool:Gate1Open;
new bool:Gate2Open;
//************************************************************

public OnFilterScriptInit() //Or OnGameModeInit() if you're using a gamemode.
{
    gate1 = CreateObject(980, 2097.51, 1720.01, 12.64, 0.00, 0.00, 63.00);
    gate2 = CreateObject(980, 2088.80, 1645.47, 12.43, 0.00, 0.00, 90.00);
    Gate1Open = false;
    Gate2Open = false;
    SetTimer("Gate1Check", 1000, true);
    SetTimer("Gate2Check", 1000, true);
    return 1;
}

//Add these public functions at the bottom of your script.
forward Gate1Check();
public Gate1Check()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInRangeOfPoint(i, 5, 2097.51, 1720.01, 12.64))
            {
                new GateName[MAX_PLAYER_NAME];
                GetPlayerName(i, GateName, MAX_PLAYER_NAME);
                if(strcmp(GateName, "Zach7", false) == 0)
                {
                    if(Gate1Open == false)
                    {
                        MoveObject(gate1, 2097.51, 1720.01, 6, 4, 0, 0, 63);
                        Gate1Open = true;
                    }
                }
            }
            else
            {
                if(Gate1Open == true)
                {
                MoveObject(gate1, 2097.51, 1720.01, 12.64, 4, 0, 0, 63);
                Gate1Open = false;
                }
            }
        }
    }
    return 1;
}

forward Gate2Check();
public Gate2Check()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInRangeOfPoint(i, 5, 2088.80, 1645.47, 12.43))
            {
                new GateName[MAX_PLAYER_NAME];
                GetPlayerName(i, GateName, MAX_PLAYER_NAME);
                if(strcmp(GateName, "Zach7", false) == 0)
                {
                    if(Gate2Open == false)
                    {
                        MoveObject(gate2, 2088.80, 1645.47, 6, 4, 0, 0, 90);
                        Gate2Open = true;
                    }
                }
            }
            else
            {
                if(Gate2Open == true)
                {
                    MoveObject(gate2, 2088.80, 1645.47, 12.43, 4, 0, 0, 90);
                    Gate2Open = false;
                }
            }
        }
    }
    return 1;
}
Enjoy.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)