patrickjean 38 Postado Julho 6, 2011 Share Postado Julho 6, 2011 (editado) Um MOD Super interessante que vou trazer hoje para o XTibia!! Versão = 2.0, Servidor Testado = "TFS 0.3.5*", Comentarios sobre o Script: È uma adaptação de um sistema de Reputation que é feito para funcionar em Mysql Pra que serve: Script tipo Policia e Ladrão, onde você tem uma lista de players para capturar(Matar). Intuito do Script: O Script foi feito com o intuito de proporcionar RPG aos jogadores. Vamos aos scripts!! Creature Script: Crie um arquivo chamado rep.lua em data\creaturescripts\scripts e coloque isso nele: function onKill(cid,target) if isPlayer(cid) and isPlayer(target) then local sk = getCreatureSkullType(target) local level = getPlayerLevel(target) local prize = {0.7*level*100, 1.3*level*100} if getPlayerIp(cid) ~= getPlayerIp(target) then if sk == SKULL_WHITE or sk == SKULL_RED or sk == SKULL_BLACK then if haveReward(getPlayerName(target)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "The government payed ".. getPlayerReward(getPlayerName(target)) .." gold coins for the killer of ".. getPlayerName(target) ..". Thank you.") doPlayerAddMoney(cid, getPlayerReward(getPlayerName(target))) setPlayerReward(getPlayerName(target),0) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "That player aren't wanted.") end else doPlayerAddReward(getPlayerName(cid), math.random(prize[1],prize[2])) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Now the government will pay ".. getPlayerReward(getPlayerName(cid)) .." gold coins for your head.") setPlayerReward(getPlayerName(target),0) end end end retur Em "local prize = {0.7*level*100, 1.3*level*100}" Coloque o min,max que vai adcionar na reward do player. TalkActions: Crie um arquivo chamado rep.lua em data\talkactions\scripts e coloque isso nele: function onSay(cid, words, param) name = {} for i in param:gmatch('(%a+)') do table.insert(name,i) end name = table.concat(name, ' ') if words == '!addreward' then if name == nil and param:match('(%d+)') == nil then doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Player not found.") return true elseif name == nil then doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Choose the player to add ".. param:match('(%d+)') .." in his reward.") return true elseif param:match('(%d+)') == nil then doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Choose the reward to add to ".. name ..".") return true end if getPlayerGUIDByName(name) then doPlayerAddReward(name,tonumber(param:match('(%d+)'))) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You added ".. tonumber(param:match('(%d+)')) .. " gold coins in the reward of ".. name ..".") return true else doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, name.." isn't a Player.") return true end elseif words == '!removereward' then if name == nil and param:match('(%d+)') == nil then doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Player not found.") return true elseif name == nil then doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Choose the player to remove ".. param:match('(%d+)') .." from his reward.") return true elseif param:match('(%d+)') == nil then doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Choose the reward to remove from ".. name ..".") return true elseif getPlayerGUIDByName(name) then doPlayerRemoveReward(name,tonumber(param:match('(%d+)'))) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You removed ".. param:match('(%d+)') .. " gold coins in the reward of ".. name ..".") return true else doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Player not found.") return true end elseif words == '!setreward' then if name == nil and param:match('(%d+)') == nil then doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Player not found.") return true elseif name == nil then doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Choose the player to set his reward to ".. param:match('(%d+)') ..".") return true elseif param:match('(%d+)') == nil then doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Choose the reward to set from ".. name ..".") return true elseif getPlayerGUIDByName(name) then setPlayerReward(name,tonumber(param:match('(%d+)'))) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You set the reward from ".. name .." to ".. param:match('(%d+)') ..".") return true else doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Player not found.") return true end elseif words == '!reward' then local voca = {[0]='No vocation', [1]='Sorcerer',[2]='Druid',[3]='Paladin',[4]='Knight',[5]='Master Sorcerer',[6]='Elder Druid',[7]='Royal Paladin',[8]='Elite Knight'} if getPlayerGUIDByName(name) then local voca = {[0]='No vocation', [1]='Sorcerer',[2]='Druid',[3]='Paladin',[4]='Knight',[5]='Master Sorcerer',[6]='Elder Druid',[7]='Royal Paladin',[8]='Elite Knight'} local query = db.getResult("SELECT `level`,`vocation` FROM `players` WHERE `id` = ".. getPlayerGUIDByName(name) ..";") local level, voc = query:getDataInt('level'), query:getDataInt('vocation') doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "\n|¯¯¯¯| "..param..": Level "..level.."\n| | "..voca[voc].."\n|____| Reward: ".. getPlayerReward(param) .. "\nWanted") return true else doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Player not found.") return true end elseif words == '!pay' then gold = param:match('(%d+)') if gold then if type(tonumber(gold)) == 'number' then if getPlayerReward(getPlayerName(cid)) >= tonumber(gold) then if doPlayerRemoveMoney(cid, tonumber(gold)) then doPlayerRemoveReward(getPlayerName(cid),tonumber(gold)) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You removed ".. gold .." gold coins from your reward.") return true else doPlayerSendTextMessage(cid,MESSAGE_EVENT_ORANGE, "You don't have ".. gold .." gold coins.") return true end else doPlayerSendTextMessage(cid,MESSAGE_EVENT_ORANGE, "You don't have ".. gold .." gold coins in your reward.") return true end else doPlayerSendTextMessage(cid,MESSAGE_EVENT_ORANGE, gold.." isn't a number.") return true end else doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Choose how many gold coins you'll remove from your reward.") return true end elseif words == '!support' then local str = "¤Functions:\n\n!reward Socket » Will show how many gold coin the government will pay if you kill Socket.\n\n!pay 10 » Will remove 10 gold coins from your reward.\n\n!support » Will show this to you." local str1 = "¤Functions:\n\n!addreward Socket 10 » Will add 10 gold coins in the reward of Socket.\n\n!removereward Socket 10 » Will remove 10 gold coins from the reward of Socket.\n\n!setreward Socket 10 » Will change the reward of Socket to 10.\n\n!reward Socket » Will show how many gold coin the government will pay if you kill Socket.\n\n!pay 10 » Will remove 10 gold coins from your reward.\n\n!support » Will show this to you." if getPlayerAccess(cid) > 3 then doPlayerPopupFYI(cid, str1) return true else doPlayerPopupFYI(cid, str) return true end end end LIB Crie um arquivo chamado rep.lua em data\lib e adcione isto nele: function rewardtable() local q = db.executeQuery("ALTER TABLE `players` ADD `reward` INT NOT NULL DEFAULT '0' AFTER `name`;") return q end function setPlayerReward(player,qnt) db.executeQuery("UPDATE `players` SET `reward` = '".. qnt .."' WHERE `name` = '".. player .."' LIMIT 1;") return true end function getPlayerReward(player) local get = db.getResult("SELECT `reward` FROM `players` WHERE `name` = '".. player .."';") local reward = get:getDataInt('reward') return reward end function haveReward(player) if getPlayerReward(player) > 0 then return true end return false end function doPlayerAddReward(player,qnt) t = (qnt and qnt or 1) local get = db.getResult("SELECT `reward` FROM `players` WHERE `name` = '".. player .."';") local reward = get:getDataInt('reward') return db.executeQuery("UPDATE `players` SET `reward` = '".. reward + t .."' WHERE `name` = '".. player .."' LIMIT 1;") end function doPlayerRemoveReward(player,qnt) t = (qnt and qnt or 1) local get = db.getResult("SELECT `reward` FROM `players` WHERE `name` = '".. player .."';") local reward = get:getDataInt('reward') if reward > t then return db.executeQuery("UPDATE `players` SET `reward` = '".. reward - t .."' WHERE `name` = '".. player .."' LIMIT 1;") else return db.executeQuery("UPDATE `players` SET `reward` = '".. 0 .."' WHERE `name` = '".. player .."' LIMIT 1;") end end Movement: Crie outro arquivo chamado rep.lua em data\movements\scripts e coloque isso nele: local sex = { [0] = 'she\'s', [1] = 'he\'s', } local config = { bc = true, uid = 1000, reward = 1500 } function onStepIn(cid, item, pos) if item.uid == config.uid then doPlayerAddReward(getPlayerName(cid),config.reward) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You entered an area of government, now you're wanted for ".. getPlayerReward(getPlayerName(cid)) .." gold coins.") if config.bc == true then doBroadcastMessage(getPlayerName(cid).." have entered an area of government, now ".. sex[getPlayerSex(cid)] .." wanted for ".. getPlayerReward(getPlayerName(cid)) .. " gold coins.", 22) end end return true end Em " local config = { bc = true, uid = 1000, reward = 1500 } " Configure: bc: se quer que mande uma mensagem global de que alguem entro num lugar errado e está procurado coloque true, se não false. uid: unique id do tile. reward: quantidade que vai adcionar na reward do player. Instalação: 1º: Execute a função rewardtable() uma vez ou a query: ALTER TABLE `players` ADD `reward` INT NOT NULL DEFAULT '0' AFTER `name` 2º Em data\lib procure o arquivo data.lua ou global.lua e adcione isto nele: dofile(getDataDir() .. "lib/rep.lua") 3º Em data\creaturescripts abra o arquivo creaturescripts.xml e adcione isto nele: <event type="kill" name="rep" event="script" value="rep.lua"/> 4º Em data\creaturescripts\scripts abra o arquivo login.lua e adcione isto no final: registerCreatureEvent(cid, "rep") 5º Em data\talkactions abra o arquivo talkactions.xml e adcione isto nele: <talkaction words="!addreward" access="5" event="script" value="rep.lua"/> <talkaction words="!removereward" access="5" event="script" value="rep.lua"/> <talkaction words="!setreward" access="5" event="script" value="rep.lua"/> <talkaction words="!reward" event="script" value="rep.lua"/> <talkaction words="!support" event="script" value="rep.lua"/> <talkaction words="!pay" event="script" value="rep.lua"/> 6º Em data\movements abrao arquivo movements.xml e adcione isto nele: <movevent type="StepIn" itemid="5588" event="script" value="rep.lua"/> em itemid="5588" troque pelo id do tile "protegido pelo governo". Comandos: 3 comandos para GOD adcionar/remove/setar a reward do player: !addreward Socket 10/!addreward 10 Socket !removereward Socket 10/!removereward 10 Socket !setreward Socket 10/!setreward 10 Socket 2 comandos para PLAYER ver, e pagar sua recompensa: !pay 100 !reward Socket Movement: Ela é opcional, serve para você "proteger" algum tile, quando alguem passa emcima a reward dele aumenta. SS: !addreward e !removereward !pay !setreward Movement: Créditos: Socket = Autor [V]vodkasiri = Idéia Gostou? Te ajudei:: REP + Editado Julho 6, 2011 por PatrickJean Link para o comentário https://xtibia.com/forum/topic/160673-wanted-dead-or-alive/ Compartilhar em outros sites More sharing options...
syshuy 25 Postado Julho 6, 2011 Share Postado Julho 6, 2011 Nossaa , otimo script muito util , mais acho que poderia dar mais detalhes , como funciono , explicaçoes etc .. rep+ Link para o comentário https://xtibia.com/forum/topic/160673-wanted-dead-or-alive/#findComment-1059014 Compartilhar em outros sites More sharing options...
patrickjean 38 Postado Julho 6, 2011 Autor Share Postado Julho 6, 2011 Eu botei o que eu entendi do que eu testei no meu Server!! Mais mesmo assim Obrigado!! =D Link para o comentário https://xtibia.com/forum/topic/160673-wanted-dead-or-alive/#findComment-1059015 Compartilhar em outros sites More sharing options...
Pardalziin 8 Postado Outubro 24, 2011 Share Postado Outubro 24, 2011 achei mto legal KPOASKASPOSA Link para o comentário https://xtibia.com/forum/topic/160673-wanted-dead-or-alive/#findComment-1121808 Compartilhar em outros sites More sharing options...
GicoO 1 Postado Outubro 27, 2011 Share Postado Outubro 27, 2011 (editado) Perfect , só arruma o final ali Return E aqui tem só um probleminha :X eu ataco o bixo e talz e ele nao morre mano ://// e fica dando um erro bem cabuloso Se puder ajudar eu fiz um topico.... Ajuda ae Editado Outubro 27, 2011 por GicoxD Link para o comentário https://xtibia.com/forum/topic/160673-wanted-dead-or-alive/#findComment-1123687 Compartilhar em outros sites More sharing options...
YANBRAGA 0 Postado Dezembro 4, 2012 Share Postado Dezembro 4, 2012 1º: Execute a função rewardtable() uma vez ou a query: ALTER TABLE `players` ADD `reward` INT NOT NULL DEFAULT '0' AFTER `name` como executar essa função eu não entendi .. pf ajuda =/ Link para o comentário https://xtibia.com/forum/topic/160673-wanted-dead-or-alive/#findComment-1403245 Compartilhar em outros sites More sharing options...
AlexandreKG 134 Postado Dezembro 5, 2012 Share Postado Dezembro 5, 2012 Caramba mano,muito legal vo por nos favoritos para usar este sistema.Em meu OTServ. Parabéns,rep ++ Link para o comentário https://xtibia.com/forum/topic/160673-wanted-dead-or-alive/#findComment-1404281 Compartilhar em outros sites More sharing options...
ChockerrGamer 0 Postado Outubro 13, 2013 Share Postado Outubro 13, 2013 1º: Execute a função rewardtable() uma vez ou a query: ALTER TABLE `players` ADD `reward` INT NOT NULL DEFAULT '0' AFTER `name` como executar essa função eu não entendi .. pf ajuda =/ 1º: Execute a função rewardtable() uma vez ou a query: ALTER TABLE `players` ADD `reward` INT NOT NULL DEFAULT '0' AFTER `name` como executar essa função eu não entendi .. pf ajuda =/ Boa tarde, primeiro você copia esse código abaixo, e vai acessa o phpmyadmin, chegando la selecione o bando de dados do seu servidor e clica em "SQL" ai vc cola o codigo e executa. ALTER TABLE `players` ADD `reward` INT NOT NULL DEFAULT '0' AFTER `name` Abs Olá, quando eu tento executar a query eu recebo a seguinte mensagem de erro Error while executing query: %s obs: estou usando sqlite. Link para o comentário https://xtibia.com/forum/topic/160673-wanted-dead-or-alive/#findComment-1572138 Compartilhar em outros sites More sharing options...
Posts Recomendados