16.12.2012, 02:31
PHP код:
dcmd_duel(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 3) {
new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index), tmp3 = strtok(params,Index);
if(!strlen(tmp) || !strlen(tmp2) || !IsNumeric(tmp) || !IsNumeric(tmp2)) {
SendClientMessage(playerid, red, "USO: /duel [player1 id] [player2 id] [localizaзгo] (Localizaзхes: 1, 2, 3]");
return SendClientMessage(playerid, red, "Se vocк nгo especificar uma localizaзгo o duelo ocorrerб no lugar atual");
}
new player1 = strval(tmp), player2 = strval(tmp2), location, string[128];
if(!strlen(tmp3)) location = 0; else location = strval(tmp3);
if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERRO: Vocк nгo pode usar este comando neste admin");
if(PlayerInfo[player2][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERRO: Vocк nгo pode usar este comando neste admin");
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
if(IsPlayerConnected(player2) && player2 != INVALID_PLAYER_ID) {
if(InDuel[player1] == 1) return SendClientMessage(playerid,red,"ERRO: Jogador1 jб estб em um duelo");
if(InDuel[player2] == 1) return SendClientMessage(playerid,red,"ERRO: Jogador2 jб estб em um duelo");
if(location == 1) {
SetPlayerInterior(player1,16); SetPlayerPos(player1,-1404.067, 1270.3706, 1042.8672);
SetPlayerInterior(player2,16); SetPlayerPos(player2,-1395.067, 1261.3706, 1042.8672);
} else if(location == 2) {
SetPlayerInterior(player1,0); SetPlayerPos(player1,1353.407,2188.155,11.02344);
SetPlayerInterior(player2,0); SetPlayerPos(player2,1346.255,2142.843,11.01563);
} else if(location == 3) {
SetPlayerInterior(player1,10); SetPlayerPos(player1,-1041.037,1078.729,1347.678); SetPlayerFacingAngle(player1,135);
SetPlayerInterior(player2,10); SetPlayerPos(player2,-1018.061,1052.502,1346.327); SetPlayerFacingAngle(player2,45);
}
InDuel[player1] = 1;
InDuel[player2] = 1;
CMDMessageToAdmins(playerid,"DUEL");
cdt[player1] = 6;
SetTimerEx("Duel",1000,0,"dd", player1, player2);
format(string, sizeof(string), "Administrador \"%s\" deu inнcio a um duelo entre \"%s\" e \"%s\" ", pName(playerid), pName(player1), pName(player2) );
SendClientMessage(player1, blue, string); SendClientMessage(player2, blue, string);
return SendClientMessage(playerid, blue, string);
} else return SendClientMessage(playerid, red, "Jogador2 nгo conectado");
} else return SendClientMessage(playerid, red, "Jogador1 nгo conectado");
} else return SendClientMessage(playerid,red,"ERRO: Vocк nгo tem nнvel alto suficiente para usar este comando");
}
Crйditos: LethaL Adminscript