Feche1320 Posted May 20, 2011 Share Posted May 20, 2011 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
eAi Posted May 21, 2011 Share Posted May 21, 2011 Maps aren't downloaded per-se, they're loaded as elements and those elements are synced with clients. So, yes, that's to be expected. Link to comment
Feche1320 Posted May 21, 2011 Author Share Posted May 21, 2011 So how can I make my own isMapDowloading function so it won't kick it? Thanks Link to comment
NeXTreme Posted May 23, 2011 Share Posted May 23, 2011 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
eAi Posted May 23, 2011 Share Posted May 23, 2011 Bear in mind that functions like getElementsByType aren't exactly cheap, so be careful how often you run it. Link to comment
FFS-Racing Posted May 25, 2011 Share Posted May 25, 2011 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now