Advertisement
BR_Gustavo

Sistema de Luta

Sep 16th, 2018
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 8.68 KB | None | 0 0
  1. #define DIALOG_LUTADUELO                 8175
  2.  
  3. enum lut_inf
  4. {
  5.     Luta_Participando,
  6.     Luta_DesafiadoID,
  7.     Luta_Mandada,
  8.     Luta_Mandaram,
  9.     Luta_AntigoSkin,
  10.     Float:Luta_AntigoX,
  11.     Float:Luta_AntigoY,
  12.     Float:Luta_AntigoZ,
  13.     Luta_AntigoInterior,
  14.     Luta_Aposta,
  15. };
  16.  
  17. new LutaInfo[101][lut_inf];
  18.  
  19. forward P_LutaGanhadorSpawn(playerid);
  20. public P_LutaGanhadorSpawn(playerid)
  21. {
  22.     SetPlayerPos(playerid,LutaInfo[playerid][Luta_AntigoX],LutaInfo[playerid][Luta_AntigoY],LutaInfo[playerid][Luta_AntigoZ]);
  23.     SetPlayerInterior(playerid,LutaInfo[playerid][Luta_AntigoInterior]);
  24.     SetPlayerSkin(playerid,LutaInfo[playerid][Luta_AntigoSkin]);
  25.     return 1;
  26. }
  27.  
  28. /*
  29.     AVISO!!!!!
  30.     !!!!AVISO
  31.     AVISO!!!!
  32.     // Não esqueça de colocar isso em alguma parte do OnPlayerDisconnect ou OnPlayerConnect :V
  33.     // E se quiser bloquear cmds (tipo teleporte) use
  34.     if(LutaInfo[playerid][Luta_Participando] == 1)return SendClientMessage(playerid,red,"ERRO: Você está em um duelo!"):
  35.     O Sistema está todo em PT-BR. Se quiser mude pra inglês.
  36.     LutaInfo[playerid][Luta_Mandada] = 0;
  37.     LutaInfo[playerid][Luta_DesafiadoID] = 0;
  38.     LutaInfo[playerid][Luta_Aposta] = 0;
  39.     LutaInfo[player1][Luta_Mandaram] = 0;
  40.     LutaInfo[player1][Luta_Participando] = 0;
  41.     AVISO!!!!!
  42.     !!!!AVISO
  43.     AVISO!!!!
  44. */
  45. CMD:luta(playerid,params[])
  46. {
  47.     new player1,apostado_luta,MsgDesafioLuta[150];
  48.     if(JogadorNoEvento[playerid] == 1)return SendClientMessage(playerid,red,"ERROR: You can not use this command in the event"); //Evento_Sistema
  49.     if(PlayerInfo[playerid][Jailed] == 1) return SendClientMessage(playerid,COLOR_BRIGHTRED,"You cannot escape your punishment!");
  50.     if(LutaInfo[playerid][Luta_Participando] == 1)return SendClientMessage(playerid,red,"ERRO: Você já está participando de uma luta");
  51.     if(LutaInfo[playerid][Luta_Mandada] == 1)return SendClientMessage(playerid,red,"ERRO: Você mandou recentemente um desafio. Espere que o outro jogador aceite/rejeite");
  52.     if(sscanf(params,"ud",player1,apostado_luta))return SendClientMessage(playerid,red,"USAGE: /Luta [Playerid] [Aposta]");
  53.     if(!IsPlayerConnected(player1))return SendClientMessage(playerid,red,"ERRO: Esse jogador não está conectado!");{
  54.     if(LutaInfo[player1][Luta_Participando] == 1)return SendClientMessage(playerid,red,"ERRO: Esse jogador já está em uma luta e não pode ser desafiado agora");
  55.     if(LutaInfo[player1][Luta_Mandaram] >= 1)return SendClientMessage(playerid,red,"ERRO: Alguém já desafiou esse jogador e está esperando resposta");
  56.     if(apostado_luta <=0 && apostado_luta >=99999)return SendClientMessage(playerid,red,"ERRO: Aposta invalida");
  57.     if(GetPlayerMoney(playerid) < apostado_luta)return SendClientMessage(playerid,red,"ERRO: Você não tem todo esse dinheiro");
  58.     if(GetPlayerMoney(player1) < apostado_luta)return SendClientMessage(playerid,red,"ERRO: Esse jogador não tem todo esse dinheiro");
  59.     LutaInfo[playerid][Luta_Mandada] = 1;
  60.     LutaInfo[playerid][Luta_DesafiadoID] = player1;
  61.     LutaInfo[playerid][Luta_Aposta] = apostado_luta;
  62.     LutaInfo[player1][Luta_Mandaram] = playerid;
  63.     format(MsgDesafioLuta,sizeof(MsgDesafioLuta),"|- Você desafiou \"%s\" para uma luta! espere que ele aceite ou rejeite seu desafio. -|",pName(player1));
  64.     SendClientMessage(playerid,green,MsgDesafioLuta);
  65.     format(MsgDesafioLuta,sizeof(MsgDesafioLuta),"\t{FF0000}Você foi desafiado!\n\n{00BFFF}%s Desafiou você para uma luta!\n{00BFFF}Aposta: %d",pName(playerid),apostado_luta);
  66.     ShowPlayerDialog(player1,DIALOG_LUTADUELO,DIALOG_STYLE_MSGBOX,"{FF0000}Desafio Luta",MsgDesafioLuta,"Aceitar","Rejeitar");}
  67.     return 1;
  68. }
  69.  
  70.  
  71.  
  72. //public OnPlayerDisconnect(playerid,reason)
  73. //{
  74. //
  75.     if(LutaInfo[playerid][Luta_Participando] == 1){
  76.     if(LutaInfo[playerid][Luta_DesafiadoID] >=1){
  77.     if(IsPlayerConnected(LutaInfo[playerid][Luta_DesafiadoID])){
  78.     new player1 = LutaInfo[playerid][Luta_DesafiadoID],MsgGanhadorLuta[100],Float:QuantidadeVida,Float:QuantidadeColete;
  79.     GivePlayerMoney(playerid,LutaInfo[playerid][Luta_Aposta]+LutaInfo[playerid][Luta_Aposta]);
  80.     GetPlayerHealth(player1,QuantidadeVida);
  81.     GetPlayerArmour(player1,QuantidadeColete);
  82.     format(MsgGanhadorLuta,sizeof(MsgGanhadorLuta),"%s(%d) Ganhou a luta contra %s(%d) Vida: %f Colete: %f (Jogador saiu)",pName(player1),player1,pName(playerid),playerid,QuantidadeVida,QuantidadeColete);
  83.     SendClientMessageToAll(green,MsgGanhadorLuta);
  84.     LutaInfo[player1][Luta_Mandada] = 0;
  85.     LutaInfo[player1][Luta_DesafiadoID] = 0;
  86.     LutaInfo[player1][Luta_Aposta] = 0;
  87.     LutaInfo[player1][Luta_Mandaram] = 0;
  88.     LutaInfo[player1][Luta_Participando] = 0;
  89.     SpawnPlayer(player1);
  90.     SetTimerEx("P_LutaGanhadorSpawn",2500,false,"u",player1);}}}
  91. //
  92. //  return 1;
  93. //}
  94.  
  95. //public OnPlayerDeath(playerid, killerid, reason)
  96. //{
  97. //
  98.     if(LutaInfo[playerid][Luta_Participando] == 1){
  99.     if(LutaInfo[playerid][Luta_DesafiadoID] >=1){
  100.     if(IsPlayerConnected(LutaInfo[playerid][Luta_DesafiadoID])){
  101.     new player1 = LutaInfo[playerid][Luta_DesafiadoID],MsgGanhadorLuta[100],Float:QuantidadeVida,Float:QuantidadeColete;
  102.     GivePlayerMoney(playerid,LutaInfo[playerid][Luta_Aposta]+LutaInfo[playerid][Luta_Aposta]);
  103.     GetPlayerHealth(player1,QuantidadeVida);
  104.     GetPlayerArmour(player1,QuantidadeColete);
  105.     format(MsgGanhadorLuta,sizeof(MsgGanhadorLuta),"%s(%d) Ganhou a luta contra %s(%d) Vida: %f Colete: %f",pName(player1),player1,pName(playerid),playerid,QuantidadeVida,QuantidadeColete);
  106.     SendClientMessageToAll(green,MsgGanhadorLuta);
  107.     LutaInfo[player1][Luta_Mandada] = 0;
  108.     LutaInfo[player1][Luta_DesafiadoID] = 0;
  109.     LutaInfo[player1][Luta_Aposta] = 0;
  110.     LutaInfo[player1][Luta_Mandaram] = 0;
  111.     LutaInfo[player1][Luta_Participando] = 0;
  112.     SpawnPlayer(player1);
  113.     LutaInfo[playerid][Luta_Mandada] = 0;
  114.     LutaInfo[playerid][Luta_DesafiadoID] = 0;
  115.     LutaInfo[playerid][Luta_Aposta] = 0;
  116.     LutaInfo[playerid][Luta_Mandaram] = 0;
  117.     LutaInfo[playerid][Luta_Participando] = 0;
  118.     SpawnPlayer(playerid);
  119.     SetTimerEx("P_LutaGanhadorSpawn",2500,false,"u",player1);
  120.     SetTimerEx("P_LutaGanhadorSpawn",2500,false,"u",playerid);}}}
  121. //
  122. //  return 1;
  123. //}
  124.  
  125.  
  126. //public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  127. //{
  128.  
  129.     if(dialogid == DIALOG_LUTADUELO){
  130.     if(!response){
  131.     new MsgRejeitouLuta[100],player1 = LutaInfo[playerid][Luta_Mandaram];
  132.     format(MsgRejeitouLuta,sizeof(MsgRejeitouLuta),"%s Rejeitou o seu desafio",pName(playerid));
  133.     SendClientMessage(player1,red,MsgRejeitouLuta);
  134.     LutaInfo[player1][Luta_Mandada] = 0;
  135.     LutaInfo[player1][Luta_DesafiadoID] = 0;
  136.     LutaInfo[player1][Luta_Aposta] = 0;
  137.     LutaInfo[playerid][Luta_Mandaram] = 0;}
  138.     if(response){
  139.     new MsgAceitouLuta[150],player1 = LutaInfo[playerid][Luta_Mandaram];
  140.     if(!IsPlayerConnected(player1)){
  141.     SendClientMessage(playerid,red,"Infelizmente esse jogador não está mais conectado");
  142.     LutaInfo[playerid][Luta_Mandaram] = 0;}else
  143.     if(IsPlayerConnected(player1)){
  144.     LutaInfo[playerid][Luta_AntigoSkin] = GetPlayerSkin(playerid);
  145.     LutaInfo[player1][Luta_AntigoSkin] = GetPlayerSkin(player1);
  146.     GetPlayerPos(playerid,LutaInfo[playerid][Luta_AntigoX],LutaInfo[playerid][Luta_AntigoY],LutaInfo[playerid][Luta_AntigoZ]);
  147.     GetPlayerPos(player1,LutaInfo[player1][Luta_AntigoX],LutaInfo[player1][Luta_AntigoY],LutaInfo[player1][Luta_AntigoZ]);
  148.     LutaInfo[playerid][Luta_AntigoInterior] = GetPlayerInterior(playerid);
  149.     LutaInfo[player1][Luta_AntigoInterior] = GetPlayerInterior(player1);
  150.     LutaInfo[player1][Luta_Mandada] = 0;
  151.     LutaInfo[playerid][Luta_Mandada] = 0;
  152.     LutaInfo[playerid][Luta_DesafiadoID] = player1;
  153.     LutaInfo[playerid][Luta_Aposta] = LutaInfo[player1][Luta_Aposta];
  154.     LutaInfo[playerid][Luta_Participando] = 1;
  155.     LutaInfo[player1][Luta_Participando] = 1;
  156.     format(MsgAceitouLuta,sizeof(MsgAceitouLuta),"|- Luta iniciada entre \"%s\" e \"%s\" [Aposta: %d]",pName(playerid),pName(player1),LutaInfo[playerid][Luta_Aposta]);
  157.     SendClientMessageToAll(green,MsgAceitouLuta);
  158.     ResetPlayerWeapons(playerid);
  159.     ResetPlayerWeapons(player1);
  160.     SetPlayerHealth(playerid,100);
  161.     SetPlayerHealth(player1,100);
  162.     SetPlayerArmour(playerid,100);
  163.     SetPlayerArmour(player1,100);
  164.     SetPlayerVirtualWorld(playerid,playerid);
  165.     SetPlayerVirtualWorld(player1,playerid);
  166.     PlayerInfo[playerid][God] = 0;
  167.     PlayerInfo[player1][God] = 0;
  168.     StopFly(playerid);
  169.     RemovePlayerAttachedObject(playerid, 3);
  170.     RemovePlayerAttachedObject(playerid, 2);
  171.     RemovePlayerAttachedObject(playerid, 1);
  172.     RemovePlayerAttachedObject(playerid, 0);
  173.     StopFly(player1);
  174.     RemovePlayerAttachedObject(player1, 3);
  175.     RemovePlayerAttachedObject(player1, 2);
  176.     RemovePlayerAttachedObject(player1, 1);
  177.     RemovePlayerAttachedObject(player1, 0);
  178.     SetPlayerPos(playerid,762.900207,8.991699,1001.163940);
  179.     SetPlayerInterior(playerid,5);
  180.     SetPlayerPos(player1,758.525268,13.338879,1001.163940);
  181.     SetPlayerInterior(player1,5);
  182.        }}}
  183. //
  184.  
  185. //  return 1;
  186.  
  187. //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement