08.01.2011, 14:11
PHP код:
new opened1;
new opened2;
new gate1;
new gate2;
PHP код:
gate1 = CreateObject(980, 1792.6700439453, -1284.7282714844, 15.406204223633, 0, 0, 0); //GATE1!
gate2 = CreateObject(980, 1788.2348632813, -1298.3057861328, 14.098407745361, 0, 0, 0); //GATE2!
PHP код:
if(strcmp("/gate1", cmdtext, true, 6) == 0) {/////WITH ONLY ONE COMMAND!
if(opened1 == 0) {
new name[MAX_PLAYER_NAME+1];
new String128[128];
GetPlayerName(playerid, name, sizeof(name));
format(String128, sizeof(String128), "%s has opened the gate!", name);
SendClientMessageToAll(0x33AA33AA, String128);
SendClientMessage(playerid, 0x33AA33AA,"Gate Opened!");
MoveObject(gate1,1792.6700439453, -1284.7282714844, 15.406204223633, 2.5);//OPEN
opened1 = 1;
} else if(opened1 == 1) {
new name[MAX_PLAYER_NAME+1];
new String128[128];
GetPlayerName(playerid, name, sizeof(name));
format(String128, sizeof(String128), "%s has closed the gate!", name);
SendClientMessageToAll(0xAA3333AA, String128);
SendClientMessage(playerid, 0xAA3333AA,"Gate Closed!");
MoveObject(gate1, 1792.6700439453, -1284.7282714844, 8.7312259674072, 2.5);//CLOSE
opened1 = 0;
}
return 1;
}
if(strcmp("/gate2", cmdtext, true, 6) == 0) {/////WITH ONLY ONE COMMAND!
if(opened2 == 0) {
new name[MAX_PLAYER_NAME+1];
new String128[128];
GetPlayerName(playerid, name, sizeof(name));
format(String128, sizeof(String128), "%s has opened the gate 2!", name);
SendClientMessageToAll(0x33AA33AA, String128);
SendClientMessage(playerid, 0x33AA33AA,"Gate 2 Opened!");
MoveObject(gate1,1799.7746582031, -1298.7623291016, 14.098407745361, 2.5);//OPEN1
opened1 = 1;
} else if(opened2 == 1) {
new name[MAX_PLAYER_NAME+1];
new String128[128];
GetPlayerName(playerid, name, sizeof(name));
format(String128, sizeof(String128), "%s has closed the gate 2!", name);
SendClientMessageToAll(0xAA3333AA, String128);
SendClientMessage(playerid, 0xAA3333AA,"Gate 2 Closed!");
MoveObject(gate1, 1788.2348632813, -1298.3057861328, 14.098407745361, 2.5);//CLOSE
opened2 = 0;
}
return 1;
}