pawn Код:
if(strcmp(cmd,"/openagate1", true)==0) {
MoveObject(971, 2897.9375, -2051.705078125, 5.4179458618164, 1);
return 1;
}
CreateObject(971, 2897.9375, -2051.705078125, 5.4179458618164, 0, 0, 268.24768066406);
if(strcmp(cmd, "/closeagate1", true)==0) {
MoveObject(971, 2897.9375, -2051.705078125, 5.4179458618164,1);
return 1;
}
You're doing it wrong.
Put all your
CreateObjects under
NOT, under
OnPlayerCommandText.
At the top of your script, below the
includes, put:
pawn Код:
new gate[replace me with how many gates you have];
Then infront of your objects which are your gates, put:
pawn Код:
gate[0]=CreateObject(blahblahblah);
So it will look like this:
pawn Код:
public OnGameModeInit(){
gate[0]=CreateObject(blahblahblah);//Start on gate[0], not gate[1] so you can have more IDs
gate[1]=CreateObject(blahblahblah);
gate[2]=CreateObject(blahblahblah);
//Make sure the number in gate[ ] is not the same as another object's number
// Make sure the number in new gate[ ] is the number of gates you have
return 1;
}
And to open the gates:
pawn Код:
public OnPlayerCommandText(playerid,cmdtext[]){
if(!strcmp(cmdtext,"/OpenGate1",true)){
MoveObject(gate[replace me with the gate you want to move],new x, new y, new z, speed);
return 1;
}
return 0;
}
e.g.
pawn Код:
public OnPlayerCommandText(playerid,cmdtext[]){
if(!strcmp(cmdtext,"/OpenGate1",true)){
MoveObject(gate[0],500.0,1337.13, 157.454,5);
return 1;
}
if(!strcmp(cmdtext,"/OpenGate2",true)){
MoveObject(gate[1],-412.144, 1646.454, 494.54524, 10);
return 1;
}
return 0;
}
Also, as they said, you've done something wrong above what you posted.