Ir para conteúdo
  • Cadastre-se

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


Posts Recomendados

Tenho um MOD de vip em meu servidor que está dando erro na distro, como que resolve 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.jfif

Link para o post
Compartilhar em outros sites

dá uma conferida no banco de dados se na tabela accounts tem a coluna vipdays

 

ALTER TABLE `accounts` ADD `vipdays` INT(11) NOT NULL

 

Link para o post
Compartilhar em outros sites
20 minutos atrás, Imperius disse:

dá uma conferida no banco de dados se na tabela accounts tem a coluna vipdays

 


ALTER TABLE `accounts` ADD `vipdays` INT(11) NOT NULL

 

Existe sim

Link para o post
Compartilhar em outros sites
<?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)
                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>

 

Link para o post
Compartilhar em outros sites
Em 14/02/2024 em 10:03, GM Vortex disse:

<?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)
                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>

 

continua com o mesmo erro na distro

 

[12:54:02.261] [Error - Action Interface]
[12:54:02.262] domodlib('VipFuctions')
[12:54:02.263]         --- Script by Kekox.
[12:54:02.264]         function onUse(cid, item, fromPosition, itemEx, toPosition)
[12:54:02.266]             if getPlayerVipDays(cid) > 365 then
[12:54:02.267]                 doPlayerSendCancel(cid, "You can only have 1 year of vip account or less.")
[12:54:02.268]             else
[12:54:02.269]                 doAddVipDays(cid, 30)
[12:54:02.269]                 doCreatureSay(cid, "Vip", TALKTYPE_ORANGE_1)
[12:54:02.270]                 doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "We have added 30 vip days to your account.")
[12:54:02.271]                 doRemoveItem(item.uid)
[12:54:02.272]             end
[12:54:02.273]             return true
[12:54:02.274]         end
[12:54:02.275] :onUse
[12:54:02.276] Description:
[12:54:02.276] [string "--- Vip functions by Kekox..."]:13: attempt to call field 'executeQuery' (a nil value)
[12:54:02.277] stack traceback:
[12:54:02.278]  [string "--- Vip functions by Kekox..."]:13: in function 'doAddVipDays'
[12:54:02.279]  [string "LuaInterface::loadBuffer"]:7: in function <[string "LuaInterface::loadBuffer"]:3>

 

Link para o post
Compartilhar em outros sites
  • 2 weeks later...
Em 15/02/2024 em 12:55, HexusAlphos disse:

attempt to call field 'executeQuery' (a nil value)

mas o erro disse aonde foi o erro: não existe o campo "executeQuery" pra fazer uma edição na sua DB

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


troca pra:

db.query("UPDATE `accounts` SET `vipdays` = `vipdays` + " .. days .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")


Se continuar dando erro, faz uma busca no teu servidor por "query", pode ser que seja outro modo de executar uma query na DB via lua no teu servidor.

Link para o post
Compartilhar em outros sites
  • 3 weeks later...
Em 23/02/2024 em 19:45, FeeTads disse:

mas o erro disse aonde foi o erro: não existe o campo "executeQuery" pra fazer uma edição na sua DB


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


troca pra:


db.query("UPDATE `accounts` SET `vipdays` = `vipdays` + " .. days .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")


Se continuar dando erro, faz uma busca no teu servidor por "query", pode ser que seja outro modo de executar uma query na DB via lua no teu servidor.

Funcionou, valeuzão e desculpa a demora

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo