PDA

View Full Version : Gates don't open


dusk
20/02/2013, 05:47 PM
So i'm trying to create that would move on the same command

new bool:sasa;
CMD:blet(playerid,params[])
{
if(sasa==false)
{
MoveObject(JailGate,-314.29998779297,1507.4000244141,77.099998474121,5. 0,0,0,179.99450683594);
sasa = true;
}
if(sasa==true)
{
MoveObject(JailGate,-302.89999389648,1507.5,77.099998474121,5.0,0,0,179 .99450683594);
sasa = false;
}
return 1;
}
Anyone sees the problem? coordinates are good,if they are in different commands they work.

Saw®
20/02/2013, 05:51 PM
Don't know if it will fix it , but use 'else if' instead of 'if' in the second condition:

new bool:sasa;
CMD:blet(playerid,params[])
{
if(sasa==false)
{
MoveObject(JailGate,-314.29998779297,1507.4000244141,77.099998474121,5. 0,0,0,179.99450683594);
sasa = true;
}
else if(sasa==true)
{
MoveObject(JailGate,-302.89999389648,1507.5,77.099998474121,5.0,0,0,179 .99450683594);
sasa = false;
}
return 1;
}

dusk
20/02/2013, 05:59 PM
That didn't even cross my mind,Thanks! Was working on that for a while lol