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.