Jump to content

Recommended Posts

.Qual servidor ou website você utiliza como base? 

OtservBr 12.60

 

Qual o motivo deste tópico? 

Bom dia Galera do TK

Quero colocar a função de FreeBless no meu servidor até level 100

Porém esta dando esse erro. Alguma luz ?

 

Desde já agradeço !

 

Está surgindo algum erro? Se sim coloque-o aqui. 

Citar

 in function '__index'
        ...lobal/data/scripts/creaturescripts/customs/freebless.lua:17: in main chunk
 

 

Você tem o código disponível? Se tiver publique-o aqui: 

local freeBlessMaxLevel = 100   --- your max lvl to get free bless
function onLogin(player)
    if player:getLevel() <= freeBlessMaxLevel and not player:hasBlessing(1) then
        for b = 1, 5 do
            player:addBlessing(b)   --- here it add the bless
        end
        player:say("You got free bless, because your level lower than ".. freeBlessMaxLevel .."", TALKTYPE_MONSTER_SAY)   --- info why he get bless
        player:getPosition():sendMagicEffect(CONST_ME_HOLYDAMAGE)

        elseif player:hasBlessing(1) then
            player:say("You are blessed!", TALKTYPE_MONSTER_SAY)
        else
            player:say("You are not blessed.", TALKTYPE_MONSTER_SAY)
    end
    return true
end
freeBless:register()

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 

 

Link to post
Share on other sites

Creio que o motivo do erro foi a falta de registro ao revscript nas primeiras linhas.

Exemplo:

local freeBless = CreatureEvent("freeBless")
function freeBless.onLogin(player)

 

Porém esse script q vc mandou ai tem algumas falhas. Um deles é que só dará a bless 1~5, ou seja, como a twist of fate é a bless numero 1, poderia ainda haver episódios de drop de items com essa bless.

 

 

Exemplo desse script mais otimizado:

local freeBless = CreatureEvent("freeBless")

function freeBless.onLogin(player)
local freeBlessMaxLevel = 100
    if player:getLevel() <= freeBlessMaxLevel then
    	for i = 1, 6 do
    		if not player:hasBlessing(i) then
    			player:addBlessing(i, 1)
    		end
    	end
    	player:sendTextMessage(MESSAGE_EVENT_ADVANCE,'You received adventurers blessings for you to be level less than ' .. freeBlessMaxLevel .. '!')
        player:getPosition():sendMagicEffect(CONST_ME_HOLYDAMAGE)
    end
    return true
end

freeBless:register()

 

Link to post
Share on other sites

  • 2 weeks later...
Em 30/03/2021 em 11:50, Toruk disse:

Creio que o motivo do erro foi a falta de registro ao revscript nas primeiras linhas.

Exemplo:


local freeBless = CreatureEvent("freeBless")
function freeBless.onLogin(player)

 

Porém esse script q vc mandou ai tem algumas falhas. Um deles é que só dará a bless 1~5, ou seja, como a twist of fate é a bless numero 1, poderia ainda haver episódios de drop de items com essa bless.

 

 

Exemplo desse script mais otimizado:


local freeBless = CreatureEvent("freeBless")

function freeBless.onLogin(player)
local freeBlessMaxLevel = 100
    if player:getLevel() <= freeBlessMaxLevel then
    	for i = 1, 6 do
    		if not player:hasBlessing(i) then
    			player:addBlessing(i, 1)
    		end
    	end
    	player:sendTextMessage(MESSAGE_EVENT_ADVANCE,'You received adventurers blessings for you to be level less than ' .. freeBlessMaxLevel .. '!')
        player:getPosition():sendMagicEffect(CONST_ME_HOLYDAMAGE)
    end
    return true
end

freeBless:register()

 

 

 

Deu certo na minha distro OtServ 12.65.
Valeu mano

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Similar Content

    • By Bardocks
      .Qual servidor ou website você utiliza como base? 
      OtX 2.2
      Qual o motivo deste tópico? 
      Erro no script
      Está surgindo algum erro? Se sim coloque-o aqui. 
       
      Você tem o código disponível? Se tiver publique-o aqui: 
      <?xml version = "1.0" encoding = "UTF-8"?> <mod name = "Military Ranks" version = "1.0" author = "Teckman" enabled = "yes"> <config name = "ranks"><![CDATA[ titles = { [5] = "Private First Class", [10] = "Specialist", [15] = "Corporal", [20] = "Sergeant", [25] = "Staff Sergeant", [30] = "Sergeant First Class", [35] = "Master Sergeant", [40] = "First Sergeant", [45] = "Sergeant Major", [50] = "Command Sergeant Major", [55] = "Sergeant Major of the Army", [60] = "Second Lieutenant", [65] = "First Lieutenant", [70] = "Captain", [75] = "Major", [80] = "Lieutenant Colonel", [90] = "Colonel", [100] = "Brigadier General", [110] = "Major General", [120] = "Lieutenant General", [140] = "General", [170] = "General of the Army" } fragsStorage = 600 ]]></config> <event type = "look" name = "ranksLook" event = "script"><![CDATA[ domodlib("ranks") function onLook(cid, thing, position, lookDistance) if(isPlayer(thing.uid)) then local rank = {rank = "Private", frags = 0} for k, v in pairs(titles) do if(math.max(0, getPlayerStorageValue(thing.uid, fragsStorage)) > k - 1) then if(k - 1 > rank.frags) then rank.rank, rank.frags = v, k - 1 end end end doPlayerSetSpecialDescription(thing.uid, "\n Military rank: " .. rank.rank) end return true end ]]></event> <event type = "kill" name = "ranksKill" event = "script"><![CDATA[ domodlib("ranks") function onKill(cid, target) if(isPlayer(target)) then setPlayerStorageValue(cid, fragsStorage, math.max(0, getPlayerStorageValue(cid, fragsStorage) + 1)) if(titles[getPlayerStorageValue(cid, fragsStorage)]) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You advanced to military rank: " .. titles[getPlayerStorageValue(cid, fragsStorage)] .. ". Congratulations " .. titles[getPlayerStorageValue(cid, fragsStorage)] .. "!") end end return true end ]]></event> <event type = "login" name = "ranksLogin" event = "script"><![CDATA[ function onLogin(cid) registerCreatureEvent(cid, "ranksKill") registerCreatureEvent(cid, "ranksLook") return true end ]]></event> </mod>  
    • By Apache
      TFS 0.4
      Bom tenho esse sistema de castle, esta funciona bem, o único defeito é que ele não entrega os 30% de exp a mais
      para os membros da guild dominante, vou postar o script se alguém conseguir ajuda a resolver agradeço.
       
      action alavanca: 
       
      creaturescripts login.lua
       
       
      globalevents
       
      não achei necessario postar pois só o open e o close do sistema
       
      Lib
       
       
       
       
       
    • By MIzakinha
      Salve senhoras e senhores!

      Estou com um script no meu servidor de tasks diarias, ele funciona normalmente. Só que ele da a mesma task para TODOS os players do server. Tem uma tabela com várias opções de monstros para o player matar, ele pega dentro dessa tabela, 2 monstros aleatórios e da para o player escolher um deles. Só que ele da as MESMAS opções para TODOS os players. Alguém pode me ajudar a identificar o local para fazer com que seja aleatório para cada player diferente? Vou deixar o script aqui.

       
       
    • By Bruce Pereira
      Eu quero colocar uma storage nesse jutsu de dash, para poder criar outros jutsus, eu criei 3 dashs em meu servidor mas ta bugando. exemplo: uso o dash 1 aparece o efeito do dash 2, uso dash 2 e aparece o efeito do dash 3, eu tentei colocar uma storage mas não consegui.
       
      script sem edição minha \/
       
       
    • By stauro
      Alguém poderia me ajudar a colocar bonus exp no meu cast system?
       
       
       
       
       
       
       
       function onSay(cid, words, param, channel) local tmp = param:explode(" ") if not(tmp[1]) then return doPlayerSendCancel(cid, "Parameters needed") end if tmp[1] == "on" then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast has started.") doPlayerSetCastState(cid, true) doPlayerSave(cid) elseif getPlayerCast(cid).status == false then return doPlayerSendCancel(cid, "Your cast has to be running for this action.") elseif tmp[1] == "off" then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast has ended.") doPlayerSetCastState(cid, false) doPlayerSave(cid) elseif isInArray({"pass", "password", "p"}, tmp[1]) then if not(tmp[2]) then return doPlayerSendCancel(cid, "You need to set a password") end if tmp[2]:len() > 10 then return doPlayerSendCancel(cid, "The password is too long. (Max.: 10 letters)") end if tmp[2] == "off" then doPlayerSetCastPassword(cid, "") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast password has been removed.") else doPlayerSetCastPassword(cid, tmp[2]) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast password was set to: " .. tmp[2]) end elseif isInArray({"desc", "description", "d"}, tmp[1]) then local d = param:gsub(tmp[1]..(tmp[2] and " " or ""), "") if not(d) or d:len() == 0 then return doPlayerSendCancel(cid, "You need to specify a description.") end if d:len() > 50 then return doPlayerSendCancel(cid, "The description is too long. (Max.: 50 letters)") end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast description was set to: ") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, d) doPlayerSetCastDescription(cid, d) elseif tmp[1] == "ban" then if not(tmp[2]) then return doPlayerSendCancel(cid, "Specify a spectator that you want to ban.") end if doPlayerAddCastBan(cid, tmp[2]) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been banned.") else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be banned.") end elseif tmp[1] == "unban" then if not(tmp[2]) then return doPlayerSendCancel(cid, "Specify the person you want to unban.") end if doPlayerRemoveCastBan(cid, tmp[2]) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been unbanned.") else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be unbanned.") end elseif param == "bans" then local t = getCastBans(cid) local text = "Cast Bans:\n\n" for k, v in pairs(t) do text = text .. "*" .. v.name .. "\n" end if text == "Cast Bans:\n\n" then text = text .. "No bans." end doShowTextDialog(cid, 5958, text) elseif tmp[1] == "mute" then if not(tmp[2]) then return doPlayerSendCancel(cid, "Specify a spectator that you want to mute.") end if doPlayerAddCastMute(cid, tmp[2]) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been muted.") else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be muted.") end elseif tmp[1] == "unmute" then if not(tmp[2]) then return doPlayerSendCancel(cid, "Specify the person you want to unmute.") end if doPlayerRemoveCastMute(cid, tmp[2]) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been unmuted.") else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be unmuted.") end elseif param == "mutes" then local t = getCastMutes(cid) local text = "Cast Mutes:\n\n" for k, v in pairs(t) do text = text .. "*" .. v.name .. "\n" end if text == "Cast Bans:\n\n" then text = text .. "No mutes." end doShowTextDialog(cid, 5958, text) elseif param == "viewers" then local t = getCastViewers(cid) local text, count = "Cast Viewers:\n#Viewers: |COUNT|\n\n", 0 for _,v in pairs(t) do count = count + 1 text = text .. "*" .. v.name .."\n" end if text == "Cast Viewers:\n#Viewers: |COUNT|\n\n" then text = "Cast Viewers:\n\nNo viewers." end text = text:gsub("|COUNT|", count) doShowTextDialog(cid, 5958, text) elseif param == "status" then local t, c = getCastViewers(cid), getPlayerCast(cid) local count = 0 for _,v in pairs(t) do count = count + 1 end doShowTextDialog(cid, 5958, "Cast Status:\n\n*Viewers:\n " .. count .. "\n*Description:\n "..(c.description == "" and "Not set" or c.description).."\n*Password:\n " .. (c.password == "" and "Not set" or "Set - '"..c.password.."'")) elseif param == "update" then if getPlayerStorageValue(cid, 656544) > os.time() then return doPlayerSendCancel(cid, "You used this command lately. Wait: " .. (getPlayerStorageValue(cid, 656544)-os.time()) .. " sec.") end doPlayerSave(cid) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The cast settings have been updated.") doPlayerSetStorageValue(cid, 656544, os.time()+60) end return true end  
       
       
  • Recently Browsing   0 members

    No registered users viewing this page.


×
×
  • Create New...

Important Information

Confirmação de Termo