Overkillz Posted November 26, 2013 Share Posted November 26, 2013 Hi all, I want to make a map info, then, i took this from a race (Map info) and doesnt work: function sendClientMapInfo(hunterReached,mapRate,ratedTimes) huntersReached = hunterReached mapRates = mapRate ratedTimess = ratedTimes end addEvent("sendClientMapInfo",true) addEventHandler("sendClientMapInfo",getLocalPlayer(),sendClientMapInfo) local name, author, lastTimePlayed, playedCount local startTick local month = {"January","February","March","April","May","June","Juli","August","September","October","November","December"} local screenWidth, screenHeight = guiGetScreenSize() local endPosition = screenHeight-140 function timestampToDate(stamp) local time = getRealTime(stamp) return string.format("%d %s %02d:%02d",time.monthday,month[time.month+1],time.hour,time.minute) end function handleMapInfo(mapInfo) name = mapInfo.name or "Unknown" author = mapInfo.author or "Unknown" lastTimePlayed = timestampToDate(mapInfo.lastTimePlayed) or "Unknown" playedCount = tostring(mapInfo.playedCount or "Unknown") maprate = mapRates or "-" ratedtimes = ratedTimess or "0" position = screenHeight+90 movePosition = 5 tickCount = 0 alpha = 0 infotop = "" infodown = "" addEventHandler("onClientRender",getRootElement(),drawMapInfo) end addEvent("onClientMapStarting",true) addEventHandler("onClientMapStarting",getRootElement(),handleMapInfo) function drawMapInfo () if tickCount == 0 then infotop = "#383535Map" infodown = name elseif tickCount == 150 then infotop = "#383535Author" infodown = author elseif tickCount == 300 then infotop = "#383535Played Count" infodown = playedCount -- elseif tickCount == 450 then -- infotop = "#ffff00Last Time Played" -- infodown = lastTimePlayed -- elseif tickCount == 600 then -- infotop = "#ffff00Rate" -- infodown = maprate.."/20" end tickCount = tickCount+1 if tickCount >= 125 then position = position +2.5 end if tickCount > 150 then position = position -5 end if tickCount > 175 then position = position +2.5 end if tickCount > 275 then position = position +2.5 end if tickCount > 300 then position = position -5 end if tickCount > 325 then position = position +2.5 end if tickCount > 425 then position = position +2.5 end -- if tickCount > 450 then -- position = position -5 -- end -- if tickCount > 475 then -- position = position +2.5 -- end -- if tickCount > 575 then -- position = position +2.5 -- end -- if tickCount > 600 then -- position = position -5 -- end -- if tickCount > 625 then -- position = position +2.5 -- end -- if tickCount > 725 then -- position = position +2.5 -- end if tickCount > 450 then removeEventHandler("onClientRender",getRootElement(),drawMapInfo) end if position == endPosition then movePosition = 0 end alpha = alpha + 5 if alpha > 255 then alpha = 255 elseif alpha < 0 then alpha = 0 end local heighResize = dxGetFontHeight(1.15, "default-bold") --Top Text dxDrawingColorText ( infotop,screenWidth/2,position-movePosition+heighResize*10,screenWidth/2,position-movePosition+heighResize*6, tocolor(255,255,255,alpha), alpha, relativeScale(screenHeight)*2, "default-bold", "center", "bottom", false, false, false ) --Down Text dxDrawingColorText ( infodown,screenWidth/2,position-movePosition+heighResize*10,screenWidth/2,position-movePosition+heighResize*7.5, tocolor(255,255,255,alpha), alpha, relativeScale(screenHeight)*2, "default-bold", "center", "bottom", false, false, false ) position = position - movePosition end function stopDrawInfo() removeEventHandler("onClientRender",getRootElement(),drawMapInfo) end I have only this and the meta This should show this: What is the problem ? Link to comment
Dealman Posted November 26, 2013 Share Posted November 26, 2013 First of all, do you have the permission to use this? Secondly, you're supposed to tell us what is wrong - so we can help. Use debugscript. Link to comment
.:HyPeX:. Posted November 26, 2013 Share Posted November 26, 2013 To start with, you probably dont know what is this nor you know how to script, else you would obiously know that this is okay, and that you are trying to copy something when you have to also call it in. You should try reading the wiki, it helps, and also, read the tutorial. https://wiki.multitheftauto.com/wiki/Sc ... troduction -- Apart, this is particulary strange, and senseless, elseif does alot better: if tickCount >= 125 then position = position +2.5 end if tickCount > 150 then position = position -5 end if tickCount > 175 then position = position +2.5 end if tickCount > 275 then position = position +2.5 end if tickCount > 300 then position = position -5 end if tickCount > 325 then position = position +2.5 end if tickCount > 425 then position = position +2.5 end -- if tickCount > 450 then -- position = position -5 -- end -- if tickCount > 475 then -- position = position +2.5 -- end -- if tickCount > 575 then -- position = position +2.5 -- end -- if tickCount > 600 then -- position = position -5 -- end -- if tickCount > 625 then -- position = position +2.5 -- end -- if tickCount > 725 then -- position = position +2.5 -- end if tickCount > 450 then removeEventHandler("onClientRender",getRootElement(),drawMapInfo) end Link to comment
Overkillz Posted November 27, 2013 Author Share Posted November 27, 2013 Problem solved, witha friend and debugscript we could fix this. Thanks. - Request to close 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