20.03.2011, 06:08
antonio is right.
but , you can also make it with 1 command ....using switch.
like this
Create a variable
for explame :
and of course a variable for the gate creation.
Before we continue let me explain you something . in case the gate1Status is 0 , the gate is closed. in case its 1 , the gate is opend.
ok now under public OnFilterScriptInit()
create the gate.
Okey now for the command :
but , you can also make it with 1 command ....using switch.
like this
Create a variable
for explame :
Код:
new gate1Status = 0;
Код:
new gate1;
ok now under public OnFilterScriptInit()
create the gate.
Код:
gate1 = CreateObject(980,923.155,-1225.358,18.3,0.0,0.0,90.000);
Код:
if(strcmp(cmdtext,"/red",true) == 0)//checks if the cmdtext is euquals to /red.(not case sesitive) { switch(gate1Status)//the switch. checks the gate1Status val(integer). case its 0 it will do X case its 1 it will do X. { case 0://In case the gate is closed. that will open the gate. { MoveObject(gate1, 923.155,-1225.358,7.3,3.0);//move the object to another place with 3.0 speed. SendClientMessage(playerid,COLOR_LIGHTCYAN,"Red Blood'z Gate Is Open.Please Use /redclose to close gate"); } case 1://In case the gate is open . that will close the gate . { MoveObject(gate1, 923.155,-1225.358,18.3,3.0);//move the object back to the start where its created with 3.0 speed. SendClientMessage(playerid,COLOR_LIGHTCYAN,"Red Blood'z Gate is Closed.Thanks"); } } return 1;//return 1 .... so you wont get any errors or stupid bugs }