shepher

Video Aula 02

Feb 15th, 2014
940
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.12 KB | None | 0 0
  1.  
  2. void TranslateBaseNPCFiles()
  3. {  
  4.     static const int npc_address[36] = {
  5.         0x0413F49, 0x0413F94, 0x0413FF1, 0x041404E,
  6.         0x04140AA, 0x0414107, 0x0414164, 0x04141C0,
  7.         0x041421D, 0x041427A, 0x04142D6, 0x0414333,
  8.         0x0414390, 0x04143EC, 0x0414449, 0x04144A6,
  9.         0x0414502, 0x041455F, 0x04145BC, 0x0414618,
  10.         0x0414675, 0x04146D2, 0x041472E, 0x041478B,
  11.         0x04147E8, 0x0414844, 0x04148AE, 0x041490A,
  12.         0x0414967, 0x04149C4, 0x0414A20, 0x0414A7D,
  13.         0x0414ADA, 0x0414B36, 0x0414B93, 0x0414BF0
  14.     };
  15.  
  16.     static const char* npc_name[37] = {
  17.         "Condor", "Javali", "Lobo", "Urso", "Tigre",
  18.         "Gorila", "Dragao_Negro", "Succubus", "Porco",
  19.         "Javali_", "Lobo_", "Dragao_Menor", "Urso_",
  20.         "Dente_de_Sabre", "Sem_Sela", "Fantasma", "Leve",
  21.         "Equipado", "Andaluz", "Sem_Sela_", "Fantasma_",
  22.         "Leve_", "Equipado_", "Andaluz_", "Fenrir", "Dragao",
  23.         "Grande_Fenrir", "Tigre_de_Fogo", "Dragao_Vermelho",
  24.         "Unicornio", "Pegasus", "Unisus", "Grifo", "Hippo_Grifo",
  25.         "Grifo_Sangrento", "Sleipnir", "Svadilfire"
  26.     };
  27.  
  28.     // Escreve o nome dos arquivos que possuem as
  29.     // informações sobre as montarias e as crias.
  30.     for(int i = 0; i < 36; i++)
  31.         *(int*)(npc_address[i] + 1) = (int)npc_name[i];
  32.     // Modifica a string da pasta das montarias
  33.     strcpy((char*)0x4C0C64, "npc_base");
  34. }
  35.  
  36. // Comando criado
  37.     else if(strcmp(p->eCommand, "goto") == 0)
  38.     {
  39.         static char* szCitys[] = {"armia", "erion", "arzan", "karden", "vip", "deserto"};
  40.         static int szCitysPos[6][2] =
  41.         {
  42.             {2100, 2100},
  43.             {2459, 1990},
  44.             {2496, 1709},
  45.             {3646, 3125},
  46.             {4000, 4000},
  47.             {1200, 1700}
  48.         };
  49.  
  50.         char city[16];
  51.         // city = armia
  52.         int ret = sscanf(p->eValue, "%16s", city);
  53.  
  54.         if(ret != 1)
  55.         {
  56.             SendClientMessage(p->Header.ClientId, "Cidade inexistente");
  57.  
  58.             return;
  59.         }
  60.  
  61.         //goto armia
  62.         // 0
  63.         for(int i = 0; i < 6; i++)
  64.         {
  65.             if(!strcmp(szCitys[i], city))
  66.             {
  67.                 DoTeleport(p->Header.ClientId, szCitysPos[i][0], szCitysPos[i][1]);
  68.  
  69.                 return;
  70.             }
  71.         }
  72.  
  73.         SendClientMessage(p->Header.ClientId, "Cidade inexistente");
  74.     }
Advertisement
Add Comment
Please, Sign In to add comment