Pesquisar na Comunidade
Mostrando resultados para as tags ''treinar''.
Encontrado 2 registros
-
action Square Trainer - Perder stamina enquanto treina
um tópico no fórum postou Administrador Actions e Talkactions
Ta ai um script muito bom galera, créditos e instruções no próprio script. --[[ Square Skill Trainer made by Arthur aka artofwork 12/1/14, my original account Updated 10/15/2015, to 1.2 based on tfs sources on github by Codex NG This script will train all of a players skills indefintely including magic level It has a small configuration setup where you can set the number of tries per skill The time interval in between each skill try added A storage value to help prevent abuse You can assign any tile you wish to this script that a player can walk on with action id 900 Now removes offline training time for free accounts New in this script? skill tries for both free account & premium accounts mana gain for both free & premium accounts mana multipliers to effect magic level for both free and premium accounts based on percentage experience gain for both free and prem accounts Added optional all skills for free accounts or just the weapons & shield they have equiped add this too movements <!-- Square Trainer --> <movevent event="StepIn" actionid="900" script="squaretrainer.lua"/> <movevent event="StepOut" actionid="900" script="squaretrainer.lua"/> save this file in data\movements\script\ as squaretrainer.lua ]]-- local special = false -- true for vip false for prem -- do not edit local currentTime = os.time() local day = 86400 -- 1 full day in seconds local minimumTime = 0 -- minimum time for vip local addSkillTimer = 1000 -- do not edit - time at which skill tries are added local skills = 5 -- 0 to 5 includes 0:fist, 1:club, 2:sword, 3:axe, 4:distance, 5:shield -- do not edit ------------------------------- local allskills = false -- should free accounts train all their skills local removeOfflineTime = true -- do you want to remove offline training time? -- minutes to remove per minute, should be minimum 2 since they gain a minute for every minute they are not killing something local timeOfOfflineToRemove = 2 -- minimum hours needed to train, set it to 12 if u want to test the tp to temple local minimumTimeNeedToUseTrainers = 1 local useConfigMlRate = false -- do you want to use the config settings rate of Magic in this script local useConfigExpRate = false -- do you want to use the config settings rate of Exp in this script local useConfigSkillRate = true -- do you want to use the config settings rate of Skills in this script -- do not edit local keys = { RATE_SKILL = 6, RATE_MAGIC = 8, RATE_LOOT = 7, RATE_EXPERIENCE = 5 } local tseconds = 1000 local tminute = 60 * tseconds local thour = 60 * tminute local trainingTimeMax = thour * minimumTimeNeedToUseTrainers -- 43200000 default value (12 hours) ----------------- -- used by isSpecial, this allows certain account types to skip the offline time removal local godAccount = 4 -- tile actionid local aid = 900 local p = {} local addskills = { prem = 1000, -- xp to add as vip/prem (depends if special is true) account per interval -- the rate is a percentage of their max mana, this way it scales with their level manaGainPremRate = .10, -- mana to add as vip/prem (depends if special is true) account per interval premSkillTries = 100, -- Number of tries per skill for vip/prem (depends if special is true) account per interval premManaMultiplier = 5, -- when player has full mana multiply how much more mana is used to gain magic level free = 100, manaGainFreeRate = .01, -- mana to add as free account per interval freeSkillTries = 1, -- Number of tries per skill for free account freeManaMultiplier = 1, -- when player has full mana multiply how much more mana is used to gain magic level balanceShield = 3 -- 3 is good, but if shielding goes up too quick then lower it, use only whole numbers e.g. 1, 2, 3 } -- do not edit local weaponTypes = { [0] = { 0, 0 }, -- fist { 1, 2 }, -- Sword { 2, 1 }, -- Club { 3, 3 }, -- Axe { 4, 5 }, -- Shield { 5, 4 }, -- Distance { 6, 0 } -- 6 is rod / wands, 0 is for fists.. } local shieldId = 5 function getSlottedItems(player) local left = pushThing(player:getSlotItem(CONST_SLOT_LEFT)).itemid local right = pushThing(player:getSlotItem(CONST_SLOT_RIGHT)).itemid left = ItemType( left ):getWeaponType() right = ItemType( right ):getWeaponType() return left, right end -------------------------------- -- this function is only effected by free accounts function templeTeleport(p) p.player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) p.player:setStorageValue( 18010, 0) local temple = p.player:getTown():getTemplePosition() p.player:teleportTo(temple) temple:sendMagicEffect(CONST_ME_ENERGYAREA) p.player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, "..p.name.." you don't have enough offline time to train.") end function RemoveOfflineTrainingTime(p) if trainingTimeCheck(p) then p.player:removeOfflineTrainingTime(timeOfOfflineToRemove * 60000) p.seconds = 60000 -- reset the timer end end function trainingTimeCheck(p) local time_ = p.player:getOfflineTrainingTime() if time_ <= (timeOfOfflineToRemove * tminute) then templeTeleport(p) end if time_ >= trainingTimeMax then return true else templeTeleport(p) end end function isSpecial(player) -- this is so i could test the shit right away if player:getAccountType() >= godAccount then return true end if special then return (math.floor((player:getStorageValue(13540) - currentTime) / (day)) > minimumTime) else return player:isPremium() end end function train(p) local player = p.player if player:isPlayer() and player:getStorageValue(18010) == 1 then if isSpecial(player) then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Your training session will now begin.") addEvent(trainMe, 1, p) else -- if free account, they have to wait 30 seconds to begin training if p.secondsTime > 0 then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Your training session will begin in "..(p.secondsTime).." seconds.") end if p.secondsTime <= 0 then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Your training session will now begin.") addEvent(trainMe, 1, p) else p.secondsTime = p.secondsTime - 10 addEvent(train, 10000, p) end end end return true end function returnRate(useRate, RATE) return useRate and configManager.getNumber(RATE) - 3300 or 1 end function trainMe(p) local player = p.player local weaponLeft, weaponRight = getSlottedItems(player) if player:isPlayer() and player:getStorageValue(18010) == 1 then if isSpecial(player) then player:addExperience(addskills["prem"] * returnRate(useConfigExpRate, RATE_EXPERIENCE) ) -- add mana to player based on premium mana rate settings player:addManaSpent(addskills["manaGainPremRate"] * player:getMaxMana() ) else player:addExperience(addskills["free"] * returnRate(useConfigExpRate, RATE_EXPERIENCE) ) -- add mana to player based on free mana rate settings player:addManaSpent(addskills["manaGainFreeRate"] * player:getMaxMana() ) end for i = 0, skills do if isSpecial(player) then if i == shieldId then -- shielding, will help balance shield gain player:addSkillTries(i, (addskills["premSkillTries"] * addskills["balanceShield"]) * returnRate(useConfigSkillRate, RATE_SKILL) ) else player:addSkillTries(i, addskills["premSkillTries"] * returnRate(useConfigSkillRate, RATE_SKILL) ) -- all other skills end else if allskills then if i == shieldId then -- shielding, will help balance shield gain player:addSkillTries(i, (addskills["freeSkillTries"] * addskills["balanceShield"]) * returnRate(useConfigSkillRate, RATE_SKILL) ) else player:addSkillTries(i, addskills["freeSkillTries"] * returnRate(useConfigSkillRate, RATE_SKILL) ) -- all other skills end else -- this effects only free accounts for i = 0, #weaponTypes do if weaponTypes[i][2] == shieldId and weaponTypes[i][1] == weaponRight then player:addSkillTries(weaponTypes[i][2], (addskills["freeSkillTries"] * addskills["balanceShield"]) * returnRate(useConfigSkillRate, RATE_SKILL) ) end if weaponTypes[i][2] ~= shieldId and weaponTypes[i][1] == weaponLeft then player:addSkillTries(weaponTypes[i][2], addskills["freeSkillTries"] * returnRate(useConfigSkillRate, RATE_SKILL) ) end end end end -- will increase magic level based on max mana times multiplier local maxMana = player:getMaxMana() if player:getMana() == maxMana then if isSpecial(player) then -- premium account multiplier used to increase level player:addManaSpent(maxMana * (addskills["premManaMultiplier"] * returnRate(useConfigMlRate, RATE_MAGIC)) ) else -- free account multiplier used to increase level player:addManaSpent(maxMana * (addskills["freeManaMultiplier"] * returnRate(useConfigMlRate, RATE_MAGIC)) ) end player:addMana(-maxMana) end end if not isSpecial(player) then p.seconds = p.seconds - addSkillTimer if(p.seconds <= 1000) then -- we want to be fair so we make sure the player gets a whole minute if removeOfflineTime then addEvent(RemoveOfflineTrainingTime, 1, p) end end end addEvent(trainMe, addSkillTimer, p) end return true end function onStepIn(player, item, position, fromPosition) if not player:isPlayer() then return false end p = -- this is table is essential so we can pass it to the other functions { player = player:getPlayer(), item = item, pos = player:getPosition(), soul = player:getSoul(), seconds = 60000, secondsTime = 30, name = player:getName() } if player:isPlayer() then if player:getStorageValue(18010) < 1 then if p.item.actionid == aid then player:setStorageValue(18010, 1) -- if the player is a free acc they will lose offline training time as they train if removeOfflineTime then RemoveOfflineTrainingTime(p) end addEvent(train, 1, p) end else player:teleportTo(fromPos, true) end end return true end function onStepOut(player, item, position, fromPosition) p.secondsTime = 30 stopEvent(train) -- may not work as expected stopEvent(trainMe) -- may not work as expected player:setStorageValue(18010, 0) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Your training session has now ended.") return true end -
creatureevent Trainer Off Sytem Beta By Caotic
um tópico no fórum postou caotic Globalevents e Spells
Ola galera xtibiana venho monstra meu novo sistema o trainer off sytem. Como ele funciona? Bem... O player ao dizer uma talkaction ele paga um certo preço para pode upar quando estiver off. Ele paga o dinheiro de acordo com a hora que ele vai ficar treinando off. Se ele tentar logar na hora que ele estiver upando ele e recebido com uma mensagem e desloga. A talk funciona de tal maneira: /treiner (E a quantidade de horas que quer upar) Exemplo quero upar 4 horas eu falo: /treiner 4. Uma hora custa 100 platinum coins depende do dinheiro do seu otserv. Lets go. Crie uma arquivo lua em talkactions chamado de treiner e coloque este código: function onSay(cid, words, param, channel) function doSetTimeTrainer(cid, time) exhaustion.set(cid, 44226, time*36000*1000) end function doAddAllSkillTrainer(cid, quant) doPlayerAddSkill(cid, SKILL_FIST, quant) doPlayerAddSkill(cid, SKILL_CLUB, quant) doPlayerAddSkill(cid, SKILL_SWORD, quant) doPlayerAddSkill(cid, SKILL_AXE, quant) doPlayerAddSkill(cid, SKILL_DISTANCE, quant) doPlayerAddSkill(cid, SKILL_SHIELD, quant) doPlayerAddSkill(cid, SKILL_FISHING, quant) doRemoveCreature(cid) end local money = 9999 --- Quanto de money por hora local limit = 60 -- Qual e o limite de horas que ele pode upar local skill = 6 --- Quantos de skill ele vai ganhar por hora local t = string.explode(param, ",") if param == '' or param == " " or param == nil then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você precisa colocar quanto de treino você quer") end if getPlayerGroupId(cid) >= 2 then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode usar o sistema com pessoas da equipe(tutor,gm,cm,god) use com players") end if tonumber(t[1]) >= limit then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O limite de horas e "..limit.."") end local time = t[1] local gold = t[1]*money if getPlayerMoney(cid) <= money then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você precisa ter pelo 100000 de money para treinar") end if gold >= getPlayerMoney(cid) then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Para cada 1 hora de treino e necessario 100000 de money") end doPlayerRemoveMoney(cid, gold) doSetTimeTrainer(cid, time) doAddAllSkillTrainer(cid, t[1]*skill) return true end Agora coloque esta tag em talkactions.xml: <talkaction words="/trainer" event="script" value="trainer.lua"/> Agora vá em creaturescripts e crie um arquivo lua chamado de treiner e coloque isto: function onLogin(cid) function getTimeTrainer(cid) return exhaustion.get(cid, 44226) end if getTimeTrainer(cid) then doShowTextDialog(cid, 1952, "Você esta treinando não pode logar ate que seu treinamento termine") return addEvent(doRemoveCreature, 180, cid) end return true end Agora vá em creaturescripts e abra o login.lua e registre o evento colocando isto antes do ultimo return: registerCreatureEvent(cid, "treiner") Coloque a tag em creaturescripts.xml <event type="login" name="trainer" event="script" value="trainer.lua"/>- 18 respostas
-
- trainer off
- trainer off by caotic
- (e 6 mais)