SA-MP Forums Archive
This should work ? Why dont it ? - 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)
+--- Thread: This should work ? Why dont it ? (/showthread.php?tid=347717)



This should work ? Why dont it ? - Geniuss - 02.06.2012

How comes this dont work ? I am really confused, It should work, Help me please

pawn Код:
new LSPDGarageDoor, LSPDGarageDoorOpen;
pawn Код:
LSPDGarageDoor = CreateObject(971,1588.90002441,-1638.19995117,14.39999962,0.00000000,0.00000000,180.00000000); //object(subwaygate) (2)
pawn Код:
command(gate, playerid, params[])
{
    #pragma unused params

    new string[128];

    if(Groups[Player[playerid][Group]][CommandTypes] == 1 || Groups[Player[playerid][Group]][CommandTypes] == 1)
    {
        GetPlayerPos(playerid, Positions[0][0], Positions[0][1], Positions[0][2]);
        GetObjectPos(LSPDGarageDoor, Positions[1][0], Positions[1][1], Positions[2][2]);
       
        if(GetDistance(Positions[0][0], Positions[0][1], Positions[0][2], Positions[1][0], Positions[1][1], Positions[1][2]) < 30.0)
        {
            if(LSPDGarageDoorOpen == 0)
            {
                format(string, sizeof(string), "* %s uses their remote to open the gates.", GetName(playerid));
                NearByMessage(playerid, PURPLE, string);
                MoveObject(LSPDGarageDoor, 1588.9000244141, -1638.1999511719, 8.6999998092651, 1);
                LSPDGarageDoorOpen = 1;
                SetTimer("CloseLSPDGarageDoor", 7000, false);
            }
            else
            {
                SendClientMessage(playerid, WHITE, "The gate is already open, wait for it to close.");
            }
        }
    }
}
If you need any other code just ask please help me

Help is appreciated so much

Please


Re: This should work ? Why dont it ? - ikey07 - 02.06.2012

pawn Код:
command(gate, playerid, params[])
{
    #pragma unused params
    if(Groups[Player[playerid][Group]][CommandTypes] == 1)
    {
        if(IsPlayerInRangeOfpoint(playerid,30.0,1588.90002441,-1638.19995117,14.39999962))
        {
            if(LSPDGarageDoorOpen == 0)
            {
                new string[128];
                format(string, sizeof(string), "* %s uses their remote to open the gates.", GetName(playerid));
                NearByMessage(playerid, PURPLE, string);
                MoveObject(LSPDGarageDoor, 1588.9000244141, -1638.1999511719, 8.6999998092651, 1);
                LSPDGarageDoorOpen = 1;
                SetTimer("CloseLSPDGarageDoor", 7000, false);
            }
            else
            {
                SendClientMessage(playerid, WHITE, "The gate is already open, wait for it to close.");
            }
        }
    }
}
Life needs to live simple, else its unneeded stress