Astreuz Posted August 7, 2014 Share Posted August 7, 2014 I have problem with map rating (build on gamemode race) In chat write: This map has no rate.Write 0-10/10 to rate this map! And i write and i no see nothing,still be write this map no rate... Code: addEvent("onMapStarting",true) addEventHandler("onMapStarting",getRootElement(), function (mapInfo) local map = exports.mapmanager:getRunningGamemodeMap() local mapname = getResourceName(map) local rate = exports.mapratings:getMapRating(mapname) if rate then local average = rate.average local players = rate.count setTimer(outputChatBox,1200,1,"#40A0E0Average rating of this map: "..getRatingColorAsHex(average)..tostring(average).."/10 #40A0E0(#ffffff"..tostring(players).." #40A0E0votes)",getRootElement(),255,255,255,true) else setTimer(outputChatBox,1200,1,"#40A0E0This map wasn't rated yet. Type #ffffff/rate #abcdef0-10 #40A0E0to rate this map",getRootElement(),255,255,255,true) end end ) function getRatingColor(rating) local r, g = -5.1*(rating^2) + 25.5*rating + 255, -5.1*(rating^2) + 76.5*rating r, g = r > 255 and 255 or math.floor(r+0.5), g > 255 and 255 or math.floor(g+0.5) return {r,g,0}--"#"..string.format("%02X", r)..string.format("%02X", g).."00" end function getRatingColorAsHex(rating) local r, g = unpack(getRatingColor(rating)) return "#"..string.format("%02X", r)..string.format("%02X", g).."00" end Sorry for my bad english. 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