SA-MP Forums Archive
Not working because of if statement? Again? - 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: Not working because of if statement? Again? (/showthread.php?tid=457409)



Not working because of if statement? Again? - Dokins - 11.08.2013

nothing happens when I type /opencell 1.

This time I'm using sscanf, why wouldn't this work, pretty confusing.

pawn Код:
CMD:opencell(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    new cell;
    if(sscanf(params, "d", cell)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /opencell [cell 1 - 2]");
    if(Faction[playerid] == 1 && IsPlayerInRangeOfPoint(playerid,10.0,312.42233, 325.14948, 1000.01660))
    {
        if(cell == 1)
        {
            MoveDynamicObject(celldoor1,312.42233, 325.14948, 1000.01660 -5,3.0,0,0,0);
            SendClientMessage(playerid, COLOUR_GREY, "You have opened cell door 1.");

        }
        if(cell == 2)
        {
            MoveDynamicObject(celldoor2,312.41660, 321.08066, 1000.01660 -5,3.0,0,0,0);
            SendClientMessage(playerid, COLOUR_GREY, "You have opened cell door 2.");
        }
    }
    return 1;
}



Re: Not working because of if statement? Again? - Donvalley - 11.08.2013

post your lines for:

pawn Код:
celldoor1 = CreateDynamicObject(
celldoor2 = CreateDynamicObject(



Re: Not working because of if statement? Again? - Dokins - 11.08.2013

pawn Код:
celldoor1 = CreateDynamicObject(14856, 312.42233, 325.14948, 1000.01660,   0.00000, 0.00000, 90.00000);
celldoor2 = CreateDynamicObject(14856, 312.41660, 321.08066, 1000.01660,   0.00000, 0.00000, 90.00000);



Re: Not working because of if statement? Again? - Donvalley - 11.08.2013

hmmmmm...

is this part right in terms of Faction ID and Location?

pawn Код:
if(Faction[playerid] == 1 && IsPlayerInRangeOfPoint(playerid,10.0,312.42233, 325.14948, 1000.01660))



Re: Not working because of if statement? Again? - Dokins - 11.08.2013

Indeed.


Re: Not working because of if statement? Again? - Donvalley - 11.08.2013

Quote:
Originally Posted by Dokins
Посмотреть сообщение
nothing happens when I type /opencell 1.
random question does /open cell 2 work or both do nothing?


Re: Not working because of if statement? Again? - Scenario - 11.08.2013

Add some print statements to see where it stops processing.


Re: Not working because of if statement? Again? - Dokins - 11.08.2013

Sorry you were correct, it was the line with the faction part, I apologise, thank you.


Re: Not working because of if statement? Again? - Donvalley - 11.08.2013

Quote:
Originally Posted by Dokins
Посмотреть сообщение
Sorry you were correct, it was the line with the faction part, I apologise, thank you.
No need to apologize glad i could help.