Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #include <a_samp>
- #include <zcmd>
- #include <sscanf>
- #if defined FILTERSCRIPT
- #define DIALOG_DUELO1 (323)
- #define DIALOG_DUELO2 (324)
- #define DIALOG_DUELO3 (325)
- #define DIALOG_DUELO4 (326)
- forward P_MandarDuelo(playerid);
- public P_MandarDuelo(playerid)
- {
- new Player1 = GetPVarInt(playerid,"DL_DesafiouID"),MsgLocalDuelo[14],MsgMandarDuelo[150];
- new Jogador1Nome[150],NomeArma1Duelo[50],NomeArma2Duelo[50];
- GetPlayerName(playerid,Jogador1Nome,sizeof(Jogador1Nome));
- GetWeaponName(GetPVarInt(playerid,"DL_DesafiouArma"),NomeArma1Duelo,sizeof(NomeArma1Duelo));
- GetWeaponName(GetPVarInt(playerid,"DL_DesafiouArma2"),NomeArma2Duelo,sizeof(NomeArma2Duelo));
- if(!IsPlayerConnected(Player1)){
- SendClientMessage(playerid,0xFF0000FF,"ERRO: Esse jogador não está mais conectado");
- SetPVarInt(playerid,"DL_DesafiouAlguem",0);
- SetPVarInt(playerid,"DL_DesafiouID",-1);
- return 1;}
- if(GetPVarInt(Player1,"DL_NoDuelo") == 1){
- SendClientMessage(playerid,0xFF0000FF,"ERRO: Esse jogador já está em um Duelo.");
- SetPVarInt(playerid,"DL_DesafiouAlguem",0);
- SetPVarInt(playerid,"DL_DesafiouID",-1);
- return 1;}
- if(GetPVarInt(playerid,"DL_DesafiouLugar") == 1){ MsgLocalDuelo = "Estádio";}else
- if(GetPVarInt(playerid,"DL_DesafiouLugar") == 2){ MsgLocalDuelo = "Vice-Estádio";}else
- if(GetPVarInt(playerid,"DL_DesafiouLugar") == 3){ MsgLocalDuelo = "Armázem";}
- SetPVarInt(Player1,"DL_DesafiouAlguem",1);
- SetPVarInt(Player1,"DL_DesafiouID",playerid);
- SendClientMessage(playerid,0x00BFFFFF,"Desafia de duelo enviado com sucesso! aguarde o jogador Aceitar/Rejeitar o Duelo.");
- format(MsgMandarDuelo,sizeof(MsgMandarDuelo),"{FF0000}%s {00BFFF}Desafiou você para 1 vs 1\n\nArma:%s & %s\nLocal: %s",Jogador1Nome,NomeArma1Duelo,NomeArma2Duelo,MsgLocalDuelo);
- ShowPlayerDialog(Player1,DIALOG_DUELO4,DIALOG_STYLE_MSGBOX,"{FFFF00}Duel",MsgMandarDuelo,"Aceitar","Rejeitar");
- return 1;
- }
- forward P_AceitouODuelo(playerid);
- public P_AceitouODuelo(playerid)
- {
- new Player1 = GetPVarInt(playerid,"DL_DesafiouID"),MsgLocalDuelo[15],MsgDuelo[150];
- SetPVarInt(Player1,"DL_NoDuelo",1);
- SetPVarInt(playerid,"DL_NoDuelo",1);
- ResetPlayerWeapons(playerid);
- ResetPlayerWeapons(Player1);
- SetPlayerHealth(playerid,100);
- SetPlayerArmour(playerid,100);
- SetPlayerHealth(Player1,100);
- SetPlayerArmour(Player1,100);
- TogglePlayerControllable(playerid,0);
- TogglePlayerControllable(Player1,0);
- GivePlayerWeapon(playerid,GetPVarInt(playerid,"DL_DesafiouArma"),999);
- GivePlayerWeapon(playerid,GetPVarInt(playerid,"DL_DesafiouArma2"),999);
- GivePlayerWeapon(Player1,GetPVarInt(playerid,"DL_DesafiouArma"),999);
- GivePlayerWeapon(Player1,GetPVarInt(playerid,"DL_DesafiouArma2"),999);
- if(GetPVarInt(playerid,"DL_DesafiouLugar") == 1){
- MsgLocalDuelo = "Estádio";
- SetPlayerInterior(playerid,0);
- SetPlayerPos(playerid,1308.5769,2151.4307,11.0234);
- SetPlayerInterior(Player1,0);
- SetPlayerPos(Player1,1382.4200,2150.0144,11.0234);}else
- if(GetPVarInt(playerid,"DL_DesafiouLugar") == 2){
- MsgLocalDuelo = "Vice-Estádio";
- SetPlayerInterior(playerid,16);
- SetPlayerPos(playerid,-1374.6429,1243.1626,1039.8672);
- SetPlayerInterior(Player1,16);
- SetPlayerPos(Player1,-1425.7114,1249.0509,1039.8672);}else
- if(GetPVarInt(playerid,"DL_DesafiouLugar") == 3){
- MsgLocalDuelo = "Armázem";
- SetPlayerInterior(playerid,1);
- SetPlayerPos(playerid,1416.2416,-17.9103,1000.9261);
- SetPlayerInterior(Player1,1);
- SetPlayerPos(Player1,1367.5674,-17.5536,1000.9219);}
- new NomeJogadoresDuelo[2][100];
- GetPlayerName(playerid,NomeJogadoresDuelo[0],100);
- GetPlayerName(Player1,NomeJogadoresDuelo[1],100);
- format(MsgDuelo,sizeof(MsgDuelo),"|- Um Duelo entre \"%s[%d]\" e \"%s[%d]\" foi iniciado. |- Aposta: [%d$] | Local %s -|",NomeJogadoresDuelo[0],playerid,NomeJogadoresDuelo[1],Player1,GetPVarInt(playerid,"DL_DesafiouAposta"),MsgLocalDuelo);
- SendClientMessageToAll(0x00FF00FF,MsgDuelo);
- SetPVarInt(playerid,"DL_DesafiouContagem",5);
- SetPVarInt(Player1,"DL_DesafiouContagem",5);
- SetPVarInt(playerid,"DL_DesafiouTimer",SetTimerEx("P_ContagemAbrirDuelo",1000,true,"u",playerid));
- SetPVarInt(Player1,"DL_DesafiouTimer",SetTimerEx("P_ContagemAbrirDuelo",1000,true,"u",Player1));
- return 1;
- }
- forward P_ContagemAbrirDuelo(playerid);
- public P_ContagemAbrirDuelo(playerid)
- {
- if(GetPVarInt(playerid,"DL_DesafiouContagem") <=0){
- TogglePlayerControllable(playerid,1);
- GameTextForPlayer(playerid,"~r~Vai Vai Vai!",1600,3);
- SetPVarInt(playerid,"DL_DesafiouContagem",-1);
- KillTimer(GetPVarInt(playerid,"DL_DesafiouTimer"));}else
- if(GetPVarInt(playerid,"DL_DesafiouContagem") >=1){
- new MsgTempoDuelo[50];
- format(MsgTempoDuelo,sizeof(MsgTempoDuelo),"~g~%i",GetPVarInt(playerid,"DL_DesafiouContagem"));
- GameTextForPlayer(playerid,MsgTempoDuelo,1000,3);
- SetPVarInt(playerid,"DL_DesafiouContagem",GetPVarInt(playerid,"DL_DesafiouContagem")-1);}
- return 1;
- }
- forward VerificarJogadorNoDuelo(playerid);
- public VerificarJogadorNoDuelo(playerid)
- {
- return GetPVarInt(playerid,"DL_NoDuelo");
- }
- public OnFilterScriptInit()
- {
- print("\n-------------------------------------");
- print(" Sistema de duelo by Guscooby Carregado...");
- print("-------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(GetPVarInt(playerid,"DL_NoDuelo") == 1){
- new Player1 = GetPVarInt(playerid,"DL_DesafiouID");
- new JogadoresDueloNome[2][100],Float:QuantidadeVida,Float:QuantidadeColete;
- GetPlayerName(playerid,JogadoresDueloNome[0],100);
- GetPlayerName(Player1,JogadoresDueloNome[1],100);
- GetPlayerHealth(Player1,QuantidadeVida);
- GetPlayerArmour(Player1,QuantidadeColete);
- new MsgGanhouDuelo[150];
- format(MsgGanhouDuelo,sizeof(MsgGanhouDuelo),"%s Ganhou o 1 vs 1 contra %s e ficou com %f de vida e %f de colete.",JogadoresDueloNome[1],JogadoresDueloNome[0],QuantidadeVida,QuantidadeColete);
- SendClientMessageToAll(0xD15710FF,MsgGanhouDuelo);
- ResetPlayerWeapons(Player1);
- SpawnPlayer(Player1);
- GivePlayerMoney(Player1,GetPVarInt(playerid,"DL_DesafiouAposta"));
- SetPVarInt(Player1,"DL_DesafiouAlguem",0);
- SetPVarInt(Player1,"DL_DesafiouID",-1);
- SetPVarInt(Player1,"DL_DesafiouAposta",0);
- SetPVarInt(Player1,"DL_NoDuelo",0);}
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(GetPVarInt(playerid,"DL_NoDuelo") == 1){
- new Player1 = GetPVarInt(playerid,"DL_DesafiouID");
- new JogadoresDueloNome[2][100],Float:QuantidadeVida,Float:QuantidadeColete;
- GetPlayerName(playerid,JogadoresDueloNome[0],100);
- GetPlayerName(Player1,JogadoresDueloNome[1],100);
- GetPlayerHealth(Player1,QuantidadeVida);
- GetPlayerArmour(Player1,QuantidadeColete);
- new MsgGanhouDuelo[150];
- format(MsgGanhouDuelo,sizeof(MsgGanhouDuelo),"%s Ganhou o 1 vs 1 contra %s e ficou com %f de vida e %f de colete",JogadoresDueloNome[1],JogadoresDueloNome[0],QuantidadeVida,QuantidadeColete);
- SendClientMessageToAll(0xD15710FF,MsgGanhouDuelo);
- ResetPlayerWeapons(Player1);
- SpawnPlayer(Player1);
- ResetPlayerWeapons(playerid);
- SpawnPlayer(playerid);
- SetPVarInt(playerid,"DL_DesafiouAlguem",0);
- SetPVarInt(playerid,"DL_DesafiouID",-1);
- SetPVarInt(playerid,"DL_DesafiouAposta",0);
- SetPVarInt(playerid,"DL_NoDuelo",0);
- GivePlayerMoney(Player1,GetPVarInt(playerid,"DL_DesafiouAposta"));
- SetPVarInt(Player1,"DL_DesafiouAlguem",0);
- SetPVarInt(Player1,"DL_DesafiouID",-1);
- SetPVarInt(Player1,"DL_DesafiouAposta",0);
- SetPVarInt(Player1,"DL_NoDuelo",0);}
- return 1;
- }
- //------------------------------------------------------------------------------
- CMD:duelo(playerid,params[])
- {
- new DL_Apostando,Player1,MsgArmasDuelo[150];
- if(GetPVarInt(playerid,"DL_NoDuelo") == 1)return SendClientMessage(playerid,0xFF0000FF,"ERRO: Você já está em um duelo");
- if(sscanf(params,"ud",Player1,DL_Apostando))return SendClientMessage(playerid,0xFF0000FF,"USAGE: /Duelo [Jogador-ID] [Aposta]");
- if(!IsPlayerConnected(Player1))return SendClientMessage(playerid,0xFF0000FF,"ERRO: Esse jogador não está conectado");{
- if(Player1 == playerid)return SendClientMessage(playerid,0xFF0000FF,"ERRO: Você não pode desafiar você mesmo para um duelo.");
- if(GetPVarInt(Player1,"DL_NoDuelo") == 1)return SendClientMessage(playerid,0xFF0000FF,"ERRO: Esse jogador já está em um Duelo.");
- if(DL_Apostando > GetPlayerMoney(playerid) || DL_Apostando <= 0)return SendClientMessage(playerid,0xFF0000FF,"ERRO: Você não tem todo esse dinheiro para apostar");
- if(DL_Apostando > GetPlayerMoney(Player1))return SendClientMessage(playerid,0xFF0000FF,"ERRO: Esse jogador não tem essa quantidade de dinheiro para apostar");
- if(GetPVarInt(playerid,"DL_DesafiouAlguem") == 1)return SendClientMessage(playerid,0xFF0000FF,"ERRO: Você está esperando a resposta de um desafio");
- SetPVarInt(playerid,"DL_DesafiouAlguem",1);
- SetPVarInt(playerid,"DL_DesafiouID",Player1);
- SetPVarInt(playerid,"DL_DesafiouAposta",DL_Apostando);
- strcat(MsgArmasDuelo,"{00FF00}Deagle\n{00FF00}Shot Gun\n{00FF00}SawnOff Shot Gun\n{00FF00}Combat Shout Gun\n{00FF00}UZI\n{00FF00}MP5\n{00FF00}M4\n{00FF00}Tec9");
- ShowPlayerDialog(playerid,DIALOG_DUELO1,DIALOG_STYLE_LIST,"Duelo Armas 1",MsgArmasDuelo,"Escolher","Cancelar");}
- return 1;
- }
- //------------------------------------------------------------------------------
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_DUELO1){
- if(!response){
- SetPVarInt(playerid,"DL_DesafiouAlguem",0);
- SetPVarInt(playerid,"DL_DesafiouID",-1);}
- if(response){
- new MsgArmasDuelo[150];
- strcat(MsgArmasDuelo,"{00FF00}Mesma Arma\n{00FF00}Deagle\n{00FF00}Shot Gun\n{00FF00}SawnOff Shot Gun\n{00FF00}Combat Shout Gun\n{00FF00}UZI\n{00FF00}MP5\n{00FF00}M4\n{00FF00}Tec9");
- switch (listitem){
- case 0: { SetPVarInt(playerid,"DL_DesafiouArma",24); ShowPlayerDialog(playerid,DIALOG_DUELO2,DIALOG_STYLE_LIST,"Duelo Arma 2",MsgArmasDuelo,"Escolher","Voltar");}
- case 1: { SetPVarInt(playerid,"DL_DesafiouArma",25); ShowPlayerDialog(playerid,DIALOG_DUELO2,DIALOG_STYLE_LIST,"Duelo Arma 2",MsgArmasDuelo,"Escolher","Voltar");}
- case 2: { SetPVarInt(playerid,"DL_DesafiouArma",26); ShowPlayerDialog(playerid,DIALOG_DUELO2,DIALOG_STYLE_LIST,"Duelo Arma 2",MsgArmasDuelo,"Escolher","Voltar");}
- case 3: { SetPVarInt(playerid,"DL_DesafiouArma",27); ShowPlayerDialog(playerid,DIALOG_DUELO2,DIALOG_STYLE_LIST,"Duelo Arma 2",MsgArmasDuelo,"Escolher","Voltar");}
- case 4: { SetPVarInt(playerid,"DL_DesafiouArma",28); ShowPlayerDialog(playerid,DIALOG_DUELO2,DIALOG_STYLE_LIST,"Duelo Arma 2",MsgArmasDuelo,"Escolher","Voltar");}
- case 5: { SetPVarInt(playerid,"DL_DesafiouArma",29); ShowPlayerDialog(playerid,DIALOG_DUELO2,DIALOG_STYLE_LIST,"Duelo Arma 2",MsgArmasDuelo,"Escolher","Voltar");}
- case 6: { SetPVarInt(playerid,"DL_DesafiouArma",31); ShowPlayerDialog(playerid,DIALOG_DUELO2,DIALOG_STYLE_LIST,"Duelo Arma 2",MsgArmasDuelo,"Escolher","Voltar");}
- case 7: { SetPVarInt(playerid,"DL_DesafiouArma",32); ShowPlayerDialog(playerid,DIALOG_DUELO2,DIALOG_STYLE_LIST,"Duelo Arma 2",MsgArmasDuelo,"Escolher","Voltar");}}}}
- if(dialogid == DIALOG_DUELO2){
- if(!response){
- new MsgArmasDuelo[150];
- strcat(MsgArmasDuelo,"{00FF00}Deagle\n{00FF00}Shot Gun\n{00FF00}SawnOff Shot Gun\n{00FF00}Combat Shout Gun\n{00FF00}UZI\n{00FF00}MP5\n{00FF00}M4\n{00FF00}Tec9");
- ShowPlayerDialog(playerid,DIALOG_DUELO1,DIALOG_STYLE_LIST,"Duelo Arma 1",MsgArmasDuelo,"Escolher","Cancelar");}
- if(response){
- switch (listitem){
- case 0: { SetPVarInt(playerid,"DL_DesafiouArma2",GetPVarInt(playerid,"DL_DesafiouArma")); ShowPlayerDialog(playerid,DIALOG_DUELO3,DIALOG_STYLE_LIST,"Duelo Lugar","{00FF00}Estádio\n{00FF00}Vice-Estádio\n{00FF00}Armázem","Escolher","Voltar");}
- case 1: { SetPVarInt(playerid,"DL_DesafiouArma2",24); ShowPlayerDialog(playerid,DIALOG_DUELO3,DIALOG_STYLE_LIST,"Duelo Lugar","{00FF00}Estádio\n{00FF00}Vice-Estádio\n{00FF00}Armázem","Escolher","Voltar");}
- case 2: { SetPVarInt(playerid,"DL_DesafiouArma2",25); ShowPlayerDialog(playerid,DIALOG_DUELO3,DIALOG_STYLE_LIST,"Duelo Lugar","{00FF00}Estádio\n{00FF00}Vice-Estádio\n{00FF00}Armázem","Escolher","Voltar");}
- case 3: { SetPVarInt(playerid,"DL_DesafiouArma2",26); ShowPlayerDialog(playerid,DIALOG_DUELO3,DIALOG_STYLE_LIST,"Duelo Lugar","{00FF00}Estádio\n{00FF00}Vice-Estádio\n{00FF00}Armázem","Escolher","Voltar");}
- case 4: { SetPVarInt(playerid,"DL_DesafiouArma2",27); ShowPlayerDialog(playerid,DIALOG_DUELO3,DIALOG_STYLE_LIST,"Duelo Lugar","{00FF00}Estádio\n{00FF00}Vice-Estádio\n{00FF00}Armázem","Escolher","Voltar");}
- case 5: { SetPVarInt(playerid,"DL_DesafiouArma2",28); ShowPlayerDialog(playerid,DIALOG_DUELO3,DIALOG_STYLE_LIST,"Duelo Lugar","{00FF00}Estádio\n{00FF00}Vice-Estádio\n{00FF00}Armázem","Escolher","Voltar");}
- case 6: { SetPVarInt(playerid,"DL_DesafiouArma2",29); ShowPlayerDialog(playerid,DIALOG_DUELO3,DIALOG_STYLE_LIST,"Duelo Lugar","{00FF00}Estádio\n{00FF00}Vice-Estádio\n{00FF00}Armázem","Escolher","Voltar");}
- case 7: { SetPVarInt(playerid,"DL_DesafiouArma2",31); ShowPlayerDialog(playerid,DIALOG_DUELO3,DIALOG_STYLE_LIST,"Duelo Lugar","{00FF00}Estádio\n{00FF00}Vice-Estádio\n{00FF00}Armázem","Escolher","Voltar");}
- case 8: { SetPVarInt(playerid,"DL_DesafiouArma2",32); ShowPlayerDialog(playerid,DIALOG_DUELO3,DIALOG_STYLE_LIST,"Duelo Lugar","{00FF00}Estádio\n{00FF00}Vice-Estádio\n{00FF00}Armázem","Escolher","Voltar");}}}}
- if(dialogid == DIALOG_DUELO3){
- if(!response){
- new MsgArmasDuelo[150];
- strcat(MsgArmasDuelo,"{00FF00}Mesma Arma\n{00FF00}Deagle\n{00FF00}Shot Gun\n{00FF00}SawnOff Shot Gun\n{00FF00}Combat Shout Gun\n{00FF00}UZI\n{00FF00}MP5\n{00FF00}M4\n{00FF00}Tec9");
- ShowPlayerDialog(playerid,DIALOG_DUELO2,DIALOG_STYLE_LIST,"Duelo Arma 2",MsgArmasDuelo,"Escolher","Voltar");}
- if(response){
- switch (listitem){
- case 0: { SetPVarInt(playerid,"DL_DesafiouLugar",1); P_MandarDuelo(playerid);}
- case 1: { SetPVarInt(playerid,"DL_DesafiouLugar",2); P_MandarDuelo(playerid);}
- case 2: { SetPVarInt(playerid,"DL_DesafiouLugar",3); P_MandarDuelo(playerid);}}}}
- if(dialogid == DIALOG_DUELO4){
- if(!response){
- new Player1 = GetPVarInt(playerid,"DL_DesafiouID");
- SetPVarInt(Player1,"DL_DesafiouAlguem",0);
- SetPVarInt(Player1,"DL_DesafiouID",-1);
- new MsgRejeitarDuelo[100],NomeOutroJogador[50];
- GetPlayerName(playerid,NomeOutroJogador,sizeof(NomeOutroJogador));
- format(MsgRejeitarDuelo,sizeof(MsgRejeitarDuelo),"%s rejected the duel!",NomeOutroJogador);
- SendClientMessage(Player1,0xFF0000FF,MsgRejeitarDuelo);
- SetPVarInt(playerid,"DL_DesafiouAlguem",0);
- SetPVarInt(playerid,"DL_DesafiouID",-1);}
- if(response){
- new Player1 = GetPVarInt(playerid,"DL_DesafiouID");
- if(!IsPlayerConnected(Player1)){
- SendClientMessage(Player1,0xFF0000FF,"ERRO: Esse jogador não está mais disponivel");
- SetPVarInt(playerid,"DL_DesafiouAlguem",0);
- SetPVarInt(playerid,"DL_DesafiouID",-1);
- return 1;}
- if(GetPVarInt(Player1,"DL_NoDuelo") == 1){
- SendClientMessage(Player1,0xFF0000FF,"ERRO: Esse jogador não está mais disponivel");
- SetPVarInt(playerid,"DL_DesafiouAlguem",0);
- SetPVarInt(playerid,"DL_DesafiouID",-1);
- return 1;}
- SetPVarInt(playerid,"DL_DesafiouArma",GetPVarInt(Player1,"DL_DesafiouArma"));
- SetPVarInt(playerid,"DL_DesafiouArma2",GetPVarInt(Player1,"DL_DesafiouArma2"));
- SetPVarInt(playerid,"DL_DesafiouAposta",GetPVarInt(Player1,"DL_DesafiouAposta"));
- SetPVarInt(playerid,"DL_DesafiouLugar",GetPVarInt(Player1,"DL_DesafiouLugar"));
- P_AceitouODuelo(playerid);}}
- return 1;
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement