• 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!

MOD Error start tag

Venn

Member
Joined
Aug 16, 2009
Messages
547
Reaction score
20
i got a script and when running tfs it say that missing "<" at line 1
Start tag expected
anyone now how to fix that ?
Lua:
<?xml version="1.0" encoding="UTF-8"?>
    <mod name = "Reward For Level" version = "1.0" author = "Teckman" enabled = "yes">
	<config name="RewardFuctions"><![CDATA[
function getPlayerVipReward(cid)
    local Info = db.getResult("SELECT `reward` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
        if Info:getID() ~= LUA_ERROR then
        local bolean= Info:getDataInt("reward")
        Info:free()
        return bolean
    end
     return LUA_ERROR
end

function doAddReward(cid, bolean)
    db.executeQuery("UPDATE `accounts` SET `reward` = `reward` + " .. bolean .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end
]]></config>
        <event type = "advance" name = "rewardAdvance" event = "script"><![CDATA[ 
		domodlib('VipFuctionss')
		domodlib('RewardFuctions')
            local levels = { 
                [20] = {2160, 1}, 
                [40] = {2160, 2}, 
                [60] = {2160, 2}, 
                [80] = {2160, 3}, 
                [100] = {2160, 5} 
            } 
            function onAdvance(cid, skill, oldLevel, newLevel) 
                if(skill == SKILL__LEVEL) then 
                    for k, v in pairs(levels) do 
                        if(newLevel == k and getPlayerStorageValue(cid, 100) < k) then 
                            setPlayerStorageValue(cid, 100, k) 
                            doPlayerAddItem(cid, v[1], v[2]) 
                            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You recive " .. v[2] .. "x " .. getItemNameById(v[1]) .. "(s) for reaching " .. k .. " level.") 
                        end 
                    end 
                end 
				if newLevel == 50 then
					if (getPlayerReward(cid) == 0) then
						doAddVipDays(cid, 30)
						doAddReward(cid, 1)
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have advanced to level 50 and got 5 days of free vip!')
						doBroadcastMessage('Congratulations! ' .. getCreatureName(cid) .. ' Advanced To Level 50 and got 5 days of free vip!')
					else
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Congratulations on reaching 50! Unfortunately, You already have a character over this level and will not receive any days of free vip!')
					end
				end
                return true 
            end 
        ]]></event> 
        <event type = "login" name = "rewardLogin" event = "script"><![CDATA[ 
            function onLogin(cid) 
                registerCreatureEvent(cid, "rewardAdvance") 
                return true 
            end 
        ]]></event> 
    </mod>
 
try this
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name=""Reward For Level" version="1.0" author="Teckman" contact="otland.net" enabled="yes">
	<config name="RewardFuctions"><![CDATA[
function getPlayerVipReward(cid)
    local Info = db.getResult("SELECT `reward` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
        if Info:getID() ~= LUA_ERROR then
        local bolean= Info:getDataInt("reward")
        Info:free()
        return bolean
    end
     return LUA_ERROR
end
 
function doAddReward(cid, bolean)
    db.executeQuery("UPDATE `accounts` SET `reward` = `reward` + " .. bolean .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end
]]></config>
        <event type = "advance" name = "rewardAdvance" event = "script"><![CDATA[ 
		domodlib('VipFuctionss')
		domodlib('RewardFuctions')
            local levels = { 
                [20] = {2160, 1}, 
                [40] = {2160, 2}, 
                [60] = {2160, 2}, 
                [80] = {2160, 3}, 
                [100] = {2160, 5} 
            } 
            function onAdvance(cid, skill, oldLevel, newLevel) 
                if(skill == SKILL__LEVEL) then 
                    for k, v in pairs(levels) do 
                        if(newLevel == k and getPlayerStorageValue(cid, 100) < k) then 
                            setPlayerStorageValue(cid, 100, k) 
                            doPlayerAddItem(cid, v[1], v[2]) 
                            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You recive " .. v[2] .. "x " .. getItemNameById(v[1]) .. "(s) for reaching " .. k .. " level.") 
                        end 
                    end 
                end 
				if newLevel == 50 then
					if (getPlayerReward(cid) == 0) then
						doAddVipDays(cid, 30)
						doAddReward(cid, 1)
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have advanced to level 50 and got 5 days of free vip!')
						doBroadcastMessage('Congratulations! ' .. getCreatureName(cid) .. ' Advanced To Level 50 and got 5 days of free vip!')
					else
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Congratulations on reaching 50! Unfortunately, You already have a character over this level and will not receive any days of free vip!')
					end
				end
                return true 
            end 
        ]]></event> 
        <event type = "login" name = "rewardLogin" event = "script"><![CDATA[ 
            function onLogin(cid) 
                registerCreatureEvent(cid, "rewardAdvance") 
                return true 
            end 
        ]]></event> 
    </mod>
 
i fixed it and optymalized like that:
what it does? at lvl 50 give you 5 days free vip only once per account
Lua:
<?xml version="1.0" encoding="UTF-8"?>
    <mod name = "Reward For Level" version = "1.0" author = "Teckman" enabled = "yes">
	<config name="RewardFuctions"><![CDATA[
function hasAccountStorage(cid, key, value)
	if isPlayer(cid) == false then
		error("[hasAccountStorage] Player not found (cid=" .. tostring(cid) .. ")")
	elseif tonumber(key) == nil then
		error("[hasAccountStorage] Invalid key (key=" .. tostring(key) .. ")")
	else
		local q = db.getResult('SELECT player_id FROM player_storage LEFT JOIN players ON player_storage.player_id=players.id WHERE players.account_id=' .. getPlayerAccountId(cid) .. ' AND `key`=' .. key .. (value and ' AND value=' .. db.escapeString(value) or '') .. ' LIMIT 1')
		if q:getID() ~= -1 then
			q:free()
			return true
		end
	end
end

function doAddVipDays(cid, days)
    db.executeQuery("UPDATE `accounts` SET `vipdays` = `vipdays` + " .. days .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end
]]></config>
        <event type = "advance" name = "rewardAdvance" event = "script"><![CDATA[ 
		domodlib('RewardFuctions')
            local levels = { 
                [20] = {2160, 1}, 
                [40] = {2160, 2}, 
                [60] = {2160, 2}, 
                [80] = {2160, 3}, 
                [100] = {2160, 5} 
            } 
            function onAdvance(cid, skill, oldLevel, newLevel) 
                if(skill == SKILL__LEVEL) then 
                    for k, v in pairs(levels) do 
                        if(newLevel == k and getPlayerStorageValue(cid, 100) < k) then 
                            setPlayerStorageValue(cid, 100, k) 
                            doPlayerAddItem(cid, v[1], v[2]) 
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You recive " .. v[2] .. "x " .. getItemNameById(v[1]) .. "(s) for reaching " .. k .. " level.") 
                        end 
                    end 
                end 
				if newLevel == 50 then
					if (hasAccountStorage(cid, 46284, 4)) then
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Congratulations on reaching 50! Unfortunately, You already have a character over this level and will not receive any days of free vip!')
					else
						doAddVipDays(cid, 5)
						setPlayerStorageValue(cid, 46284, 4)
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have advanced to level 50 and got 5 days of free vip!')
						doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Congratulations! ' .. getCreatureName(cid) .. ' Advanced To Level 50 and got 5 days of free vip!')end
					end
				end
                return true 
            end 
        ]]></event> 
        <event type = "login" name = "rewardLogin" event = "script"><![CDATA[ 
            function onLogin(cid) 
                registerCreatureEvent(cid, "rewardAdvance") 
                return true 
            end 
        ]]></event> 
    </mod>
 
Back
Top