Advertisement
Guest User

WYD - NPC de Troca Aleatório

a guest
Dec 27th, 2010
711
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.28 KB | None | 0 0
  1. int numero;
  2. getchar();
  3.         case 13: // Guarda Real 1
  4.         {
  5.             stream = fopen("Guarda_1.csv", "r"); // LE O ARQUIVO
  6.             while ((fscanf(stream, "%[^\n]", line)) != EOF)
  7.             {
  8.                 fgetc(stream);
  9.                 int Entregue1,Entregue2,Recebe, Recebe2, Recebe3;
  10.                 sscanf(line, "%d,%d,%d,%d,%d", &Entregue1, &Entregue2,&Recebe, &Recebe2, &Recebe3);
  11.                 if ((cSlot1 == Entregue1) && (cSlot2 == Entregue2)) //Condicional se possui osi tens
  12.                 {
  13.                 srand(time(NULL)); // "desbuga" o rand
  14.                 numero = rand() % 3; // gera o aleatório
  15.                 printf("%dn", numero);
  16.                     PInt(addr_bclient + 0x15C6A94) = 0; // Zera o slot 1
  17.                     PInt(addr_bclient + 0x15C6A9C) = 0; // Zera o slot 2
  18.                         if(numero==0) // Se for 0
  19.                         {
  20.                         PInt(addr_bclient + 0x15C6A94) = Recebe; // Entrega o item 1
  21.                         SendClientMessage(clientid, "Trocado - 0"); // Trocado
  22.                         SendStats(clientid);
  23.                         fclose(stream);
  24.                         DC(clientid);
  25.                         }
  26.                         if(numero==1) //Se for 1
  27.                         {
  28.                         PInt(addr_bclient + 0x15C6A94) = Recebe2; //Entrega o item 2
  29.                         SendClientMessage(clientid, "Trocado - 1"); // Trocado
  30.                         SendStats(clientid);
  31.                         fclose(stream);
  32.                         DC(clientid);
  33.                         }
  34.                         if(numero==2) //Se for 2
  35.                         {
  36.                         PInt(addr_bclient + 0x15C6A94) = Recebe3; // Entrega o item 3
  37.                         SendClientMessage(clientid, "Trocado - 2"); // Trocado
  38.                         SendStats(clientid);
  39.                         DC(clientid);
  40.                         fclose(stream);
  41.                         }
  42.                        }
  43.                     else //Se não possuir os itens
  44.                         {
  45.                         SendChat(npcid, "Trouxe os itens?"); // Mensagem
  46.                         }
  47.                     }
  48.                     fclose(stream);
  49.                     return;
  50.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement