LIFT DOESN'T MOVE
#1

Basically i created a lift that should move up and down when you press H but it doesn't happen

here is the code:

pawn Код:
//TOP

new G1;
new G2;
new G3;
new GateState;

public OnGameModeInit()
{
    G1 = CreateObject(3626,2229.75585938,950.22705078,8.38761425,0.00000000,0.00000000,180.00000000);
    G2 = CreateObject(3626,2229.72460938,953.60375977,8.38761425,0.00000000,0.00000000,0.00000000);
    G3 = CreateObject(3626,2229.76245117,946.99987793,8.38761425,0.00000000,0.00000000,179.99993896);
    return 1;
}


public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_HORN)
    {
        if(PlayerToPoint(playerid, 5, 2229.72460938,953.60375977,8.38761425) || PlayerToPoint(playerid, 5, 2229.72460938,953.60351562,13.88761425))
        {
            if(GateState == 0)
            {
                MoveObject(G1, 2229.75585938,950.22656250,13.88761425,3);
                MoveObject(G2, 2229.72460938,953.60351562,13.88761425,3);
                MoveObject(G3, 2229.76171875,946.99902344,13.88761425,3);
                GateState = 1;
            }
            else
            {
                MoveObject(G1, 2229.75585938,950.22705078,8.38761425,3);
                MoveObject(G2, 2229.72460938,953.60375977,8.38761425,3);
                MoveObject(G3, 2229.76245117,946.99987793,8.38761425,3);
                GateState = 0;
            }
        }
    }
}
Reply
#2

Try removing the "if(PlayerToPoint()" control structure, and see if that changes anything.
Reply
#3

Try this:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_HORN)
    {
        if(IsPlayerInRangeOfPoint(playerid, 5.0,2229.72460938,953.60375977,8.38761425) || IsPlayerInRangeOfPoint(playerid, 5.0, 2229.72460938,953.60351562,13.88761425))
        {
            if(GateState == 0)
            {
                MoveObject(G1, 2229.75585938,950.22656250,13.88761425,3);
                MoveObject(G2, 2229.72460938,953.60351562,13.88761425,3);
                MoveObject(G3, 2229.76171875,946.99902344,13.88761425,3);
                GateState = 1;
            }
            else if(GateState == 1)
            {
                MoveObject(G1, 2229.75585938,950.22705078,8.38761425,3);
                MoveObject(G2, 2229.72460938,953.60375977,8.38761425,3);
                MoveObject(G3, 2229.76245117,946.99987793,8.38761425,3);
                GateState = 0;
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "Not close enough");
            }
        }
    }
}
Reply
#4

Quote:
Originally Posted by HondaCBR
Посмотреть сообщение
Basically i created a lift that should move up and down when you press H but it doesn't happen

here is the code:

pawn Код:
//TOP

new G1;
new G2;
new G3;
new GateState;

public OnGameModeInit()
{
    G1 = CreateObject(3626,2229.75585938,950.22705078,8.38761425,0.00000000,0.00000000,180.00000000);
    G2 = CreateObject(3626,2229.72460938,953.60375977,8.38761425,0.00000000,0.00000000,0.00000000);
    G3 = CreateObject(3626,2229.76245117,946.99987793,8.38761425,0.00000000,0.00000000,179.99993896);
    return 1;
}


public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_HORN)
    {
        if(PlayerToPoint(playerid, 5, 2229.72460938,953.60375977,8.38761425) || PlayerToPoint(playerid, 5, 2229.72460938,953.60351562,13.88761425))
        {
            if(GateState == 0)
            {
                MoveObject(G1, 2229.75585938,950.22656250,13.88761425,3);
                MoveObject(G2, 2229.72460938,953.60351562,13.88761425,3);
                MoveObject(G3, 2229.76171875,946.99902344,13.88761425,3);
                GateState = 1;
            }
            else
            {
                MoveObject(G1, 2229.75585938,950.22705078,8.38761425,3);
                MoveObject(G2, 2229.72460938,953.60375977,8.38761425,3);
                MoveObject(G3, 2229.76245117,946.99987793,8.38761425,3);
                GateState = 0;
            }
        }
    }
}
sorry forget what i wrote.. lol
Reply
#5

Quote:
Originally Posted by AlexzzPro
Посмотреть сообщение
Try this:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_HORN)
    {
        if(IsPlayerInRangeOfPoint(playerid, 5.0,2229.72460938,953.60375977,8.38761425) || IsPlayerInRangeOfPoint(playerid, 5.0, 2229.72460938,953.60351562,13.88761425))
        {
            if(GateState == 0)
            {
                MoveObject(G1, 2229.75585938,950.22656250,13.88761425,3);
                MoveObject(G2, 2229.72460938,953.60351562,13.88761425,3);
                MoveObject(G3, 2229.76171875,946.99902344,13.88761425,3);
                GateState = 1;
            }
            else if(GateState == 1)
            {
                MoveObject(G1, 2229.75585938,950.22705078,8.38761425,3);
                MoveObject(G2, 2229.72460938,953.60375977,8.38761425,3);
                MoveObject(G3, 2229.76245117,946.99987793,8.38761425,3);
                GateState = 0;
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "Not close enough");
            }
        }
    }
}
thx works now :]
Reply
#6

Quote:
Originally Posted by HondaCBR
Посмотреть сообщение
thx works now :]
No problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)