How to make this ?
#1

How to make /prisonopen with prisonopen1 and prisonclose..etc work as one cmd i dunno how to make it ,ty for help!


Код:
if(strcmp(cmd, "/prisonopen", true) == 0) { 
	MoveObject(gate,-2061.1921, -102.8048, 35.7768,2.00); //
	SendClientMessage(playerid, COLOR_RED, "Gates are opening, Please Wait."); 
	return 1;
	}
	
	if(strcmp(cmd, "/prisonclose", true) == 0) { // 
	MoveObject(gate,-2053.2983, -102.4093, 35.7768,2.00); //
	SendClientMessage(playerid, COLOR_RED, "The Gates are closing, Please Wait."); // 
	return 1;
	}
 if(strcmp(cmd, "/prisonopen1", true) == 0) { //
	MoveObject(gate1,-2040.9447, -102.5048, 35.7768,2.00); // 
	SendClientMessage(playerid, COLOR_RED, "Gates are opening, Please Wait."); //
	return 1;
	}
    if(strcmp(cmd, "/prisonclose1", true) == 0) { //
	MoveObject(gate1,-2048.5291, -102.3341, 35.7768,2.00); //
	SendClientMessage(playerid, COLOR_RED, "The Gates are closing, Please Wait."); //
	return 1;
	}
Reply
#2

These would be outside of everything
pawn Код:
new bool:openGate1 = false;
new bool:openGate2 = false;
pawn Код:
if(strcmp(cmd, "/prisonopen", true) == 0)
{
    if(openGate1 == false)
    {
        MoveObject(gate,-2061.1921, -102.8048, 35.7768,2.00); //
        SendClientMessage(playerid, COLOR_RED, "Gates are opening, Please Wait.");
        openGate1 = true;
    }
    if(openGate1 == true)
    {
        MoveObject(gate,-2053.2983, -102.4093, 35.7768,2.00); //
        SendClientMessage(playerid, COLOR_RED, "The Gates are closing, Please Wait."); //
        openGate1 = false;
    }
    return 1;
}
if(strcmp(cmd, "/prisonopen1", true) == 0)
{ //
    if(openGate2 == false)
    {
        MoveObject(gate1,-2040.9447, -102.5048, 35.7768,2.00); //
        SendClientMessage(playerid, COLOR_RED, "Gates are opening, Please Wait."); //
        openGate2 = true;
    }
    if(openGate2 == true)
    {
        MoveObject(gate1,-2048.5291, -102.3341, 35.7768,2.00); //
        SendClientMessage(playerid, COLOR_RED, "The Gates are closing, Please Wait."); //
        openGate2 = false;
    }
    return 1;
}
Like that basically

If you want them to be the same command, use IsPlayerInRangeOfPoint
Reply
#3

Thanks )

P.s is it possible to open all and close with one cmd?
Reply
#4

Quote:
Originally Posted by niere
Посмотреть сообщение
Thanks )

P.s is it possible to open all and close with one cmd?
yes, he used boolean, boolean have just 2 position true or false, when gate will open will be true and when you try again use that cmd will check condition, if will be false then close gate and get true
understood?
Reply
#5

Quote:
Originally Posted by mineralo
Посмотреть сообщение
yes, he used boolean, boolean have just 2 position true or false, when gate will open will be true and when you try again use that cmd will check condition, if will be false then close gate and get true
understood?
Ohh ok thanks ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)