SA-MP Forums Archive
LIFT DOESN'T MOVE - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: LIFT DOESN'T MOVE (/showthread.php?tid=247482)



LIFT DOESN'T MOVE - HondaCBR - 09.04.2011

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



Re: LIFT DOESN'T MOVE - linuxthefish - 09.04.2011

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


Re: LIFT DOESN'T MOVE - BizzyD - 09.04.2011

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");
            }
        }
    }
}



Re: LIFT DOESN'T MOVE - cruising - 09.04.2011

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


Re: LIFT DOESN'T MOVE - HondaCBR - 09.04.2011

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 :]


Re: LIFT DOESN'T MOVE - BizzyD - 09.04.2011

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