Postado Dezembro 2, 2017 7 anos Boa tarde pessoal do TK. Estou usando um sistema de PPOINT's, aqui mesmo do TK.. A unica forma que tem de conseguir esse PPOINTS é ficando online, queria colocar outra maneira, pra isso queria criar um item que ao clicar nele adicionasse 1 ponto, sendo assim poderia colocar em eventos como recompensa também.Resumindo o meu pedido: Clicar no ITEMID 8301 e receber um ppoints.Obs: O item 8301 é agrupável, se for o caso da pessoa ter 2 unidades ao clicar seria adicionado 2 ppoints. O sistema q eu uso é esse aqui: Globalevents Spoiler local config = { p_time = 7200, -- Tempo em segundos para receber os pontos( 3600 = 1hora ) p_points = 1 -- Quantidade de pontos recebida a cada "p_time" } function givePoints(cid, quant) local onTime = getPlayerStorageValue(cid, 1219) if onTime >= config.p_time then local rest = onTime%config.p_time local add = ((onTime-rest)/config.p_time)*quant doPlayerAddPoints(cid, add) local text = "Você " .. (rest == 0 and "não possui" or "ainda possui") .. " " .. (rest == 0 and "" or rest) .. " segundos online." doPlayerSendTextMessage(cid, 19, "Parabéns, você recebeu " .. add .. " ppoint" .. (add > 1 and "s" or "")..". Agora você tem " .. add + getPoints(cid) .. " ppoints na sua conta. ".. text .." Próximo ppoint em " .. (config.p_time/3600) .. " horas.") setPlayerStorageValue(cid, 1219, rest) end return true end function onThink(interval) for _, pid in ipairs(getPlayersOnline()) do givePoints(pid, config.p_points) end return true end Creatureevents Spoiler function onLogin(cid) local query = db.getResult("SELECT (`lastlogout`-`lastlogin`) as ONtime FROM `players` WHERE `name` = '" .. getPlayerName(cid) .. "';") if getPlayerStorageValue(cid, 1219) == -1 then setPlayerStorageValue(cid, 1219, 0) return true end local addtime = query:getDataInt("ONtime") setPlayerStorageValue(cid, 1219, getPlayerStorageValue(cid, 1219) + tonumber(addtime)) return true end Talkactins Spoiler local config = { p_time = 7200, -- Tempo em segundos para receber os pontos( 3600 = 1hora ) p_points = 1 -- Quantidade de pontos recebida a cada "p_time" } function onSay(cid, words, param, channel) local onTime = getPlayerStorageValue(cid, 1219) local rest = onTime%config.p_time local tempo = config.p_time - rest local add = tonumber(((onTime-rest)/config.p_time)*config.p_points) local text = "" if add > 0 then text = "Você ganhará " .. add .. " ppoint " .. (add > 1 and "s" or "").."." end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Faltam " .. tempo .. " segundos online para ganhar mais um ppoint." .. text) doPlayerPopupFYI(cid, "Você possui " .. getPoints(cid) .. " Ppoints.") return true end Se alguém puder me ajudar com esse script, fico grato desde já!! Editado Dezembro 2, 2017 7 anos por brendoonh (veja o histórico de edições)
Postado Dezembro 2, 2017 7 anos Solução Em actions/scripts crie um arquivo.lua: Spoiler function onUse(cid, item, fromPosition, itemEx, toPosition) doPlayerAddPoints(cid, item.type) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_SOUND_BLUE) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have added "..item.type.." points to your character.") doRemoveItem(item.uid) return true end No actions.xml: <action itemid="ID_DO_ITEM" script="NOMEDOARQUIVO.lua" /> Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Dezembro 3, 2017 7 anos Autor Obrigado pela força, fiz da forma que era, ao ligar o server apresentou um erro Talvez seja por causa da distro né? Não falei ali encima kkk TFS 0.4 Em 02/12/2017 em 21:35, Dwarfer disse: Em actions/scripts crie um arquivo.lua: Mostrar conteúdo oculto function onUse(cid, item, fromPosition, itemEx, toPosition) setPlayerStorageValue(cid, 1219, getPlayerStorageValue(cid, 1219) + item.type) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_SOUND_BLUE) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have added "..item.type.." points to your character.") doRemoveItem(item.uid) return true end No actions.xml: <action itemid="ID_DO_ITEM" script="NOMEDOARQUIVO.lua" /> @Edit Está funcionando 100%, foi um erro do arquivo ao salvar.. 100% Editado Dezembro 4, 2017 7 anos por brendoonh (veja o histórico de edições)
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.