Jump to content

Problem with isTransferBoxActive...


Recommended Posts

I am making my ping kicker, but I have a problem with isTransferBoxActive()

When the map is downloading, isTransferBoxActive returns false, making it to kick the player.

But when it's downloading a map resource (txd, music, etc) isTransferBoxActive returns the right value, true.

Is this a bug?

Thanks

Link to comment

While the map is "downloading", the element count should be increasing. Try something like this

  
mapDownloading = true 
totalElements = 0 
  
function checkElementCount() 
    local tempCount = 0 
    for i,elem in ipairs(getElementsByType("object")) do 
        tempCount = tempCount + 1 
    end 
    if tempCount > totalElements then 
        totalElements = tempCount 
        setTimer(checkElementCount,1000,1) 
    else 
        mapDownloading = false 
    end 
end 
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),checkElementCount) 
  
function isMapDownloading() 
    return mapDownloading 
end 
  

Link to comment

I bet you're doing it for race, so use ScreenFadedIn and FadeOut (consult wiki for those) (race-) events to detect whether a map is loading or not. When screen is faded in, a map has been fully loaded.

Using Nextreme's suggestion with 1000+ objects map is just not reasonable.

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...