Jump to content

a script in a map causes stack overflow


Fella

Recommended Posts

Hi, my problem is that a server sided script sometimes causes stack overflow and crashes my server. this happens rarely, but it does happen and i don't really understand why sometimes it happens and why most of the time it doesn't.

here're the script itself:

  
Dangerouscars = {} 
local isMarkerid = 1 
Dangerouscars[425] = true 
Dangerouscars[520] = true 
Dangerouscars[476] = true 
Dangerouscars[447] = true 
Dangerouscars[432] = true 
Dangerouscars[464] = true 
  
  
disallowedVehicle = {[511] = true, [594] = true, [441] = true, [501] = true, [465] = true, [564] = true, [449] = true, [537] = true, [460] = true, [538] = true, [570] = true, [569] = true, [590] = true, [472] = true, [473] = true, [493] = true, [595] = true, [484] = true, [430] = true, [453] = true, [452] = true, [446] = true, [454] = true, [592] = true, [577] = true, [606] = true, [607] = true, [610] = true, [611] = true, [584] = true, [608] = true, [435] = true, [450] = true, [591] = true, [539] = true, [553] = true} 
  
  
function generateZufallCarID () 
    vehicleID = math.random(399, 609) 
    if disallowedVehicle[vehicleID] then 
        return 451 
    else 
        return vehicleID 
  end 
end 
  
  
  
  
function mapISStarting () 
    createMarkerToMap() 
end 
addEventHandler("onResourceStart",getResourceRootElement(),mapISStarting) 
  
function createMarkerToMap () 
    if isMarkerid == 1 then 
        createMarker(3883.6000976563,-1852.0999755859,139,"cylinder",5) 
    elseif isMarkerid == 2 then 
        createMarker(3861.8000488281,-1904.3000488281,139,"cylinder",5) 
    elseif isMarkerid == 3 then 
        createMarker(3800.6999511719,-1845.5999755859,139,"cylinder",5) 
    elseif isMarkerid == 4 then 
        createMarker(3867.5,-1798.5999755859,139,"cylinder",5) 
    elseif isMarkerid == 5 then 
        createMarker(3883.5,-1752.9000244141,139,"cylinder",5) 
    elseif isMarkerid == 6 then 
        createMarker(3946.3999023438,-1823,139,"cylinder",5) 
    elseif isMarkerid == 7 then 
        createMarker(3881.3000488281,-1853.5,139,"cylinder",5) 
    elseif isMarkerid == 8 then 
        createMarker(3869,-1919.3000488281,139,"cylinder",5) 
    else 
        isMarkerid = 1 
        createMarkerToMap() 
    end 
end 
  
function onMarkerHit_S ( hit ) 
    if getElementType(hit ) == "vehicle" then 
        local carid = generateZufallCarID() 
        local x, y, z = getElementPosition(hit) 
        fixVehicle(hit) 
        setElementModel(hit, carid) 
        setElementPosition(hit, x, y, z + 1) 
        if Dangerouscars[carid] then 
            outputChatBox("#ff0000Warning #ff0000 a " .. getVehicleNameFromModel(carid), getRootElement(), 255, 0, 0, true) 
        end 
        destroyElement(source) 
        isMarkerid = isMarkerid + 1 
        createMarkerToMap() 
    end 
end 
addEventHandler("onMarkerHit",getRootElement(),onMarkerHit_S) 
  

here's an error message from the server's log:

  
[2015-04-03 19:30:54] ERROR: [gamemodes]/[race]/[maps]/[dd]fivetowers-FT/fivetowers.lua:33: C stack overflow 
[2015-04-03 19:30:54] ERROR: [gamemodes]/[race]/[maps]/[dd]fivetowers-FT/fivetowers.lua:33: C stack overflow 
[2015-04-03 19:30:54] ERROR: [gamemodes]/[race]/[maps]/[dd]fivetowers-FT/fivetowers.lua:33: C stack overflow 
[2015-04-03 19:30:54] ERROR: [gamemodes]/[race]/[maps]/[dd]fivetowers-FT/fivetowers.lua:47: C stack overflow 
[2015-04-03 19:30:54] ERROR: [gamemodes]/[race]/[maps]/[dd]fivetowers-FT/fivetowers.lua:47: C stack overflow 
[2015-04-03 19:30:54] ERROR: [gamemodes]/[race]/[maps]/[dd]fivetowers-FT/fivetowers.lua:47: C stack overflow 
  

could you guys advice me something to solve the issue?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...