27.03.2016, 21:56
to criando um sistema de duelo com base no /lutar que й sу para os Boxeadores...
eu criei acho que tudo certo mas trava o pawn olha sу...
Vou postar todo codigo aq...
no /aceitar
eu criei acho que tudo certo mas trava o pawn olha sу...
Vou postar todo codigo aq...
PHP код:
if(DuelWaitTime[i] > 0)
{
if(DuelWaitTime[i] >= DuelDelay)
{
DuelDelay = 0;
DuelWaitTime[i] = 0;
PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
GameTextForPlayer(i, "~g~A Luta Comeзou", 5000, 1);
TogglePlayerControllable(i, 1);
SetPlayerArmour(i, 100.0);
DuelStarted = 1;
}
else
{
format(gstring, sizeof(gstring), "%d", DuelDelay - DuelWaitTime[i]);
GameTextForPlayer(i, gstring, 1500, 6);
DuelWaitTime[i] += 1;
}
}
if(DuelStarted > 0) // Fim duel started// Fim duel started// Fim duel started// Fim duel started// Fim duel started// Fim duel started
{
new trigger = 0;
new Lost = 0;
new Float:angle;
new Float:health;
GetPlayerHealth(i, health);
if(health < 12)
{
if(i == pduel1) { Lost = 1; trigger = 1; }
else if(i == pduel2) { Lost = 2; trigger = 1; }
}
if(health < 28) { GetPlayerFacingAngle(i, angle); SetPlayerFacingAngle(i, angle + 85); }
if(trigger)
{
new winner[MAX_PLAYER_NAME];
new loser[MAX_PLAYER_NAME];
new titel[MAX_PLAYER_NAME];
if(Lost == 1)
{
if(IsPlayerConnected(pduel1) && IsPlayerConnected(pduel2))
{
SetPlayerPos(pduel1, 298.3701,-142.0678,1004.0625); SetPlayerPos(pduel2, 298.3701,-142.0678,1004.0625);
SetPlayerInterior(Boxer1, 5); SetPlayerInterior(pduel2, 5);
GetPlayerName(pduel1, loser, sizeof(loser));
GetPlayerName(pduel2, winner, sizeof(winner));
if(TDuel < 255)
{
if(IsPlayerConnected(TBoxer))
{
if(TDuel != pduel2)
{
TDuel = pduel2;
GetPlayerName(TBoxer, titel, sizeof(titel));
new nstring[MAX_PLAYER_NAME];
format(nstring, sizeof(nstring), "%s", titel);
strmid(Titel[TitelName], nstring, 0, strlen(nstring), 255);
Titel[TitelWins] = PlayerInfo[TDuel][pWins];
Titel[TitelLoses] = PlayerInfo[TDuel][pLoses];
format(gstring, sizeof(gstring), "Noticias Duelo x1: %s venceu um x1 contra %s.", titel, loser);
OOCNews(COLOR_WHITE,gstring);
}
else
{
GetPlayerName(TBoxer, titel, sizeof(titel));
format(gstring, sizeof(gstring), "Noticias: %s venceu um duelo contra %s.", titel, loser);
OOCNews(COLOR_WHITE,gstring);
Titel[TitelWins] = PlayerInfo[pduel1][pWins];
Titel[TitelLoses] = PlayerInfo[pduel2][pLoses];
SaveBoxer();
}
}
}//TBoxer
format(gstring, sizeof(gstring), " Vocк perdeu o duelo contra %s.", winner);
SendClientMessage(pduel1, COLOR_LIGHTBLUE, gstring);
GameTextForPlayer(pduel1, "~r~Voce Perdeu", 3500, 1);
format(gstring, sizeof(gstring), " Vocк ganhou o duelo contra %s.", loser);
SendClientMessage(pduel2, COLOR_LIGHTBLUE, gstring);
GameTextForPlayer(pduel2, "~r~Voce Venceu", 3500, 1);
if(GetPlayerHealth(pduel1, health) < 20)
{
SendClientMessage(pduel1, COLOR_LIGHTBLUE, " Vocк Quase perdeu esse duelo");
SetPlayerHealth(pduel1, 100);
}
else
{
SendClientMessage(pduel1, COLOR_LIGHTBLUE, " Vocк continua em bom estado apуs a luta.");
SetPlayerHealth(pduel1, 100);
}
if(GetPlayerHealth(pduel2, health) < 20)
{
SendClientMessage(pduel2, COLOR_LIGHTBLUE, " Vocк Quase perdeu esse duelo");
SetPlayerHealth(pduel2, 100);
}
else
{
SendClientMessage(pduel2, COLOR_LIGHTBLUE, " Vocк continua em bom estado apуs a luta.");
SetPlayerHealth(pduel2, 100);
}
GameTextForPlayer(pduel1, "~g~Fim da Luta", 5000, 1); GameTextForPlayer(pduel2, "~g~Fim da Luta", 5000, 1);
PlayerBoxing[pduel1] = 0;
PlayerBoxing[pduel2] = 0;
}
}
else if(Lost == 2)
{
if(IsPlayerConnected(Boxer1) && IsPlayerConnected(Boxer2))
{
SetPlayerPos(pduel1, 298.3701,-142.0678,1004.0625); SetPlayerPos(pduel2, 298.3701,-142.0678,1004.0625);
SetPlayerInterior(pduel1, 5); SetPlayerInterior(pduel2, 5);
GetPlayerName(pduel1, winner, sizeof(winner));
GetPlayerName(pduel2, loser, sizeof(loser));
if(TDuel < 255)
{
if(IsPlayerConnected(TDuel))
{
if(TDuel != pduel1)
{
TDuel = pduel1;
GetPlayerName(TDuel, titel, sizeof(titel));
new nstring[MAX_PLAYER_NAME];
format(nstring, sizeof(nstring), "%s", titel);
strmid(Titel[TitelName], nstring, 0, strlen(nstring), 255);
Titel[TitelWins] = PlayerInfo[TDuel][pWins];
Titel[TitelLoses] = PlayerInfo[TDuel][pLoses];
format(gstring, sizeof(gstring), "Noticias do Boxe: %s venceu a luta contra %s e agora й o campeгo.", titel, loser);
OOCNews(COLOR_WHITE,gstring);
}
else
{
SendClientMessage(Boxer1, COLOR_GREY, " Vocк precisa ser um lutador de boxe para ganhar uma luta!");
}
}
else
{
GetPlayerName(TDuel, titel, sizeof(titel));
format(gstring, sizeof(gstring), "Noticias do Boxe: %s venceu a luta contra %s.", titel, loser);
OOCNews(COLOR_WHITE,gstring);
Titel[TitelWins] = PlayerInfo[TBoxer][pWins];
Titel[TitelLoses] = PlayerInfo[Boxer1][pLoses];
}
}
}//TBoxer
format(gstring, sizeof(gstring), " Vocк perdeu a luta contra %s.", winner);
SendClientMessage(pduel2, COLOR_LIGHTBLUE, gstring);
GameTextForPlayer(pduel2, "~r~Voce Perdeu", 3500, 1);
format(gstring, sizeof(gstring), " Vocк ganhou a luta contra %s.", loser);
SendClientMessage(pduel1, COLOR_LIGHTBLUE, gstring);
GameTextForPlayer(pduel1, "~g~Voce Venceu", 3500, 1);
if(GetPlayerHealth(pduel1, health) < 20)
{
SendClientMessage(pduel1, COLOR_LIGHTBLUE, " Vocк estб exausto da luta, vб se recuperar.");
SetPlayerHealth(pduel1, 100);
}
else
{
SendClientMessage(pduel1, COLOR_LIGHTBLUE, " Vocк continua em bom estado apуs a luta.");
SetPlayerHealth(pduel1, 100);
}
if(GetPlayerHealth(pduel2, health) < 20)
{
SendClientMessage(pduel2, COLOR_LIGHTBLUE, " Vocк estб exausto da luta, vб se recuperar.");
SetPlayerHealth(pduel2, 100);
}
else
{
SendClientMessage(pduel2, COLOR_LIGHTBLUE, " Vocк continua em bom estado apуs a luta.");
SetPlayerHealth(pduel2, 100);
}
GameTextForPlayer(pduel1, "~g~Fim da luta", 5000, 1); GameTextForPlayer(pduel2, "~g~Fim da luta", 5000, 1);
PlayerDuelando[pduel1] = 0;
PlayerDuelando[pduel2] = 0;
}
}
InPartida = 0;
DuelStarted = 0;
pduel1 = 255;
pduel2 = 255;
TDuel = 255;
trigger = 0;
}
}
}// Fim duel started // Fim duel started // Fim duel started// Fim duel started// Fim duel started// Fim duel started// Fim duel started
PHP код:
if(strcmp(cmd, "/duelar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(InPartida > 0) //ja tem x1
{
SendClientMessage(playerid, COLOR_GREY, " Jб estб tendo uma luta, espere ela terminar !");
return 1;
}
if(PlayerDuelando[playerid] > 0) // vocк ja esta duelando
{
SendClientMessage(playerid, COLOR_GREY, " vocк jб esta duelando !");
return 1;
}
if(!PlayerToPoint(20.0,playerid,306.6657,-141.7108,1004.0625))
{
SendClientMessage(playerid, COLOR_GREY, " Vocк nгo estб na area de duelo!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USE: /duelar [id]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "Vocк nгo pode lutar contra si mesmo!"); return 1; }
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* Vocк intimou %s para um duelo de boxe.", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Jogador %s te intimou para uma luta (USE: /aceitar duelo) para aceitar.", sendername);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
DuelOffer[giveplayerid] = playerid;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " O Jogador estб longe de Vocк, chame ele para perto.!");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " O Jogador Estб Offline !");
return 1;
}
}
return 1;
}
PHP код:
else if(strcmp(x_Emprego,"Duelo",true) == 0)
{
if(DuelOffer[playerid] < 999)
{
if(IsPlayerConnected(DuelOffer[playerid]))
{
format(string, sizeof(string), "* Vocк aceitou a luta de boxe de %s, e irб lutar com %d de saъde.",giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s aceitou seu pedido para a luta de boxe, vocк irб lutar com %d de saъde.",sendername);
SendClientMessage(BoxOffer[playerid], COLOR_LIGHTBLUE, string);
//colete
SetPlayerArmour(playerid, 100);
SetPlayerArmour(DuelOffer[playerid], 100);
// Vida
SetPlayerHealth(playerid, 100);
SetPlayerHealth(DuelOffer[playerid], 100);
SetPlayerInterior(playerid, 5); SetPlayerInterior(DuelOffer[playerid], 5);
SetPlayerPos(playerid, 294.3664,-134.6830,1004.0625); SetPlayerFacingAngle(playerid, 1004.0625);
SetPlayerPos(DuelOffer[playerid], 274.2308,-134.2176,1004.0625); SetPlayerFacingAngle(DuelOffer[playerid], 1004.0625);
TogglePlayerControllable(playerid, 0); TogglePlayerControllable(DuelOffer[playerid], 0);
GameTextForPlayer(playerid, "~r~Esperando", 3000, 1); GameTextForPlayer(DuelOffer[playerid], "~r~Esperando", 3000, 1);
}
DuelWaitTime[playerid] = 1; DuelWaitTime[DuelOffer[playerid]] = 1;
if(BoxDelay < 1) { BoxDelay = 20; }
InPartida = 1;
pduel1 = DuelOffer[playerid];
pduel2 = playerid;
PlayerBoxing[playerid] = 1;
PlayerBoxing[BoxOffer[playerid]] = 1;
DuelOffer[playerid] = 999;
return 1;
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Ninguem te convidou para uma luta !");
return 1;
}
}