Help with a command -
Roma555 - 18.01.2011
What hasn't correctly made?
new prov,prov2;
Код:
if (strcmp("/1", cmdtext, true, 10) == 0)
{
if(prov == 0 || prov2 == 0)
{
if(GetPlayerState(playerid) == 1 && PlayerToPoint(3.0, playerid,-2792.7700,-10.3369,7.0391))
{
SendClientMessage(playerid, COLOR_RED, " action 1");
prov = 1;
}
else if(GetPlayerState(playerid) == 1 && PlayerToPoint(3.0, playerid,-2794.9434,216.4308,7.1875))
{
SendClientMessage(playerid, COLOR_RED, " action 2");
prov2 = 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "You not on a pickup.");
}
}
else if(prov == 1 || prov2 == 1)
{
SendClientMessage(playerid, COLOR_RED, "Action is already carried out");
}
return 1;
}
if (strcmp("/2", cmdtext, true, 10) == 0)
{
if(prov == 1 || prov2 == 1)
{
if(GetPlayerState(playerid) == 1 && PlayerToPoint(3.0, playerid,-2792.7700,-10.3369,7.0391))
{
SendClientMessage(playerid, COLOR_RED, " action 1");
prov = 0;
}
else if(GetPlayerState(playerid) == 1 && PlayerToPoint(3.0, playerid,-2794.9434,216.4308,7.1875))
{
SendClientMessage(playerid, COLOR_RED, " action 2");
prov2 = 0;
}
else
{
SendClientMessage(playerid, COLOR_RED, "You not on a pickup.");
}
}
else if(prov == 0 || prov2 == 0)
{
SendClientMessage(playerid, COLOR_RED, "Have already cancelled action");
}
return 1;
}
Doesn't work:
Код:
if(prov == 0 || prov2 == 0)
{
Re: Help with a command -
Backwardsman97 - 18.01.2011
http://pastebin.com/Q8B2JsF0
Re: Help with a command -
Roma555 - 18.01.2011
Gives errors:
(446

: error 029: invalid expression, assumed zero
> if(GetPlayerState(playerid) == 1))
(4491) : warning 225: unreachable code
> return 1;
}
Re: Help with a command -
Infamous - 18.01.2011
Remove the extra bracket on GetPlayerState.
Re: Help with a command -
Roma555 - 18.01.2011
Has cleaned GetPlayerState.
Now the command is entered if to enter many times
Re: Help with a command -
Infamous - 18.01.2011
If you enter the command more than once it fails?
Re: Help with a command -
Roma555 - 18.01.2011
I do, to set fire to the house
I want to make so:
When the house burns, it is necessary that it couldn't be set fire once again
Re: Help with a command -
Infamous - 18.01.2011
I would go back to using this method again then:
pawn Код:
new prov = 0;
new prov2 = 0;
if(prov == 0 || prov2 == 0)
if(prov == 1 || prov2 == 1)
Re: Help with a command -
Roma555 - 18.01.2011
Again it is possible to enter many times a command on the same house
Here is how did:
Код:
new provfire = 0;
new provfire2 = 0;
new provfire3 = 0;
new provfire4 = 0;
if (strcmp("/fire", cmdtext, true, 10) == 0)
{
if(provfire == 0 || provfire2 == 0 || provfire3 == 0 || provfire4 == 0)
{
if(GetPlayerState(playerid) == 1 && PlayerToPoint(3.0, playerid,-2792.7700,-10.3369,7.0391)) //
{
CreateObject(18690, 280.996704, 1876.698120, 14.849337, 90.2407954, -2.57831008, 1.71887339);
CreateObject(18690, -2794.0922851563, -12.043877601624, 9.0996828079224, 0, 0, 270.67565917969);
CreateObject(18690, -2793.998046875, -13.272877693176, 9.0931529998779, 0, 0, 270.67565917969);
provfire = 1;
}
else if(GetPlayerState(playerid) == 1 && PlayerToPoint(3.0, playerid,-2794.9434,216.4308,7.1875)) //
{
CreateObject(18690, -2791.4255371094, 214.50006103516, 9.2241134643555, 0, 0, 0);
CreateObject(18690, -2791.2272949219, 214.4561920166, 12.408718109131, 0, 0, 0);
provfire2 = 1;
}
else if(GetPlayerState(playerid) == 1 && PlayerToPoint(3.0, playerid,-2795.7056,-173.7761,7.1875)) //
{
CreateObject(18690, -2792.7888183594, -172.24966430664, 9.0434942245483, 0, 0, 0);
CreateObject(18690, -2792.7888183594, -167.88143920898, 9.0755500793457, 0, 0, 0);
provfire3 = 1;
}
else if(GetPlayerState(playerid) == 1 && PlayerToPoint(3.0, playerid,-2720.2542,4.2772,4.3359)) //
{
CreateObject(18690, -2722.1628417969, 6.8345627784729, 5.535804271698, 0, 0, 0);
CreateObject(18690, -2723.4682617188, 1.9654642343521, 6.1252665519714, 0, 0, 0);
provfire4 = 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "You not on a pickup");
}
}
else if(provfire == 1 || provfire2 == 1 || provfire3 == 1 || provfire4 == 1)
{
SendClientMessage(playerid, COLOR_RED, "Error: the house already burns");
}
return 1;
}
What isn't correct?