//-> Funзхes para o X1 <-// //SetPlayerPos //SetPlayerArmor //SetPlayerHealth |
#include <a_samp>
#define DIALOG_DUELO 24245
new bool:InvitedDuel[MAX_PLAYERS];
new IdDuel[MAX_PLAYERS];
new bool:ArenaUsada;
new Contar = 5;
new ContarDuelo[5][5] ={"~r~1","~b~2","~p~3","~y~4","~g~5"};
forward ExecutarContagem(playerid,pid);
public ExecutarContagem(playerid,pid)
{
if (Contar > 0)
{
GameTextForPlayer(playerid,ContarDuelo[Contar-1], 2500, 3);
GameTextForPlayer(pid,ContarDuelo[Contar-1], 1000, 3);
Contar--;
SetTimerEx("IrDuelo",1000,false,"ii",playerid,pid);
}
else
{
GameTextForPlayer(playerid,"~>~~g~Go~w~Go~r~Go~b~Go~<~", 2500, 3);
GameTextForPlayer(pid,"~>~~g~Go~w~Go~r~Go~b~Go~<~", 2500, 3);
Contar = 5;
TogglePlayerControllable(playerid,true);
TogglePlayerControllable(pid,true);
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128];
new idx;
new id;
cmd = otherplayerids(cmdtext, idx);
if(!strcmp("/duelo", cmd, true))
{
new tmp[128];
new string[128];
tmp = otherplayerids(cmdtext, idx);
id = strval(tmp);
if(InvitedDuel[playerid] == true) return SendClientMessage(playerid,0xF41917AA,"»»[DUELO]«« : Vocк Jб Convidou alguйm,Aguarde Expirar o Convite");
if(ArenaUsada == true) return SendClientMessage(playerid,0xF41917AA,"»»[DUELO]«« : No momento a Arena estб Sendo Usada");
if(!strlen(tmp)) return SendClientMessage(playerid,0xF41917AA,"»»[DUELO]«« : Vocк deve digitar os ID do Player seguindo a Maneira (/duelo-run [playerid])");
if(id == playerid) return SendClientMessage(playerid,0xF41917AA,"»»[DUELO]«« : Vocк nгo pode convidar a Si-Mesmo");
if(InvitedDuel[id] == true) return SendClientMessage(playerid,0xF41917AA,"»»[DUELO]«« : No Momento o Player estб em um Duelo, Aguarde..");
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "»»[DUELO]«« : %s esta lhe convidando para um \n Duelo Leve (Clique Aceitar para Aceitar)",name);
ShowPlayerDialog(id,DIALOG_DUELO,DIALOG_STYLE_MSGBOX,"»»[DUELO]«« :",string,"Aceitar", "Recusar");
GameTextForPlayer(id,"~r~DUE~w~LO !", 2500, 3);
InvitedDuel[id] = true;
IdDuel[id] = playerid;
SetTimerEx("LimparDuelo",15000,false,"ii",id,playerid);
return 1;
}
return 0;
}
forward IrDuelo(playerid,pid);
public IrDuelo(playerid,pid)
{
//-> Funзхes para o X1 <-//
//SetPlayerPos
//SetPlayerArmor
//SetPlayerHealth
//-> Funзхes para Contagem no x1<-//
TogglePlayerControllable(playerid,false);
TogglePlayerControllable(pid,false);
ExecutarContagem(playerid,pid);
return 1;
}
forward LimparDuelo(playerid,pid);
public LimparDuelo(playerid,pid)
{
if(ArenaUsada == false)
{
SendClientMessage(pid,0x1DF6F6AA,"»»[DUELO]«« : Desafio Expirado, Ele Recusou");
SendClientMessage(playerid,0x1DF6F6AA,"»»[DUELO]«« : Desafio Expirado,Vocк Automaticamente Recusou");
InvitedDuel[pid] = false;
InvitedDuel[playerid] = false;
IdDuel[playerid] = playerid;
IdDuel[pid] = pid;
}
return 1;
}
otherplayerids(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_DUELO)
{
if(!response) return LimparDuelo(playerid,IdDuel[playerid]);
if(response)
{
ArenaUsada = true;
new name[MAX_PLAYER_NAME], string[44];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "»»[DUELO]«« : %s aceitou o desafio aguarde 8 Segundos para Irem ao Duelo.",name);
SendClientMessage(IdDuel[playerid],0xF6F600AA,string);
SendClientMessage(playerid,0xF6F600AA,"»»[DUELO]«« : Vocк aceitou o Duelo Aguarde 8 Segundos para Processarmos seus Dados");
SetTimerEx("IrDuelo",8000,false,"ii",playerid,IdDuel[playerid]);
}
return 1;
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(InvitedDuel[killerid] == true)
{
new Float:healthkiller;
new namekiller[24],namedeather[24],string[44];
GetPlayerName(killerid, namekiller, 24);
GetPlayerName(playerid, namedeather, 24);
GetPlayerHealth(killerid,healthkiller);
format(string, sizeof(string), "»»[DUELO]«« : %s Ganhou Duelo de %s com %0.0f de energia (Colete & Vida)",namekiller,namedeather,healthkiller);
SendClientMessageToAll(0xF600F6AA, string);
InvitedDuel[killerid] = false;
InvitedDuel[playerid] = false;
IdDuel[playerid] = playerid;
IdDuel[killerid] = killerid;
ArenaUsada = false;
healthkiller = 0;
SpawnPlayer(killerid);
}
return 1;
}
uma duvida quanod chama alguem par aduel vгo para algum outro local
separado? |