Advertisement
JonathanFeitosa2

[PAWN]jCriador de GangZone v1.0

Feb 12th, 2015
3,222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.12 KB | None | 0 0
  1. // Criado Por Jonathan Feitosa
  2. // Dia: 12/02/2015
  3.  
  4. #include <a_samp>
  5. #include <zcmd>
  6.  
  7. #define MAX_GZ 10
  8.  
  9. new
  10.     _@jGZ[MAX_GZ],
  11.     _@jGZTwo,
  12.     Float:_@getC[9],
  13.     bool:Variavel[2],
  14.     jStr[120],
  15.     StringJFS[120],
  16.     jStrTwo[120],
  17.     __jC
  18. ;
  19.  
  20. public OnFilterScriptInit()
  21.     return print("\n\nCriador de GZ - Carregado\nMesmo se estivesse bugado ia carregar. '-'\n\n");
  22.  
  23. public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
  24. {
  25.     if(Variavel[0])
  26.     {
  27.         ++__jC;
  28.         _@getC[2] = fX;
  29.         _@getC[3] = fY;
  30.        
  31.         if(_@getC[0] > _@getC[2] && _@getC[1] > _@getC[3])
  32.             _@jGZ[__jC] = GangZoneCreate(_@getC[2], _@getC[3], _@getC[0], _@getC[1]),
  33.                 format(jStr, sizeof jStr, "GangZoneCreate(%f, %f, %f, %f);", _@getC[2], _@getC[3], _@getC[0], _@getC[1]);
  34.         else if(_@getC[0] < _@getC[2] && _@getC[1] > _@getC[3])
  35.             _@jGZ[__jC] = GangZoneCreate(_@getC[0], _@getC[3], _@getC[2], _@getC[1]),
  36.                 format(jStr, sizeof jStr, "GangZoneCreate(%f, %f, %f, %f);", _@getC[0], _@getC[3], _@getC[2], _@getC[1]);
  37.         else if(_@getC[0] > _@getC[2] && _@getC[1] < _@getC[3])
  38.             _@jGZ[__jC] = GangZoneCreate(_@getC[2], _@getC[1], _@getC[0], _@getC[3]),
  39.                 format(jStr, sizeof jStr, "GangZoneCreate(%f, %f, %f, %f);", _@getC[2], _@getC[1], _@getC[0], _@getC[3]);
  40.         else if(_@getC[0] < _@getC[2] && _@getC[1] < _@getC[3])
  41.             _@jGZ[__jC] = GangZoneCreate(_@getC[0], _@getC[1], _@getC[2], _@getC[3]),
  42.                 format(jStr, sizeof jStr, "GangZoneCreate(%f, %f, %f, %f);", _@getC[0], _@getC[1], _@getC[2], _@getC[3]);
  43.        
  44.         new File:Arquivo = fopen("jGangZone.txt", io_append);
  45.         format(StringJFS, sizeof (StringJFS), "\n\njCriador GZ - Por Click Map:\n%s\n", jStr);
  46.         fwrite(Arquivo, StringJFS);
  47.         fclose(Arquivo);
  48.         GangZoneShowForPlayer(playerid, _@jGZ[__jC], 0xFFFF0096);
  49.         Variavel[0] = false;
  50.     }
  51.     else
  52.          _@getC[0] = fX, _@getC[1] = fY, Variavel[0] = true;
  53.     return true;
  54. }
  55.  
  56. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  57. {
  58.     if(dialogid == 6579)
  59.     {
  60.         if(!response) return true;
  61.         switch(listitem)
  62.         {
  63.                 case 0:
  64.                 {
  65.                     if(Variavel[1]) return SendClientMessage(playerid, -1, "ERRO: Você já usou essa coordenada. Casso errou, use a opção Limpar.");
  66.                     GetPlayerPos(playerid, _@getC[4], _@getC[6], _@getC[8]);
  67.                     Variavel[1] = true;
  68.                 }
  69.                 case 1: {
  70.                
  71.                     if(!Variavel[1]) return SendClientMessage(playerid, -1, "ERRO: Você precisa da primeira coordenada!");
  72.  
  73.                     GetPlayerPos(playerid, _@getC[5], _@getC[7], _@getC[8]);
  74.                    
  75.                     SendClientMessage(playerid, -1, "PARABÉNS: Você conseguiu pegar a segunda coordenada. Visualize no Mapa.");
  76.  
  77.                     if(_@getC[4] > _@getC[5] && _@getC[6] > _@getC[7])
  78.                         _@jGZTwo = GangZoneCreate(_@getC[5], _@getC[7], _@getC[4], _@getC[6]),
  79.                             format(jStrTwo, sizeof jStrTwo, "GangZoneCreate(%f, %f, %f, %f);", _@getC[5], _@getC[7], _@getC[4], _@getC[6]);
  80.                     else if(_@getC[4] < _@getC[5] && _@getC[6] > _@getC[7])
  81.                         _@jGZTwo = GangZoneCreate(_@getC[4], _@getC[7], _@getC[5], _@getC[6]),
  82.                             format(jStrTwo, sizeof jStrTwo, "GangZoneCreate(%f, %f, %f, %f);", _@getC[4], _@getC[7], _@getC[5], _@getC[6]);
  83.                     else if(_@getC[4] > _@getC[5] && _@getC[6] < _@getC[7])
  84.                         _@jGZTwo = GangZoneCreate(_@getC[5], _@getC[6], _@getC[4], _@getC[7]),
  85.                             format(jStrTwo, sizeof jStrTwo, "GangZoneCreate(%f, %f, %f, %f);", _@getC[5], _@getC[6], _@getC[4], _@getC[7]);
  86.                     else if(_@getC[4] < _@getC[5] && _@getC[6] < _@getC[7])
  87.                         _@jGZTwo = GangZoneCreate(_@getC[4], _@getC[6], _@getC[5], _@getC[7]),
  88.                             format(jStrTwo, sizeof jStrTwo, "GangZoneCreate(%f, %f, %f, %f);", _@getC[4], _@getC[6], _@getC[5], _@getC[7]);
  89.  
  90.                     GangZoneShowForPlayer(playerid, _@jGZTwo, 0xFFFF0096);
  91.                 }
  92.                 case 2:
  93.                 {
  94.                     new File:Arquivo = fopen("jGangZone.txt", io_append);
  95.                     format(StringJFS, sizeof (StringJFS), "\n\njCriador GZ - Por Dialog CMD:\n%s\n", jStrTwo);
  96.                     fwrite(Arquivo, StringJFS);
  97.                     fclose(Arquivo);
  98.                     SendClientMessage(playerid, -1, "PARABÉNS: GangZone Salva com Sucesso!");
  99.                 }
  100.                 case 3:
  101.                 {
  102.                     SendClientMessage(playerid, -1, "PARABÉNS: Sistema Limpo com Sucesso!");
  103.                     Variavel[1] = false;
  104.                     GangZoneDestroy(_@jGZTwo);
  105.                 }
  106.         }
  107.         return true;
  108.     }
  109.     return false;
  110. }
  111.  
  112. command(criargz, playerid, params[])
  113.     return
  114.         ShowPlayerDialog(playerid, 6579, DIALOG_STYLE_LIST, "Criador de GZ", "Coordenada I\nCoordenada II\nSalvar\nLimpar", "Selecionar", "Sair");
  115.  
  116. command(limparclickmap, playerid, params[]) {
  117.     for(new i; i < MAX_GZ; i++) GangZoneDestroy(_@jGZ[i]);
  118.     Variavel[0] = false, __jC = 0, SendClientMessage(playerid, -1, "PARABÉNS: Sistema Limpo com Sucesso!");
  119.     return true;
  120. }
  121.  
  122. command(lultimoclickmap, playerid, params[])
  123.     return
  124.         GangZoneDestroy(_@jGZ[__jC]), Variavel[0] = false, --__jC, SendClientMessage(playerid, -1, "PARABÉNS: Sistema Limpo com Sucesso!");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement