Tente usar doPlayerAddItem ou doPlayerGiveItem... Nunca mexi com ots dessa versão, talvez não funcione.
flw
info
Grupo: Visconde
Registrado: 03/02/09
Posts: 361
Reputação: +200
Char no Tibia: Fearless Man

Tente usar doPlayerAddItem ou doPlayerGiveItem... Nunca mexi com ots dessa versão, talvez não funcione.
flw
info
Grupo: Marquês
Registrado: 05/05/09
Posts: 1.2k
Reputação: +91

Eita, funcionou! Valeu ![]()
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

pode ser assim tbm não sei...
exemplo:
usando
doPlayerRemoveMoney(cid, quantidade)
elseif msgcontains(msg, '100') then
elseif doPlayerRemoveMoney(cid, 100) == TRUE then
if math.random(1,6) == 6 then
doPlayerAddMoney(cid, 500)
selfSay('Voce ganhou 500gp!')
else
selfSay('Voce perdeu 100gp!')
end
usando doPlayerAddItem(cid, item,quantidade)
e tbm doPlayerRemoveItem(cid,2item,quantidade)
elseif msgcontains(msg, '100') then
elseif doPlayerRemoveItem(cid,2152,100) == TRUE then
if math.random(1,6) == 6 then
doPlayerAddItem(cid, 2152,500)
selfSay('Voce ganhou 500gp!')
else
selfSay('Voce perdeu 100gp!')
end
Editado Setembro 24 por Vodkart
info
Grupo: Marquês
Registrado: 05/05/09
Posts: 1.2k
Reputação: +91
Como uso essa função/comando? (não programo em Lua, xml, sql nem html, mas sei o básico de python e manjo de shell, então entendi como funcionam as funções/comandos (function, then, if, end...)
Para OT 7.6 (xml/lua)
Fiz um NPC de dado (roll). Só que não consigo usar PlayerAddItem nem PlayerRemoveItem pra remover o dinheiro (aposta) do jogador e dar a recompensa caso ele ganhe. Estou usando buy e sell com id de platinum coin, tb funciona mas daí da msg "Here You are" e "thank you for this item" na tela....
Script:
focus = 0 talk_start = 0 target = 0 following = false attacking = false function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Falou...') focus = 0 talk_start = 0 end end function onCreatureTurn(creature) end function msgcontains(txt, str) return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)')) end function onCreatureSay(cid, type, msg) msg = string.lower(msg) if ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 4 then selfSay('Ola ' .. creatureGetName(cid) .. '! Voce pode ganhar 5x o que apsotar! Digite o valor em gps que quer apostar. 100, 1000 ou 5000') focus = cid talk_start = os.clock() elseif string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Perae, ' .. creatureGetName(cid) .. '! Tem alguem jogando.') elseif msgcontains(msg, '100') then sell(cid,2152,1,0) if math.random(1,6) == 6 then buy(cid,2152,5,0) selfSay('Voce ganhou 500gp!') else selfSay('Voce perdeu 100gp!') end elseif msgcontains(msg, '1000') then sell(cid,2152,10,0) if math.random(1,6) == 6 then buy(cid,2152,50,0) selfSay('Voce ganhou 5000gp!') else selfSay('Voce perdeu 1000gp!') end elseif msgcontains(msg, '5000') then sell(cid,2152,50,0) if math.random(1,6) == 6 then buy(cid,2152,250,0) selfSay('Voce ganhou 25000gp!') else selfSay('Voce perdeu 5000gp!') end elseif string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 4 then selfSay('Azar no jogo sorte no amor, ' .. creatureGetName(cid) .. '!', 'NPC Feito por GOD Turcow, do Ze Vampiro OTS. Nick no XTibia = DiogoTemporario') focus = 0 talk_start = 0 end end function onCreatureChangeOutfit(creature) end function onThink() if (os.clock() - talk_start) > 30 then if focus > 0 then selfSay('Proximo...') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Falou...') focus = 0 end end end