SA-MP Forums Archive
Why do these not work? - 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: Why do these not work? (/showthread.php?tid=338280)



Why do these not work? - BleverCastard - 29.04.2012

pawn Код:
CMD:dooropen(playerid, params[])
{
    if(playerVariables[playerid][pGroup] == 1)
    {
            if(IsPlayerInRangeOfPoint(playerid, 2.0, 1812.0830,-1545.2319,5700.4287))
            {

                MoveObject(pdoor3,1811.73828125+1,-1545.82873535,5699.42480469,0.50);
                MoveObject(pdoor4,1808.73071289-1,-1545.87463379,5699.42480469,0.50);
                return 1;
            }
            else if(IsPlayerInRangeOfPoint(playerid, 2.0,1797.00830078,-1525.15258789,5699.42480469) || IsPlayerInRangeOfPoint(playerid, 2.0, 1793.6631,-1523.9191,5700.4287))
            {
                MoveObject(edoor5,1797.00830078+1,-1525.15258789,5699.42480469,0.50);
                MoveObject(edoor6,1794.00976562-1,-1525.18676758,5699.42480469,0.50);
                return 1;
            }
            else SendClientMessage(playerid, 0xAA3333AA, "[Error]: {FFFFFF} You are not around a control pad!");
    }
    else return SendClientMessage(playerid,-1, "You are not a Prison Guard!");
    return 1;
}
pawn Код:
CMD:doorclose(playerid, params[])
{
    if(playerVariables[playerid][pGroup] == 1)
    {
            if(IsPlayerInRangeOfPoint(playerid, 2.0, 1812.0830,-1545.2319,5700.4287))
            {

                MoveObject(pdoor3,1811.73828125,-1545.82873535,5699.42480469,0.50);
                MoveObject(pdoor4,1808.73071289,-1545.87463379,5699.42480469,0.50);
                return 1;
            }
            else if(IsPlayerInRangeOfPoint(playerid, 2.0, 1797.00830078,-1525.15258789,5699.42480469) || IsPlayerInRangeOfPoint(playerid, 2.0, 1793.6631,-1523.9191,5700.4287))
            {
                MoveObject(edoor5,1797.00830078,-1525.15258789,5699.42480469,0.50);
                MoveObject(edoor6,1794.00976562,-1525.18676758,5699.42480469,0.50);
                return 1;
            }
            else SendClientMessage(playerid, 0xAA3333AA, "[Error]: {FFFFFF} You are not around a control pad!");
    }
    else return SendClientMessage(playerid,-1, "You are not a prison guard!");
    return 1;
}
If you are not pGroup1 you can still do it.


Re: Why do these not work? - Faisal_khan - 29.04.2012

Try this hope this works and it is untested:
pawn Код:
CMD:dooropen(playerid, params[])
{
    if(playerVariables[playerid][pGroup] != 1)
    {
        return SendClientMessage(playerid,-1, "You are not a Prison Guard!");
    }
    else
    {
                if(IsPlayerInRangeOfPoint(playerid, 2.0, 1812.0830,-1545.2319,5700.4287))
            {

                MoveObject(pdoor3,1811.73828125+1,-1545.82873535,5699.42480469,0.50);
                MoveObject(pdoor4,1808.73071289-1,-1545.87463379,5699.42480469,0.50);
                return 1;
            }
            else if(IsPlayerInRangeOfPoint(playerid, 2.0,1797.00830078,-1525.15258789,5699.42480469) || IsPlayerInRangeOfPoint(playerid, 2.0, 1793.6631,-1523.9191,5700.4287))
            {
                MoveObject(edoor5,1797.00830078+1,-1525.15258789,5699.42480469,0.50);
                MoveObject(edoor6,1794.00976562-1,-1525.18676758,5699.42480469,0.50);
                return 1;
            }
            else SendClientMessage(playerid, 0xAA3333AA, "[Error]: {FFFFFF} You are not around a control pad!");
    }
    return 1;
}

CMD:doorclose(playerid, params[])
{
    if(playerVariables[playerid][pGroup] != 1)
    {
        return SendClientMessage(playerid,-1, "You are not a prison guard!");
    }
    else
    {
                if(IsPlayerInRangeOfPoint(playerid, 2.0, 1812.0830,-1545.2319,5700.4287))
            {

                MoveObject(pdoor3,1811.73828125,-1545.82873535,5699.42480469,0.50);
                MoveObject(pdoor4,1808.73071289,-1545.87463379,5699.42480469,0.50);
                return 1;
            }
            else if(IsPlayerInRangeOfPoint(playerid, 2.0, 1797.00830078,-1525.15258789,5699.42480469) || IsPlayerInRangeOfPoint(playerid, 2.0, 1793.6631,-1523.9191,5700.4287))
            {
                MoveObject(edoor5,1797.00830078,-1525.15258789,5699.42480469,0.50);
                MoveObject(edoor6,1794.00976562,-1525.18676758,5699.42480469,0.50);
                return 1;
            }
            else SendClientMessage(playerid, 0xAA3333AA, "[Error]: {FFFFFF} You are not around a control pad!");

    }
    return 1;
}



Re: Why do these not work? - Hiddos - 29.04.2012

If you can still do it, it means you're setting the pGroup to 1 somewhere else in the script.


Re: Why do these not work? - BleverCastard - 29.04.2012

Urgh, It keeps saying GeoIP_Plugin isn't loading and I got the latest one, help?!