Jump to content
  • 0

Erro de sistema vip [MOD] | TFS 0.4 REV 3996


Nightstar

Question

Está dando esse erro em um MOD que possuo, alguém sabe como solucionar esse problema? 

 

<?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="2" 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="13500" 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="11111" 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>

 

73479-eeaaf04e523a6313da1dea30803c25c8.png

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0
<?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(accountId)
    local Info = db.getResult("SELECT `vipdays` FROM `accounts` WHERE `id` = " .. accountId .. " LIMIT 1")
    if Info:getID() ~= LUA_ERROR then
        local days= Info:getDataInt("vipdays")
        Info:free()
        return days
    end
    return LUA_ERROR
end

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

function doRemoveVipDays(accountId, days)
    db.executeQuery("UPDATE `accounts` SET `vipdays` = `vipdays` - " .. days .. " WHERE `id` = " .. accountId .. ";")
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="2" event="script"><![CDATA[
    domodlib('VipFuctions')
    --- Script By Kekox.
    function onThink(interval, lastExecution)
        for _, name in ipairs(getOnlinePlayers()) do
            local cid = getPlayerByName(name)
            local accountId = getPlayerAccountId(cid)
            if getPlayerVipDays(accountId) >= 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)
        local accountId = getPlayerAccountId(cid)
        if getPlayerVipDays(accountId) >= 1 then
            doPlayerSendTextMessage(cid, 19, "You have ".. getPlayerVipDays(accountId) .." 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)
        local accountId = getPlayerAccountId(cid)
        if getPlayerVipDays(accountId) == 0 then
            doTeleportThing(cid, fromPosition, FALSE)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only VIP Account can go there.")
        end
        return true
    end
]]></movevent>

<action actionid="13500" event="script"><![CDATA[
    domodlib('VipFuctions')
    --- Script by Kekox.
    function onUse(cid, item, frompos, item2, topos)
        local accountId = getPlayerAccountId(cid)
        if getPlayerVipDays(accountId) >= 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="11111" event="script"><![CDATA[
    domodlib('VipFuctions')
    --- Script by Kekox.
    function onUse(cid, item, fromPosition, itemEx, toPosition)
        local accountId = getPlayerAccountId(cid)
        if getPlayerVipDays(accountId) > 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>

 

Link to comment
Share on other sites

×
×
  • Create New...