Advertisement
Jefersonmsf

Evento 1vs1 [ZCMD + SSCANF]

Nov 29th, 2015
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.76 KB | None | 0 0
  1. // Sistema idealizado e criado por Jeferson
  2.  
  3. #include <a_samp>
  4. #include <sscanf2>
  5. #include <zcmd>
  6.  
  7. // Variaves
  8. new id1,
  9.     id2,
  10.     Tempox1 = 3,
  11.     bool:Tendox1,
  12.     bool:TaNoX1[MAX_PLAYERS];
  13.  
  14. // Cores
  15. #define COR_JEFF                0xFF0000FF
  16. #define COR_JEFF2              0xBFC0C2FF
  17. #define COR_JEFF3              0xFF0000AA
  18.  
  19. public OnFilterScriptInit()
  20. {
  21.     print("\n----------------------------------------");
  22.     print(" Evento One vs One | By: Queen");
  23.     print("          Carregado com sucesso!");
  24.     print("-----------------------------------------\n");
  25.     return 1;
  26. }
  27.  
  28. public OnFilterScriptExit()
  29. {
  30.     print("\n----------------------------------------");
  31.     print(" Evento One vs One | By: Queen");
  32.     print("          Desligado com sucesso!");
  33.     print("-----------------------------------------\n");
  34.     return 1;
  35. }
  36.  
  37. public OnPlayerDeath(playerid, killerid, reason)
  38. {
  39.     new string[128];
  40.  
  41.     if(TaNoX1[playerid])
  42.     {
  43.         if(id1 == killerid)
  44.         {
  45.             format(string, sizeof(string), "[One vs One]: {00FFFF}%s {FFFFFF}Ganhou o x1 contra o {00FFFF}%s!", Nome(id1), Nome(id2));
  46.             SendClientMessageToAll(COR_JEFF, string);
  47.         }
  48.         else if(id2 == killerid)
  49.         {
  50.             format(string, sizeof(string), "[One vs One]: {00FFFF}%s {FFFFFF}Ganhou o x1 contra o {00FFFF}%s!", Nome(id2), Nome(id1));
  51.             SendClientMessageToAll(COR_JEFF, string);
  52.         }
  53.         TaNoX1[id1] =
  54.         TaNoX1[id2] =
  55.         Tendox1 = false;
  56.     }
  57.     return 1;
  58. }
  59.  
  60. forward DescongelarJeff();
  61. public DescongelarJeff()
  62. {
  63.     new string[126];
  64.     if(Tempox1 == 0)
  65.     {
  66.         format(string, sizeof(string),"%d", Tempox1);
  67.         GameTextForPlayer(id1,"~g~Go Go Go!", 1000, 6);
  68.         GameTextForPlayer(id2,"~g~Go Go Go!", 1000, 6);
  69.         TogglePlayerControllable(id1, 1);
  70.         TogglePlayerControllable(id2, 1);
  71.         Tempox1 = 3;
  72.     }
  73.     else
  74.     {
  75.         format(StrJEFF, sizeof(StrJEFF),"%d", Tempox1);
  76.         GameTextForPlayer(id1, StrJEFF, 1000, 6);
  77.         GameTextForPlayer(id2, StrJEFF, 1000, 6);
  78.         SetTimer("DescongelarJeff", 1000, 0);
  79.         Tempox1--;
  80.      }
  81.      return true;
  82. }
  83.  
  84. CMD:x1(playerid,params[])
  85. {
  86.     new string[128];
  87.     if(sscanf(params, "uu", id1, id2))
  88.         return SendClientMessage(playerid, COR_JEFF2, "[Uso]: /x1 [id1] [id2]");
  89.  
  90.     if(!IsPlayerConnected(id1))
  91.         return SendClientMessage(playerid, COR_JEFF3, "[Erro]: Player 1 não está conectado!");
  92.  
  93.     if(!IsPlayerConnected(id2))
  94.         return SendClientMessage(playerid, COR_JEFF3, "[Erro]: Player 2 não está conectado!");
  95.  
  96.     if(Tendox1)
  97.         return SendClientMessage(playerid, -1, "[Erro]: O 'one vs one' já começou, espere acabar para começar outro!");
  98.  
  99.     if(!IsPlayerAdmin(playerid))
  100.         return SendClientMessage(playerid, COR_JEFF2, "[Erro]: Você não é um admin logado na RCON");
  101.  
  102.     SetPlayerPos(id1, 1414.1641,-20.2892,1000.9251);
  103.     SetPlayerPos(id2, 1362.8082,-20.4927,1000.9219);
  104.     SetPlayerInterior(id1, 1);
  105.     SetPlayerInterior(id2, 1);
  106.     SetPlayerHealth(id1, 100);
  107.     SetPlayerHealth(id2, 100);
  108.     SetPlayerArmour(id1, 100);
  109.     SetPlayerArmour(id2, 100);
  110.     GivePlayerWeapon(id1, 24, 999);
  111.     GivePlayerWeapon(id2, 24, 999);
  112.     GivePlayerWeapon(id1, 25, 999);
  113.     GivePlayerWeapon(id2, 25, 999);
  114.     TaNoX1[id1] =
  115.     TaNoX1[id2] =
  116.     Tendox1 = true;
  117.  
  118.     format(string, sizeof(string), "[One vs One]: {00FFFF}%s {FFFFFF}vs {00FFFF}%s", Nome(id1), Nome(id2));
  119.     SendClientMessageToAll(COR_JEFF, string);
  120.  
  121.     TogglePlayerControllable(id1, 0);
  122.     TogglePlayerControllable(id2, 0);
  123.     DescongelarJeff();
  124.     return 1;
  125. }
  126.  
  127. Nome(playerid)
  128. {
  129.     new nome[24];
  130.     GetPlayerName(playerid, nome, 24);
  131.     return nome;
  132. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement