Fabioxps Posted April 30, 2014 Posted April 30, 2014 country because it returns an error value nil? function CToptimes:doOnServerSentToptimes( data, serverRevision, playerPosition ) outputDebug( 'TOPTIMES', 'CToptimes:doOnServerSentToptimes ' .. tostring(#data) ) -- Calc number lines to use and height of window local numLines = math.clamp( 0, #data, 50 ) self.size.y = 15 + 46 + 15 * numLines -- Set height of window local sizeX = self.size.x local sizeY = self.size.y guiSetSize( self.gui['windowbg'], sizeX, sizeY, false ) -- Make listTimes contains the correct number of labels self:updateLabelCount(numLines) -- Update the list items for i=1,numLines do local timeText = data[i].timeText if timeText:sub(1,1) == '0' then timeText = ' ' .. timeText:sub(2) end if data[i].dateRecorded == "nil" then data[i].dateRecorded = "30.03.2012" end if fileExists(":admin/client/images/flags/"..country[i]..".png") then country[i] = ":admin/client/images/flags/"..country[i]..".png" end local line = string.format( '%d. %s %s %s', i,timeText,data[i].dateRecorded,country[i],data[i].playerName ) guiSetText ( self.gui['listTimes'][i], line ) if i == playerPosition then guiLabelSetColor ( self.gui['listTimes'][i], 0, 255, 255 ) else guiLabelSetColor ( self.gui['listTimes'][i], 255, 153, 0 ) end end -- Debug if _DEBUG_CHECK then outputDebug( 'TOPTIMES', 'toptimes', string.format('crev:%s srev:%s', tostring(self.clientRevision), tostring(serverRevision) ) ) if self.clientRevision == serverRevision then outputDebug( 'TOPTIMES', 'Already have this revision' ) end end -- Update status self.clientRevision = serverRevision self.listStatus = 'Full' self:updateShow() end
Tete omar Posted April 30, 2014 Posted April 30, 2014 Could you give us more details?, i don't know what returns nil in this piece of code.
MIKI785 Posted April 30, 2014 Posted April 30, 2014 fileExists(":admin/client/images/flags/"..country[i]..".png") That's probably it, attempt to concatenate a nil value. Of course it is nil when it's nowhere defined... Lua Scripter Owner of mshost.cz MTA portal.
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