SA-MP Forums Archive
This opens both doors when I /door? - 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 opens both doors when I /door? (/showthread.php?tid=619427)



This opens both doors when I /door? - Dokins - 17.10.2016

pawn Код:
new Float: distance = GetPlayerDistanceFromPoint(playerid, 306.77200, 110.90790, 1003.70831);
    if(Faction[playerid] == 1 || AdminDuty[playerid] == 1 && distance < 1)
    {
        if(SDDoor1Open == 0)
        {
            MoveDynamicObject(SDDoor1,306.77200, 110.90790, 1003.70831, 0.05,0.00000,0.00000, -130.00000);
            SDDoor1Open = 1;
        }
        else
        {
            MoveDynamicObject(SDDoor1,306.77200, 110.90790, 1003.70831,0.05, 0.00000,0.00000, 0.00000);
            SDDoor1Open = 0;
        }
    }
    new Float: distance1 = GetPlayerDistanceFromPoint(playerid, 306.77200, 119.64790, 1003.70032);
    if(Faction[playerid] == 1 || AdminDuty[playerid] == 1 && distance1 < 1)
    {
        if(SDDoor2Open == 0)
        {
            MoveDynamicObject(SDDoor2,306.77200, 119.64790, 1003.70032,0.05, 0.00000, 0.00000, 130.00000);
            SDDoor2Open = 1;
        }
        else
        {
            MoveDynamicObject(SDDoor2,306.77200, 119.64790, 1003.70032, 0.05,  0.00000, 0.00000, 0.00000);
            SDDoor2Open = 0;
        }
    }
CMD:door.

I've used IsPlayerInRangeOfPoint.


Re: This opens both doors when I /door? - SickAttack - 17.10.2016

Use a else if-then statement.


Re: This opens both doors when I /door? - Dokins - 17.10.2016

At which point?


Re: This opens both doors when I /door? - Dokins - 17.10.2016

FIXED.


Re: This opens both doors when I /door? - SickAttack - 17.10.2016

Obviously at the second if-then statement.