• 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 Problem using a mod

DreadShi

Member
Joined
May 18, 2019
Messages
180
Reaction score
7
I am running an old otx server version 2.9 , i tried to search alot in order to get a working script , Finally i found a mod which have less errors and workin atm

Errors:
Code:
30: parser error : StartTag: invalid element name
                if (getPlayerVipDays(cid) <= days) then
                                           ^
mods/vip_system.xml:39: parser error : StartTag: invalid element name
        <=!=[=C=D=A=T=A=[
         ^

Code:
[Error - Event::checkScript] Event onTime not found (             --- Script by Kekox.
                function onTimer()
                 db.executeQuery("UPDATE accounts SET vipdays = vipdays - 1 WHERE vipdays > 0;")
        return true
        end
        )

I tried most of other posted topics but i didn't get the full system working , sometimes medal works another only tile works etc

Also wondering if it possible to merge into mod /add,remove days will be Great




Here is the mod:
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Vipsystem" version="1.0"

author="Aco" contact="http://otland.net/members/acordion" enabled="yes">

<!--- Information
Vip Item = 10503
set action id 11223 to the tile you want to be vip tile
set action id 2112 to the door you want to be vip door


            MYSQL TABLE
........................................................
ALTER TABLE `accounts` ADD
`vipdays` int(11) NOT NULL DEFAULT 0;
........................................................

-->

<config name="VipFuctions"><![CDATA[
--- Vip functions by Kekox
function getPlayerVipDays(cid)
    local Info = db.getResult("SELECT `vipdays` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
        if Info:getID() ~= LUA_ERROR then
        local days= Info:getDataInt("vipdays")
        Info:free()
        return days
    end
     return LUA_ERROR
end

function doAddVipDays(cid, days)
    db.executeQuery("UPDATE `accounts` SET `vipdays` = `vipdays` + " .. days .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end

function doRemoveVipDays(cid, days)
    db.executeQuery("UPDATE `accounts` SET `vipdays` = `vipdays` - " .. days .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end
]]></config>

<globalevent name="VipDaysRemover" time="00:01" event="script"><![CDATA[
        --- Script by Kekox.
        function onTimer()
                 db.executeQuery("UPDATE accounts SET vipdays = vipdays - 1 WHERE vipdays > 0;")
        return true
    end
    ]]></globalevent>
   
<globalevent name="vipEffect" interval="2000" event="script"><![CDATA[
    domodlib('VipFuctions')
    --- Script By Kekox.
    function onThink(interval, lastExecution)
         for _, name in ipairs(getOnlinePlayers()) do
         local cid = getPlayerByName(name)
               if getPlayerVipDays(cid) >= 1 then
                  doSendMagicEffect(getPlayerPosition(cid), 27)
                  doSendAnimatedText(getPlayerPosition(cid), "VIP!", TEXTCOLOR_RED)
               end
         end
         return true
end]]></globalevent>
   
<event type="login" name="Vip" event="script"><![CDATA[
        --- Script by Kekox.
        function onLogin(cid)
    registerCreatureEvent(cid, "VipCheck")
        return true
end]]></event>

<event type="login" name="VipCheck" event="script"><![CDATA[
    domodlib('VipFuctions')
        --- Script by Kekox.
function onLogin(cid)
         if getPlayerVipDays(cid) >= 1 then
            doPlayerSendTextMessage(cid, 19, "You have ".. getPlayerVipDays(cid) .." vip days left.")
         end
         return true
end
]]></event>
   
<movevent type="StepIn" actionid="11223" event="script"><![CDATA[
        domodlib('VipFuctions')
        --- Script by Kekox.
        function onStepIn(cid, item, position, fromPosition)
         if getPlayerVipDays(cid) == 0 then
             doTeleportThing(cid, fromPosition, FALSE)
             doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only VIP Account can go there.")
         end
    return true
    end
]]></movevent>

<action actionid="2112" event="script"><![CDATA[
    domodlib('VipFuctions')
    --- Script by Kekox.
    function onUse(cid, item, frompos, item2, topos)
         if getPlayerVipDays(cid) >= 1 then
            pos = getPlayerPosition(cid)
            if pos.x == topos.x then
               if pos.y < topos.y then
                  pos.y = topos.y + 1
               else
                  pos.y = topos.y - 1
               end
            elseif pos.y == topos.y then
                   if pos.x < topos.x then
                      pos.x = topos.x + 1
                   else
                      pos.x = topos.x - 1
                   end
            else
                doPlayerSendTextMessage(cid,22,"Stand in front of the door.")
            return true
            end
            doTeleportThing(cid,pos)
            doSendMagicEffect(topos,12)
         else
            doPlayerSendTextMessage(cid,22,'Only VIP Account can go there.')
         end
         return true
end
]]></action>
   
<action itemid="5785" event="script"><![CDATA[
    domodlib('VipFuctions')
    --- Script by Kekox.
        function onUse(cid, item, fromPosition, itemEx, toPosition)
         if getPlayerVipDays(cid) > 365 then
            doPlayerSendCancel(cid, "You can only have 1 year of vip account or less.")
          else
            doAddVipDays(cid, 30)
            doCreatureSay(cid, "Vip", TALKTYPE_ORANGE_1)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "We have added 30 vip days to your account.")
            doRemoveItem(item.uid)
         end
        return true
    end
]]></action>
</mod>
 
Is it 2 different scripts? I tried to find your first error log and can't find the functions at any line but for your second error log try this one.
XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Vipsystem" version="1.0"

author="Aco" contact="http://otland.net/members/acordion" enabled="yes">

<!--- Information
Vip Item = 10503
set action id 11223 to the tile you want to be vip tile
set action id 2112 to the door you want to be vip door


            MYSQL TABLE
........................................................
ALTER TABLE `accounts` ADD
`vipdays` int(11) NOT NULL DEFAULT 0;
........................................................

-->

<config name="VipFuctions"><![CDATA[
--- Vip functions by Kekox
function getPlayerVipDays(cid)
    local Info = db.getResult("SELECT `vipdays` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
        if Info:getID() ~= LUA_ERROR then
        local days= Info:getDataInt("vipdays")
        Info:free()
        return days
    end
     return LUA_ERROR
end

function doAddVipDays(cid, days)
    db.executeQuery("UPDATE `accounts` SET `vipdays` = `vipdays` + " .. days .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end

function doRemoveVipDays(cid, days)
    db.executeQuery("UPDATE `accounts` SET `vipdays` = `vipdays` - " .. days .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end
]]></config>

<globalevent name="VipDaysRemover" time="00:01" event="script"><![CDATA[
        --- Script by Kekox.
        function onTime()
                 db.executeQuery("UPDATE accounts SET vipdays = vipdays - 1 WHERE vipdays > 0;")
        return true
    end
    ]]></globalevent>
  
<globalevent name="vipEffect" interval="2000" event="script"><![CDATA[
    domodlib('VipFuctions')
    --- Script By Kekox.
    function onThink(interval, lastExecution)
         for _, name in ipairs(getOnlinePlayers()) do
         local cid = getPlayerByName(name)
               if getPlayerVipDays(cid) >= 1 then
                  doSendMagicEffect(getPlayerPosition(cid), 27)
                  doSendAnimatedText(getPlayerPosition(cid), "VIP!", TEXTCOLOR_RED)
               end
         end
         return true
end]]></globalevent>
  
<event type="login" name="Vip" event="script"><![CDATA[
        --- Script by Kekox.
        function onLogin(cid)
    registerCreatureEvent(cid, "VipCheck")
        return true
end]]></event>

<event type="login" name="VipCheck" event="script"><![CDATA[
    domodlib('VipFuctions')
        --- Script by Kekox.
function onLogin(cid)
         if getPlayerVipDays(cid) >= 1 then
            doPlayerSendTextMessage(cid, 19, "You have ".. getPlayerVipDays(cid) .." vip days left.")
         end
         return true
end
]]></event>
  
<movevent type="StepIn" actionid="11223" event="script"><![CDATA[
        domodlib('VipFuctions')
        --- Script by Kekox.
        function onStepIn(cid, item, position, fromPosition)
         if getPlayerVipDays(cid) == 0 then
             doTeleportThing(cid, fromPosition, FALSE)
             doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only VIP Account can go there.")
         end
    return true
    end
]]></movevent>

<action actionid="2112" event="script"><![CDATA[
    domodlib('VipFuctions')
    --- Script by Kekox.
    function onUse(cid, item, frompos, item2, topos)
         if getPlayerVipDays(cid) >= 1 then
            pos = getPlayerPosition(cid)
            if pos.x == topos.x then
               if pos.y < topos.y then
                  pos.y = topos.y + 1
               else
                  pos.y = topos.y - 1
               end
            elseif pos.y == topos.y then
                   if pos.x < topos.x then
                      pos.x = topos.x + 1
                   else
                      pos.x = topos.x - 1
                   end
            else
                doPlayerSendTextMessage(cid,22,"Stand in front of the door.")
            return true
            end
            doTeleportThing(cid,pos)
            doSendMagicEffect(topos,12)
         else
            doPlayerSendTextMessage(cid,22,'Only VIP Account can go there.')
         end
         return true
end
]]></action>
  
<action itemid="5785" event="script"><![CDATA[
    domodlib('VipFuctions')
    --- Script by Kekox.
        function onUse(cid, item, fromPosition, itemEx, toPosition)
         if getPlayerVipDays(cid) > 365 then
            doPlayerSendCancel(cid, "You can only have 1 year of vip account or less.")
          else
            doAddVipDays(cid, 30)
            doCreatureSay(cid, "Vip", TALKTYPE_ORANGE_1)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "We have added 30 vip days to your account.")
            doRemoveItem(item.uid)
         end
        return true
    end
]]></action>
</mod>
 
Back
Top