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

Please help me with this script (error)

Celsish

New Member
Joined
Apr 6, 2009
Messages
74
Reaction score
0
I got these errors when the map is changing (I use 0.4)



and here is the script:
PHP:
function onThink(interval, lastExecution, thinkInterval)
    local maps = {
        [1] = {mapName = "Thais", redTemple = {x = 1000, y = 1000, z = 7}, blueTemple = {x = 969, y = 959, z = 7}},
        [2] = {mapName = "Edron", redTemple = {x = 958, y = 562, z = 7}, blueTemple = {x = 1075, y = 579, z = 7}},
        [3] = {mapName = "Carlin", redTemple = {x = 1644, y = 701, z = 6}, blueTemple = {x = 1593, y = 664, z = 7}},
        [4] = {mapName = "Venore", redTemple = {x = 1639, y = 968, z = 6}, blueTemple = {x = 1620, y = 1104, z = 6}},
        [5] = {mapName = "Fibula", redTemple = {x = 938, y = 1347, z = 7}, blueTemple = {x = 1010, y = 1410, z = 7}},
    }
    
    local teams = {
        blueName = "Blue Team",
        redName = "Red Team",
        blueScore = 101,
        redScore = 102,
        bluePlayerScore = 1004,
        redPlayerScore = 1006,
    }
    
    local map = maps[getGlobalStorageValue(100)]

    if getGlobalStorageValue(100) <= 0 then
        setGlobalStorageValue(100, 1)
    elseif getGlobalStorageValue(100) >= math.max(1, #maps) then
        setGlobalStorageValue(100, 1)
    elseif getGlobalStorageValue(100) >= 1 then
        setGlobalStorageValue(100, getGlobalStorageValue(100)+1)
    end
    
    if map then
        for _, cid in ipairs(getPlayersOnline()) do
            if getPlayerStorageValue(cid, 1002) == 1 then
                doTeleportThing(cid, map.blueTemple)
                doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
            elseif getPlayerStorageValue(cid, 1003) == 1 then
                doTeleportThing(cid, map.redTemple)
                doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
            end
            if getGlobalStorageValue(teams.blueScore) > getGlobalStorageValue(teams.redScore) then
                str = "\n\nThe " .. teams.blueName .. "  won!\n\nScores:\n" .. teams.blueName .. " " ..  getGlobalStorageValue(blueScore) .. " - " ..  getGlobalStorageValue(redScore) .. " " .. teams.redName .. "."
            elseif getGlobalStorageValue(teams.redScore) > getGlobalStorageValue(teams.blueScore) then
                str = "\n\nThe " .. teams.redName .. "  won!\n\nScores:\n" .. teams.blueName .. " " ..  getGlobalStorageValue(blueScore) .. " - " ..  getGlobalStorageValue(redScore) .. " " .. teams.redName .. "."
            end
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Map has  been changed to " .. map.mapName .. "! Next map in 30 minutes!" .. str)
        end
        setGlobalStorageValue(teams.blueScore, 0)
        setGlobalStorageValue(teams.redScore, 0)
    end
return true
end

can someone help me?
 
Lua:
function onThink(interval, lastExecution, thinkInterval)
	local maps = {
		[1] = {mapName = 'Thais', redTemple = {x = 1000, y = 1000, z = 7}, blueTemple = {x = 969, y = 959, z = 7}},
		[2] = {mapName = 'Edron', redTemple = {x = 958, y = 562, z = 7}, blueTemple = {x = 1075, y = 579, z = 7}},
		[3] = {mapName = 'Carlin', redTemple = {x = 1644, y = 701, z = 6}, blueTemple = {x = 1593, y = 664, z = 7}},
		[4] = {mapName = 'Venore', redTemple = {x = 1639, y = 968, z = 6}, blueTemple = {x = 1620, y = 1104, z = 6}},
		[5] = {mapName = 'Fibula', redTemple = {x = 938, y = 1347, z = 7}, blueTemple = {x = 1010, y = 1410, z = 7}},
	}
	
	local teams = {
		blueName = 'Blue Team',
		redName = 'Red Team',
		blueScore = 101,
		redScore = 102,
		bluePlayerScore = 1004,
		redPlayerScore = 1006,
	}

	if getGlobalStorageValue(100) <= 0 then
		setGlobalStorageValue(100, 1)
	elseif getGlobalStorageValue(100) >= math.max(1, #maps) then
		setGlobalStorageValue(100, 1)
	elseif getGlobalStorageValue(100) >= 1 then
		setGlobalStorageValue(100, getGlobalStorageValue(100)+1)
	end

	local map, str = maps[getGlobalStorageValue(100)], ''

	if map then
		for _, cid in ipairs(getPlayersOnline()) do
			if getPlayerStorageValue(cid, 1002) == 1 then
				doTeleportThing(cid, map.blueTemple)
				doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
			elseif getPlayerStorageValue(cid, 1003) == 1 then
				doTeleportThing(cid, map.redTemple)
				doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
			end
			
			if getGlobalStorageValue(teams.blueScore) > getGlobalStorageValue(teams.redScore) then
				str = '\n\nThe ' .. teams.blueName .. '  won!\n\nScores:\n' .. teams.blueName .. ' ' ..  getGlobalStorageValue(blueScore) .. ' - ' ..  getGlobalStorageValue(redScore) .. ' ' .. teams.redName .. '.'
			elseif getGlobalStorageValue(teams.redScore) > getGlobalStorageValue(teams.blueScore) then
				str = '\n\nThe ' .. teams.redName .. '  won!\n\nScores:\n' .. teams.blueName .. ' ' ..  getGlobalStorageValue(blueScore) .. ' - ' ..  getGlobalStorageValue(redScore) .. ' ' .. teams.redName .. '.'
			end
			
			doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Map has  been changed to ' .. map.mapName .. '! Next map in 30 minutes!' .. str)
		end
	
		setGlobalStorageValue(teams.blueScore, 0)
		setGlobalStorageValue(teams.redScore, 0)
	end
	return true
end
 
Back
Top