Ir para conteúdo

Featured Replies

Postado

Olá gostaria de um script tipo Bank...

 

 

funciona assim, ele tem 20 points no site (exemplo)

 

ai tem um npc que troca com ele os 20 points por 20 itens agrupaveis (de minha escolha)

 

ai o player fala assim:

 

Hi

Withdraw

10 (Quantia de points) (Ai sai 10 points no site e fica 10)

yes

 

ai ele fica com 10 items agrupados na bp (Tokens) e pode comercializar com players por items e etc..

 

ai ele vendeu ou nao conseguiu vender os points, ele pode levar devolta para o npc 

 

e fala

 

Hi

Deposit all

 

ou deposit (quantia)

 

yes

 

 

 

ai ele volta a ter 20 points no site,...

 

 

 

 

VALENDO REP+ POR 3 DIAS!!!

 

 

FAST LIGEIRO ESSE SCRIPT GENTE VERSÃO 8.60 MAPA GLOBAL!

Projetos:

Hunted Server: - http://huntedserver.com/

Trabalhos:

Spoiler

Att: Leonardo Simonetto

  • Respostas 5
  • Visualizações 860
  • Created
  • Última resposta

Top Posters In This Topic

Postado
  • Autor

me passe como coloca, aonde coloca tudo certinho... se ´pá o npc...

Projetos:

Hunted Server: - http://huntedserver.com/

Trabalhos:

Spoiler

Att: Leonardo Simonetto

Postado

  Em 24/04/2013 em 00:04, Leonardo Simonetto disse:

Olá gostaria de um script tipo Bank...
 
 
funciona assim, ele tem 20 points no site (exemplo)
 
ai tem um npc que troca com ele os 20 points por 20 itens agrupaveis (de minha escolha)
 
ai o player fala assim:
 
Hi
Withdraw
10 (Quantia de points) (Ai sai 10 points no site e fica 10)
yes
 
ai ele fica com 10 items agrupados na bp (Tokens) e pode comercializar com players por items e etc..
 
ai ele vendeu ou nao conseguiu vender os points, ele pode levar devolta para o npc 
 
e fala
 
Hi
Deposit all
 
ou deposit (quantia)
 
yes
 
 
 
ai ele volta a ter 20 points no site,...
 
 
 
 
VALENDO REP+ POR 3 DIAS!!!
 
 
FAST LIGEIRO ESSE SCRIPT GENTE VERSÃO 8.60 MAPA GLOBAL!

 

Crie um arquivo chamado bankpoints.lua na pasta data/npc/scripts e cole isso dentro

 

function getPlayerPoints(id)
          local query = db.getResult('SELECT premium_points FROM accounts WHERE id = '.. id ..';')
          if query:getID() ~= -1 then
                    return query:getDataInt('premium_points')
          end
          return LUA_ERROR
end
 
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
 
function onCreatureAppear(cid)                          npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)                       npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)                  npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                                      npcHandler:onThink() end
 
local itemCount = 0
local itemToken = 102
 
function creatureSayCallback(cid, type, msg)
 
          if(not npcHandler:isFocused(cid)) then
                    return false
          end
          local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
 
          if msgcontains(msg, 'balance') then
                    npcHandler:say('You have '.. getPlayerPoints(getPlayerGUID(cid) ..' points.', cid)
                    talkState[talkUser] = 0
 
          elseif msgcontains(msg, 'deposit') then
                    npcHandler:say('How many points do you want to deposit?', cid)
                    talkState[talkUser] = 1
 
          elseif talkState[talkUser] == 1 then
                    if not tonumber(msg) or tonumber(msg) < 1 then
                              npcHandler:say('Please tell me how many points you want to deposit?', cid)
                    end
 
                    itemCount = math.abs(tonumber(msg))
                    npcHandler:say('You want to deposit '.. itemCount ..' points?', cid)
                    talkState[talkUser] = 2
 
          elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
                    if getPlayerItemCount(cid, itemToken) >= itemCount then
                              local query = db.executeQuery('UPDATE accounts SET premium_points = premium_points + '.. itemCount ..' WHERE id '.. getPlayerGUID(cid) ..';')
                              if query ~= LUA_ERROR then
                                        npcHandler:say('You deposited '.. itemCount ..' points.', cid)
                                        doPlayerRemoveItem(cid, itemTokens, itemCount)
                                        talkState[talkUser] = 0
                              else
                                        npcHandler:say('Points can not be deposited, please contact a gamemaster.', cid)
                                        error('[Error::Query] '.. query ..', error while trying to add a value into balance.')

                                        talkState[talkUser] = 0
                              end
                    else
                              npcHandler:say('Sorry, you don\'t have the required items', cid)
                              talkState[talkUser] = 0
                    end
 
 
          elseif msgcontains(msg, 'withdraw') then
                    npcHandler:say('How many points do you want to withdraw?', cid)
                    talkState[talkUser] = 3
 
          elseif talkState[talkUser] == 3 then
                    if not tonumber(msg) or tonumber(msg) < 1 then
                              npcHandler:say('Please tell me, how many points you want to withdraw?', cid)
                    end
 
          itemCount = math.abs(tonumber(msg))
          npcHandler:say('You want to cash out '.. itemCount ..' points?', cid)
          talkState[talkUser] = 4
          elseif msgcontains(msg, 'yes') and talkState[talkUser] == 4 then
                    if getPlayerPoints(getPlayerGUID(cid)) >= itemCount then
                              local query = db.executeQuery('UPDATE accounts SET premium_points = (premium_points - '.. itemCount ..') WHERE id = '.. getPlayerGUID(cid) ..';')
                                        if query then
                                                  npcHandler:say('You drew '.. itemCount ..' points.', cid)
                                                  doPlayerAddItem(cid, itemToken, itemCount)
                                                  talkState[talkUser] = 0
                                        else
                                                  npcHandler:say('Money can not be retired, please contact a gamemaster.', cid)
                                                  error('[Error::Query] '.. query ..', error while trying to remove a value from balance.')
                                                  talkState[talkUser] = 0
                                        end
                    else
                              npcHandler:say('Sorry, you don\'t have that amount for withdraw.', cid)
                              talkState[talkUser] = 0
                    end
          end
          return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Configurando

Mostrar conteúdo oculto

 

 

itemToken                              //ID do token que o player irá ganha, aconselho a criar um novo item para que os trokens de points não seja dropado de montros

 

Crie um arquivo chamado Bank Points.xml na pasta data/npc e cole isso dentro

 

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Jhon" script="data/npc/scripts/bankpoints.lua" walkinterval="0" floorchange="0">
         <health now="150" max="150" />
         <look type="129" head="114" body="119" legs="114" feet="114" corpse="2212" />
         <parameters>
                   <parameter key="message_greet" value="Hello |PLAYERNAME|. If you want to see your account balance, say {balance}." />
                   <parameter key="message_walkaway" value="Hey Hey, where you go ?"/>
                   <parameter key="message_farewell" value="Goodbye |PLAYERNAME|!"/>
         </parameter>
</npc>

 

Não testei, caso der erro avise.

Dúvidas? Me avise.

 

@EDIT

Créditos

Eu -- Edição do Script feito pelo SkyDangerous --

Skydangerous -- Script --

 

Att.

Giovani Rodrigo

Editado por GiovaniRodrigo (veja o histórico de edições)

Mostrar conteúdo oculto

 

Postado

Usa um xml simples, como esse:

 
<?xml version="1.0"?>
      <npc name="Hyun" script="BankPoints.lua" floorchange="0" speed="0">
      <health now="150" max="150"/>
      <look type="367" head="79" body="76" legs="49" feet="94" addons="2"/>
</npc>

-"Supra Omnes Lux Lucis"

- Acima de todos brilha a Luz -

5VGnDyBz.png

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo