Not working because of if statement? Again?
#1

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;
}
Reply
#2

post your lines for:

pawn Код:
celldoor1 = CreateDynamicObject(
celldoor2 = CreateDynamicObject(
Reply
#3

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);
Reply
#4

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))
Reply
#5

Indeed.
Reply
#6

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

Add some print statements to see where it stops processing.
Reply
#8

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

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)