Jump to content

Race script integrity compromised - Restarting


Recommended Posts

Hi,

How can I configure my server so that a Race continues after one of the vehicles has been destroyed?

How are you supposed to play this game-mode if a script restart is triggered every time this happens?

This behavior is caused by the Script integrity test:

race_client.lua:

------------------------ 
-- Script integrity test 
  
setTimer( 
    function () 
        if g_Vehicle and not isElement(g_Vehicle) then 
            outputChatBox( "Race integrity test fail (client): Your vehicle has been destroyed. Please panic." ) 
        end 
    end, 
    1000,0 
) 

race_server.lua:

------------------------ 
-- Script integrity test 
  
g_IntegrityFailCount = 0 
TimerManager.createTimerFor("raceresource","integrity"):setTimer( 
    function () 
        local fail = false 
        -- Make sure all vehicles are valid - Invalid vehicles really mess up the race script 
        for player,vehicle in pairs(g_Vehicles) do 
            if not isElement(vehicle) then 
                fail = true 
                outputRace( "Race integrity test fail: Invalid vehicle for player " .. tostring(getPlayerName(player)) ) 
                kickPlayer( player, nil, "Connection terminated to protect the core" ) 
            end 
        end 
  
        -- Increment or reset fail counter 
        g_IntegrityFailCount = fail and g_IntegrityFailCount + 1 or 0 
  
        -- Two fails in a row triggers a script restart 
        if g_IntegrityFailCount > 1 then 
            outputRace( "Race script integrity compromised - Restarting" ) 
            exports.mapmanager:changeGamemode( getResourceFromName('race') ) 
        end  
    end, 
    1000,0 
) 

I must be missing someting, thanks in advance for your help :)

Link to comment

That is actually a pretty frequent question. The script integrity test is used to protect all the global tables from being messed up. Normally the server is supposed to kick the messed up player but this often fails for a reason: The race resource does not have the permission to kick a player.

To solve this problem just add this to the Admin Group:

<object name="resource.race"></object> 

Edited by Guest
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...