[Source C+]NPC Troca dando Item Aleatório
Página 1 de 1
[Source C+]NPC Troca dando Item Aleatório
[Source C+]NPC Troca dando Item Aleatório
<blockquote class="postcontent restore ">
Olá galera,
bom, esse é uma source pra fazer um NPC igual o Br que pode entregar um item dentre os configurados:
Código PHP:
int numero*
getchar()*
case 13: // Guarda Real 1
stream = fopen("Guarda_1.csv", "r")* // LE O ARQUIVO
while ((fscanf(stream, "%[^\n]", line)) != EOF)
**
fgetc(stream)*
int Entregue1,Entregue2,Recebe, Recebe2, Recebe3*
sscanf(line, "%d,%d,%d,%d,%d", &Entregue1, &Entregue2,&Recebe, &Recebe2, &Recebe3)*
if ((cSlot1 == Entregue1) && (cSlot2 == Entregue2)) //Condicional se possui osi tens
**
srand(time(NULL))* // "desbuga" o rand
numero = rand() % 3* // gera o aleatório
printf("%dn", numero)*
PInt(addr_bclient + 0x15C6A94) = 0* // Zera o slot 1
PInt(addr_bclient + 0x15C6A9C) = 0* // Zera o slot 2
if(numero==0) // Se for 0
**
PInt(addr_bclient + 0x15C6A94) = Recebe* // Entrega o item 1
SendClientMessage(clientid, "Trocado - 0")* // Trocado
DC(clientid)* // DC
**
if(numero==1) //Se for 1
**
PInt(addr_bclient + 0x15C6A94) = Recebe2* //Entrega o item 2
SendClientMessage(clientid, "Trocado - 1")* // Trocado
DC(clientid)* // DC
**
if(numero==2) //Se for 2
**
PInt(addr_bclient + 0x15C6A94) = Recebe3* // Entrega o item 3
SendClientMessage(clientid, "Trocado - 2")* // Trocado
DC(clientid)* // DC
**
**
else //Se não possuir os itens
**
SendChat(npcid, "Trouxe os itens?")* // Mensagem
**
**
(substitua os * por ponto e vírgula e os ** por chaves)
No CSV ficaria assim
Código PHP:
#ItemPedido1,ItemPedido2,Recebe1,Recebe2,Recebe3
1760, 1761, 1555, 1554, 1553
(botei qualquer ID)
Sendo os recebe, cada item que tem chance de ganhar.
PS: Não gera números pseudo-aleatórios
PS²: Terá que usar o comando de DC do TheHouse
Como sabem, é um aleatório. Ou seja, você tem a chance de vir os mesmos
itens... Então, se vier muito dos mesmos itens, tá normal. Já testei
diversas vezes e estava funcinando dando os três itens.
By: Shepher
Agradecimento: TheLhent por me dar um suporte no msn O:
The House Pelo comando de DC (:
OBS: Use na TMSRV Do Pedruka (ou algo assim, nao lembro o nome)
Bugs? Comente
</blockquote>
<blockquote class="postcontent restore ">
Olá galera,
bom, esse é uma source pra fazer um NPC igual o Br que pode entregar um item dentre os configurados:
Código PHP:
int numero*
getchar()*
case 13: // Guarda Real 1
stream = fopen("Guarda_1.csv", "r")* // LE O ARQUIVO
while ((fscanf(stream, "%[^\n]", line)) != EOF)
**
fgetc(stream)*
int Entregue1,Entregue2,Recebe, Recebe2, Recebe3*
sscanf(line, "%d,%d,%d,%d,%d", &Entregue1, &Entregue2,&Recebe, &Recebe2, &Recebe3)*
if ((cSlot1 == Entregue1) && (cSlot2 == Entregue2)) //Condicional se possui osi tens
**
srand(time(NULL))* // "desbuga" o rand
numero = rand() % 3* // gera o aleatório
printf("%dn", numero)*
PInt(addr_bclient + 0x15C6A94) = 0* // Zera o slot 1
PInt(addr_bclient + 0x15C6A9C) = 0* // Zera o slot 2
if(numero==0) // Se for 0
**
PInt(addr_bclient + 0x15C6A94) = Recebe* // Entrega o item 1
SendClientMessage(clientid, "Trocado - 0")* // Trocado
DC(clientid)* // DC
**
if(numero==1) //Se for 1
**
PInt(addr_bclient + 0x15C6A94) = Recebe2* //Entrega o item 2
SendClientMessage(clientid, "Trocado - 1")* // Trocado
DC(clientid)* // DC
**
if(numero==2) //Se for 2
**
PInt(addr_bclient + 0x15C6A94) = Recebe3* // Entrega o item 3
SendClientMessage(clientid, "Trocado - 2")* // Trocado
DC(clientid)* // DC
**
**
else //Se não possuir os itens
**
SendChat(npcid, "Trouxe os itens?")* // Mensagem
**
**
(substitua os * por ponto e vírgula e os ** por chaves)
No CSV ficaria assim
Código PHP:
#ItemPedido1,ItemPedido2,Recebe1,Recebe2,Recebe3
1760, 1761, 1555, 1554, 1553
(botei qualquer ID)
Sendo os recebe, cada item que tem chance de ganhar.
PS: Não gera números pseudo-aleatórios
PS²: Terá que usar o comando de DC do TheHouse
Como sabem, é um aleatório. Ou seja, você tem a chance de vir os mesmos
itens... Então, se vier muito dos mesmos itens, tá normal. Já testei
diversas vezes e estava funcinando dando os três itens.
By: Shepher
Agradecimento: TheLhent por me dar um suporte no msn O:
The House Pelo comando de DC (:
OBS: Use na TMSRV Do Pedruka (ou algo assim, nao lembro o nome)
Bugs? Comente
</blockquote>
Tópicos semelhantes
» NPC Troca em C++[Dll Petruka]
» [EXCLUSIVO] Nova DLL Arch In-Game & NPC Troca
» [EXCLUSIVO] Nova DLL via source Petruka
» [EXCLUSIVO] Nova DLL Arch In-Game & NPC Troca
» [EXCLUSIVO] Nova DLL via source Petruka
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
|
|