Problems with gates
#1

When I do the /gate command, the gates don't open. They don't even move. They're the toll-booth barriers..

GATE OPEN
CreateObject(2920, 1534.39, -1602.27, 13.27, 0.00, 0.00, 89.94);

GATECLOSED
CreateObject(2920, 1534.39, -1602.27, 13.27, -90.60, 360.06, 89.94);

pawn Код:
new PDGate1


forward PDGateMove();


command(gate, playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 25.0, 1531.2126,-1603.6033,13.3828))
    {
        if(Player[playerid][Faction] == 1)
        {
            if(GateOpen == 0)
            {
                MoveDynamicObject(PDGate1, 1534.39, -1602.27, 13.27, 2.0, 0.0, 0.0, 89.94); // /gate opens the gate
                GateOpen = 1;
            }
            else
            {
                MoveDynamicObject(PDGate1, 1534.39, -1602.27, 13.27, 2.0, -90.60, 360.06, 89.94); // /gate closes the gate
                GateOpen = 0;
            }
        }
    }
        return 1;
}

stock LoadObjects() // loads the gate in the CLOSED position
{
    // SCPD Gates
    PDGate1 = CreateObject(2920, 1534.39,-1602.27,13.27,-90.60,360.06,89.94);
    return 1;
}

public PDGateMove() // moves the gate to the OPEN position when player does /gate
{
    MoveDynamicObject(PDGate1, 1534.39,-1602.27,13.27,0.00,0.00,89.94);
    return 1;
}
Reply
#2

TRY Extending far the radius of your location and check the command
and the gate id or object id that ya gaveit
Reply
#3

All the gate ID's/object ID's and the radius are fine. It was opening yesterday, but the problem was that the gate didn't close, now the problem is that it won't open.
Reply
#4

https://sampforum.blast.hk/showthread.php?tid=289299

This will help you with so much. even gates.'

EDIT: Download V1.1.0 it's the only one that has gates
Reply
#5

There's only a download for v.1.1.1
Reply
#6

& using this just throws up 1,000,000,1 compiling errors
Reply
#7

PDGate1 = CreateObject(2920, 1534.39,-1602.27,13.27,-90.60,360.06,89.94);

replace it with:

PDGate1 = CreateDynamicObject(2920, 1534.39,-1602.27,13.27,-90.60,360.06,89.94);
Reply
#8

first here is what I do... It can be done in other ways also.

first, creating the variable for the gate...

Код:
new gate1;
new gate2;
The creating the object(gate)

Код:
public OnFilterScriptInit()/public OnGameModeInit()
{
	gate1 = CreateObject(2927,215.92999390,1875.50000000,13.89999962,0.00000000,0.00000000,0.00000000); //object(a51_blastdoorr) (D)
	gate2 = CreateObject(2929,211.85000732,1875.50000000,13.89999962,0.00000000,0.00000000,0.00000000); //object(a51_blastdoorl) (D)
}
Then the command to open the gate(please note that when you do it this way you must use different commands for every gate)

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/hopen", cmdtext, true, 6) == 0) // The /open command
	{
		if(IsPlayerInRangeOfPoint(playerid, 5, 213.8570,1875.4865,13.1470))
		{
			MoveObject(gate1, 219.92999390,1875.50000000,13.89999962, 1);
			MoveObject(gate2, 207.85000732,1875.50000000,13.89999962, 1);
		}
		return 1;
	}
}
Then, if you want, a command to close the gate, or you can make a timer to close it.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/hclose", cmdtext, true, 7) == 0)// The /close command
	{
		if(IsPlayerInRangeOfPoint(playerid, 5, 213.8570,1875.4865,13.1470))
		{
			MoveObject(gate1, 215.92999390,1875.50000000,13.89999962, 1);// Moving the gate
			MoveObject(gate2, 211.85000732,1875.50000000,13.89999962, 1);// Moving the gate
		}
		return 1;
	}
}
Reply
#9

You cant move dynamic objects with Moveobject, You need MoveDynamicObject for that.
And vice versa ofcourse.
Reply
#10

I had that with MoveObject. Solution for me was to add a 0.000001 to the Z coordinate (so not the rotation!). Ofcourse retract it again when you close it else the gate will start to float after a lot of times.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)