Postado Setembro 6, 2012 12 anos Autor po precisava disso urgente falta poco pra min abri meu ot , mais ninguem ajuda aq :S , muita gente sabe como arruma tem varios profissional mais eles nem ajuda =/
Postado Setembro 6, 2012 12 anos Autor Criado por rollback, Set 03 2012 03:39 , 3 dias já ninguem ajudo alguem da uma força ae :S
Postado Setembro 6, 2012 12 anos Acho que isso fica mais chato que site, por que olha com um site você ja teria feito isso faz tempo, e vc procurando essa script ta demorando né, site não é dificil de fazer nem de mecher com ele, você pode chamar um web master para o server Web Master 100% Scripter 20% Spriter 20% Mapper 5% Hoster 0%
Postado Setembro 6, 2012 12 anos em lib/functions vc adiciona: function getPoints(cid) local check = db.getResult("SELECT `points` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. " LIMIT 1") return check:getDataInt("points") <= 0 and 0 or check:getDataInt("points") end function addPoints(cid,amount) db.executeQuery("UPDATE `players` SET `points` = "..getPoints(cid).."+"..amount.." WHERE `id` = "..getPlayerGUID(cid)) end function removePoints(cid,amount) db.executeQuery("UPDATE `players` SET `points` = "..getPoints(cid).."-"..amount.." WHERE `id` = "..getPlayerGUID(cid)) end function setPoints(cid,value) db.executeQuery("UPDATE `players` SET `points` = "..value.." WHERE `id` = "..getPlayerGUID(cid)) end e na sua database vc executa: ALTER TABLE `players` ADD `points` INT NOT NULL DEFAULT '0' Caso não saiba executar você me fala que eu te ensino como. getPoints(cid) -- checa qnto tem de pontos addPoints(cid,amount) -- adc pontos ao jogador,por exemplo Vodkart tem 10 pontos e eu adiciono 30 vai ficar 40 removePoints(cid,amount) -- remove os pontos do jogador,minimo é 0 setPoints(cid,value) -- altera os pontos do jogador pra qual valor vc quiser talk local count = 5 db.executeQuery("UPDATE players SET points = "..getPoints(cid).."+"..count) nesse caso vai adicionar 5 points para todos os jogadores do server. systempoints.lua function onSay(cid, words, param) if(words == "!points") then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você tem "..getPoints(cid).." Points.") elseif(words == "!rankpoints") then local max_players,str = 20,"" str = "--[ RANK POINTS ]--\n\n" query = db.getResult("SELECT `name`, `points` FROM `players` WHERE `points` > -1 AND `id` > 6 AND `group_id` < 2 ORDER BY `points` DESC, `name` ASC;") if (query:getID() ~= -1) then k = 1 while true do str = str .. "\n " .. k .. ". " .. query:getDataString("name") .. " - [" .. query:getDataInt("points") .. "]" k = k + 1 if not(query:next()) or k > max_players then break end end query:free()end if str ~= "" then doShowTextDialog(cid,6500, str) end elseif(words == "/addpoints") then if getPlayerAccess(cid) == 5 then local t = string.explode(param, ",") if not t[1] or not t[2] then return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.") end local player = getPlayerByName(t[1]) local points = t[2] local pid = getPlayerByNameWildcard(t[1]) if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.") end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "você adicionou "..points.." Points do jogador "..t[1]) doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Foram adicionados "..points.." Points no seu character.") addPoints(player,points) doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Você agora tem "..getPoints(player).." Points.") end elseif(words == "/delpoints") then if getPlayerAccess(cid) == 5 then local t = string.explode(param, ",") if not t[1] or not t[2] then return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.") end local player = getPlayerByName(t[1]) local points = t[2] local pid = getPlayerByNameWildcard(t[1]) if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.") end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "você removeu "..points.." Points do jogador "..t[1]) doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Foram removidos "..points.." Points do seu character.") removePoints(player,points) doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Você agora tem "..getPoints(player).." Points.") end elseif(words == "/setpoints") then if getPlayerAccess(cid) == 5 then local t = string.explode(param, ",") if not t[1] or not t[2] then return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.") end local player = getPlayerByName(t[1]) local points = t[2] local pid = getPlayerByNameWildcard(t[1]) if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.") end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Agora o jogador "..t[1].." tem "..points.." Points no seu character.") doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "agora você tem "..points.." Points do seu character.") setPoints(player,points) end end return TRUE end talkactions.xml <talkaction words="!points;!rankpoints;/addpoints;/delpoints;/setpoints" script="systempoints.lua"> Báu que vende items por points nome do seu script.lua local lever = { [6001] = {30,7429}, [6002] = {20,7366}, [6003] = {10,8926}, [6004] = {3,8303}, [6005] = {3,8310} } local storage,exausted = 98762,10 local Stackable = {8303,8310} -- coloque o ID aqui dos que só vem 1 function onUse(cid,item,fromPosition,itemEx,toPosition) if getPoints(cid) < lever[item.actionid][1] then return doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "Você precisa de "..lever[item.actionid][1].." points.") elseif getPlayerStorageValue(cid, storage) >= os.time() then return doPlayerSendCancel(cid, "wait " .. getPlayerStorageValue(cid, storage) - os.time() .. " seconds to use this item again.") end doPlayerAddItem(cid,lever[item.actionid][2], isItemStackable(lever[item.actionid][2]) and isInArray(Stackable, lever[item.actionid][2]) and 1 or 100) removePoints(cid,lever[item.actionid][1]) setPlayerStorageValue(cid, storage, os.time()+exausted) doPlayerSendTextMessage(cid,22,"Você comprou um " .. getItemNameById(lever[item.actionid][2])) doSendMagicEffect(getCreaturePosition(cid), math.random(28,30)) return true end Configuração: [6001] = {30,7429}, [ActionID do báu] = {Quanto points vai custar, ID DO ITEM QUE SERÁ VENDIDO} a tag é essa: <action actionid="6001-6005" script="nome do seu script.lua"/> lembrando que pode adicionar mais, e fazendo isso você deve aumentar na tag também, exemplo: local lever = { [6001] = {30,7429}, [6002] = {20,7366}, [6003] = {10,8926}, [6004] = {3,8303}, [6005] = {3,8310}, [6006] = {15,2494} } e a tag ficaria assim <action actionid="6001-6006" script="nome do seu script.lua"/> npc que vende itens por Points 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 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local shopWindow = {} local t = { [2195] = {price = 15}, [2493] = {price = 25}, [2361] = {price = 30}, [8851] = {price = 20}, [8925] = {price = 30}, [2640] = {price = 50}, [2494] = {price = 100}, [9932] = {price = 50}, [2472] = {price = 70}, [8931] = {price = 100} } local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks) if t[item] and getPoints(cid) < t[item].price then selfSay("você não tem "..t[item].price.." points", cid) else doPlayerAddItem(cid, item) removePoints(cid,t[item].price) selfSay("aqui está seu item!", cid) end return true end if (msgcontains(msg, 'trade') or msgcontains(msg, 'TRADE'))then for var, ret in pairs(t) do table.insert(shopWindow, {id = var, subType = 0, buy = ret.price, sell = 0, name = getItemNameById(var)}) end openShopWindow(cid, shopWindow, onBuy, onSell) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Obs: ele vai ter que tem gps também,mas os gps são serão removidos só os Points mesmo. [8851] = {price = 20}, [iD DO ITEM QUE VAI SER VENDIDO] = {price = QNTOS PONTOS VAO SER PRECISO} e se você quiser adicionar points para todos os player do ot que estejam online/offline você usa: [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
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.