• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua DNT Error

Real Vandta

Member
Joined
Jun 16, 2020
Messages
56
Solutions
1
Reaction score
11
Location
Egypt
Hello guys, i have error in my script it possible to make this script to TFS 0.4 rev 3777?
Lua:
local config = {
  [1] = {5}, -- sorcerer
  [2] = {6}, -- druid
  [3] = {7}, -- paladin
  [4] = {8}, -- knight
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
  local v = config[getPlayerVocation(cid)]
    if v then
        doPlayerSetVocation(cid, v[1])
        doCreatureSay(cid, "You are now an  "..getPlayerVocationName(cid).."!", TALKTYPE_ORANGE_1)
         db.executeQuery("UPDATE `players` SET `name` = '[DNT] "..getCreatureName(cid).."' WHERE `id` = "..getPlayerGUID(cid)..";")
         doPlayerSendTextMessage(cid,25,"You will be kicked after 5 Secs automatically after logout you might have a [DNT] and Increase your vocations.")
         addEvent(doRemoveCreature, 5*1000, cid, true)   
        doRemoveItem(item.uid, 1)
     else
       doPlayerSendCancel(cid,"You're empty this item.")
    end
  return true
end
1611973617792.png
 
Solution
did u even restart or used reload??
I used reload. It work perfect but if you click on it that's gave you a [DNT] but not giving a vocation if you are Royal paladin and want to increase your vocation to Archer, when you're clicking it and that should give [DNT] only and when you relog you back to Royal paladin
and i take a screenshot of it looks like: 1612047103387.png
Lua:
local config = {
  [1] = {5}, -- sorcerer
  [2] = {6}, -- druid
  [3] = {7}, -- paladin
  [4] = {8}, -- knight
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
  local v = config[getPlayerVocation(cid)]
    if v then
        doPlayerSetVocation(cid, v[1])
        doCreatureSay(cid, "You are now an  "..getPlayerVocationName(cid).."!", TALKTYPE_ORANGE_1)
         db.query("UPDATE `players` SET `name` = '[DNT] "..getCreatureName(cid).."' WHERE `id` = "..getPlayerGUID(cid)..";")
         doPlayerSendTextMessage(cid,25,"You will be kicked after 5 Secs automatically after logout you might have a [DNT] and Increase your vocations.")
         addEvent(doRemoveCreature, 5*1000, cid, true)   
        doRemoveItem(item.uid, 1)
     else
       doPlayerSendCancel(cid,"You're empty this item.")
    end
  return true
end

1611975860494.png
 
Lua:
local config = {
  [1] = {5}, -- sorcerer
  [2] = {6}, -- druid
  [3] = {7}, -- paladin
  [4] = {8}, -- knight
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
  local v = config[getPlayerVocation(cid)]
    if v then
        doPlayerSetVocation(cid, v[1])
        doCreatureSay(cid, "You are now an  "..getPlayerVocationName(cid).."!", TALKTYPE_ORANGE_1)
         db.query("UPDATE `players` SET `name` = '[DNT] "..getCreatureName(cid).."' WHERE `id` = "..getPlayerGUID(cid)..";")
         doPlayerSendTextMessage(cid,25,"You will be kicked after 5 Secs automatically after logout you might have a [DNT] and Increase your vocations.")
         addEvent(doRemoveCreature, 5*1000, cid, true)  
        doRemoveItem(item.uid, 1)
     else
       doPlayerSendCancel(cid,"You're empty this item.")
    end
  return true
end

View attachment 54343
did u even restart or used reload??
 
did u even restart or used reload??
I used reload. It work perfect but if you click on it that's gave you a [DNT] but not giving a vocation if you are Royal paladin and want to increase your vocation to Archer, when you're clicking it and that should give [DNT] only and when you relog you back to Royal paladin
and i take a screenshot of it looks like: 1612047103387.png
 
Solution
I used reload. It work perfect but if you click on it that's gave you a [DNT] but not giving a vocation if you are Royal paladin and want to increase your vocation to Archer, when you're clicking it and that should give [DNT] only and when you relog you back to Royal paladin
and i take a screenshot of it looks like: View attachment 54365

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local cfg = {
        level = 350,  --- level to use items
        vocs = { 5, 6, 7, 8 },  --- put here vocation must use items
        storage = 45231  --- set any empty storage
    }
        if(getPlayerStorageValue(cid, cfg.storage) == -1) then
            if(getPlayerLevel(cid) >= cfg.level) then
                if(isInArray(cfg.vocs, getPlayerVocation(cid)) == true) then
                        setPlayerPromotionLevel(cid, getPlayerPromotionLevel(cid) + 1)
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been promoted to " .. getVocationInfo(getPlayerVocation(cid)).name .. ".")
                        doSendMagicEffect(getCreaturePosition(cid), 55)
                        setPlayerStorageValue(cid, cfg.storage, 1)
                        doRemoveItem(item.uid, 1)
                        db.query("UPDATE `players` SET `name` = '[DNT] "..getCreatureName(cid).."' WHERE `id` = "..getPlayerGUID(cid)..";")
                else
                    doCreatureSay(cid, "Only players with first promotion may get their Second promotion.", TALKTYPE_ORANGE_1)
                end
            else
                doCreatureSay(cid, "Sorry, only characters of level " .. cfg.level .. " or above can buy Second Promotion.", TALKTYPE_ORANGE_1)
            end
        else
            doCreatureSay(cid, "You have already purchased the Second Promotion.", TALKTYPE_ORANGE_1)
        end
    return
end

Test this from @heba

I don't have TFS 0.4 for testing here
 
Back
Top