
GstavoLiber
Membro
-
Registro em
-
Última visita
Histórico de Curtidas
-
GstavoLiber recebeu reputação de Baned em Alavanca de apostaPode ser em uma alavanca ??
Ou voce prefere talkation ?
Explica ai.
@EDIT
Bom, se for tipo numa alavanca, eu fiz um codigo simples aqui, e deve resolver.
local config = { [0] = { item = 2160 , count = 10 } , [1] = { item = 2160 , count = 10 } , [2] = { item = 2160 , count = 10 } , [3] = { item = 2160 , count = 10 } , [4] = { removeItem = 2160 , count = 1 } } function onUse(cid, item, frompos, item2, topos) if(doPlayerRemoveItem(cid, config[4].removeItem, config[4].count)) then doPlayerSendTextMessage(cid,22,"Aposta realizada! Aguarde o resultado!") local sort = config[math.random(0, #config -1)] doPlayerAddItem(uid, config[sort].item, config[sort].count) else doPlayerSendTextMessage(cid,22,"Você não possui dinheiro suficiente para fazer a aposta!") end return true end Só mudar os ID dos items, e a quantidade que vai ganhar, e o id e qnt do item que vai retirar do player.
Depois, adicionar action id na alavanca no RME e adicionar uma linha no actions.xml.
Essas apostas podem ser feitas várias vezes. E é muito simples.
Se possível +REP
-GstavoLiber
-
GstavoLiber recebeu reputação de narazaky em Pedido Comando de Dar MontariaCara, não sei se vai funcionar, mas eu fiz aqui correndo...
Seguinte, cria um novo .lua em talkations/scripts e add:
function onSay(cid, words, param, param2) if(words == "/addmount") then if getPlayerAccess(cid) == 5 then local t = string.explode(param, ",") if not t[2] then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.") end local player = getPlayerByName(t[1]) local name = getCreatureName(player) local pid = getPlayerByNameWildcard(t[1]) if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.") return TRUE end local storageplayer = getPlayerStorageValue(player, mount2.str) if(storageplayer >= 1) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player already have this mount.") elseif(storageplayer <= 0) then doPlayerAddMount(cid, mount2.id) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(pid) .. " has received the mount ") setPlayerStorageValue(player, mount2.str, 1) end end end end no talkations.xml adicione:
<talkaction words="/addmount" event="script" value="addmount.lua"/> Mude apenas o nome do arquivo.
Para utilizar in game, escreva:
/addmount nomeDoPlayer IDdaMount
Agora, para funcionar deverá modificar o código do link que nosso amigo xWhiteWolf acima o enviou... mudando o código para:
local montConfig = { ['widow queen'] = {item = xx, id = 1, str = 2001}, ['racing bird'] = {item = xx, id = 2, str = 2002}, ['war bear'] = {item = xx, id = 3, str = 2003}, ['black sheep'] = {item = xx, id = 4, str = 2004}, ['midnight panther'] = {item = xx, id = 5, str = 2005}, ['draptor'] = {item = xx, id = 6, str = 2006}, ['titanica'] = {item = xx, id = 7, str = 2007}, ['tin lizard'] = {item = xx, id = 8, str = 2008}, ['blazebringer'] = {item = xx, id = 9, str = 2009}, ['rapid boar'] = {item = xx, id = 10, str = 2010}, ['stampor'] = {item = xx, id = 11, str = 2011}, ['undead cavebear'] = {item = xx, id = 12, str = 2012} } local xx = 3954 --- id do item function onSay(cid, words, param) if(param == '') then local str = "" for name, options in pairs(montConfig) do str = str .. "\n" .. name end doPlayerPopupFYI(cid, "List of mounts:\n\n" .. str) return true end local mount = montConfig[param] if(mount ~= nil) then if doPlayerRemoveItem(cid,mount.item,1) then doPlayerSendCancel(cid, "Sorry, you dont have a mont doll for buy this mont " .. param .. "") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) return true end doPlayerAddMount(cid, mount.id) doPlayerRemoveItem(cid, xx,1) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS) else doPlayerSendCancel(cid, "The mount not found in list. Please use '!mount' to see the mounts list.") end return true end Note que apenas adicionei str = valor em cada linha, mude os numeros 2001,2002 até 2012 para numeros de storage válidos em seu servidor.
Feito isso, salve e reinicie seu servidor.
Agora é só utilizar. Posta ai se funcionou =)
Se possível, +REP
-GstavoLiber
-
GstavoLiber deu reputação a Nogard em PEDIDO - Programa para criar Scriptshttp://www.tibiaking.com/forum/topic/2152-otscript-live-v04113/
-
GstavoLiber recebeu reputação de xWhiteWolf em Pedido Comando de Dar MontariaCara, não sei se vai funcionar, mas eu fiz aqui correndo...
Seguinte, cria um novo .lua em talkations/scripts e add:
function onSay(cid, words, param, param2) if(words == "/addmount") then if getPlayerAccess(cid) == 5 then local t = string.explode(param, ",") if not t[2] then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.") end local player = getPlayerByName(t[1]) local name = getCreatureName(player) local pid = getPlayerByNameWildcard(t[1]) if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.") return TRUE end local storageplayer = getPlayerStorageValue(player, mount2.str) if(storageplayer >= 1) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player already have this mount.") elseif(storageplayer <= 0) then doPlayerAddMount(cid, mount2.id) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(pid) .. " has received the mount ") setPlayerStorageValue(player, mount2.str, 1) end end end end no talkations.xml adicione:
<talkaction words="/addmount" event="script" value="addmount.lua"/> Mude apenas o nome do arquivo.
Para utilizar in game, escreva:
/addmount nomeDoPlayer IDdaMount
Agora, para funcionar deverá modificar o código do link que nosso amigo xWhiteWolf acima o enviou... mudando o código para:
local montConfig = { ['widow queen'] = {item = xx, id = 1, str = 2001}, ['racing bird'] = {item = xx, id = 2, str = 2002}, ['war bear'] = {item = xx, id = 3, str = 2003}, ['black sheep'] = {item = xx, id = 4, str = 2004}, ['midnight panther'] = {item = xx, id = 5, str = 2005}, ['draptor'] = {item = xx, id = 6, str = 2006}, ['titanica'] = {item = xx, id = 7, str = 2007}, ['tin lizard'] = {item = xx, id = 8, str = 2008}, ['blazebringer'] = {item = xx, id = 9, str = 2009}, ['rapid boar'] = {item = xx, id = 10, str = 2010}, ['stampor'] = {item = xx, id = 11, str = 2011}, ['undead cavebear'] = {item = xx, id = 12, str = 2012} } local xx = 3954 --- id do item function onSay(cid, words, param) if(param == '') then local str = "" for name, options in pairs(montConfig) do str = str .. "\n" .. name end doPlayerPopupFYI(cid, "List of mounts:\n\n" .. str) return true end local mount = montConfig[param] if(mount ~= nil) then if doPlayerRemoveItem(cid,mount.item,1) then doPlayerSendCancel(cid, "Sorry, you dont have a mont doll for buy this mont " .. param .. "") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) return true end doPlayerAddMount(cid, mount.id) doPlayerRemoveItem(cid, xx,1) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS) else doPlayerSendCancel(cid, "The mount not found in list. Please use '!mount' to see the mounts list.") end return true end Note que apenas adicionei str = valor em cada linha, mude os numeros 2001,2002 até 2012 para numeros de storage válidos em seu servidor.
Feito isso, salve e reinicie seu servidor.
Agora é só utilizar. Posta ai se funcionou =)
Se possível, +REP
-GstavoLiber