GTX Posted February 5, 2012 Share Posted February 5, 2012 It doesn't work, I do not know why. There are no errors. Code: addCommandHandler( "renamett", function( player, cmd, place, name ) if not _TESTING and not isPlayerInACLGroup(player, g_Settings.admingroup) then return end if g_SToptimesManager and g_SToptimesManager.mapTimes then local row = g_SToptimesManager.mapTimes:renamett(place, name) if row then g_SToptimesManager:updateTopText() local mapName = tostring(g_SToptimesManager.mapTimes.mapName) local placeText = place and " #" .. tostring(place) or "" outputChatBox( "Top time"..placeText.." from '" .. tostring(row.playerName) .. "' renamed by " .. getPlayerName(player), getRootElement(), 255, 255, 0 ) outputChatBox( "Top time"..placeText.." has been renamed to " .. name, getRootElement(), 255, 255, 0 ) outputServerLog( "INFO: Top time"..placeText.." from '" ..tostring(row.playerName).. "' (" ..tostring(row.timeText).. " in " ..mapName.. ") renamed by " .. getAdminNameForLog(player) ) end end end ) g_SToptimesManager.mapTimes:renamett function: function SMaptimes:renamett(place, name) time = SMaptimes:getPositionForTime( time, dateRecorded ) place = tonumber(place) or 1 -- Although the list should be sorted already, make sure self:sort() -- Remove the first row if #self.dbTable.rows >= place then -- Copy it out and then remove it from the table local row = self.dbTable.rows[place] table.remove( self.dbTable.rows, place ) table.insert( self.dbTable.rows, place, getPlayerName(name), getPlayerSerial(name), timeMS, timeText, dateRecorded, extra ) return row end return false end Link to comment
TwiX! Posted February 7, 2012 Share Posted February 7, 2012 Try: function SMaptimes:renamett(place, name) place = tonumber(place) or 1 self:sort() if #self.dbTable.rows >= place then local row = self.dbTable.rows[place] table.remove(self.dbTable.rows, place) table.insert(self.dbTable.rows, place, name) return row end return false end addCommandHandler( "renamett", function( player, cmd, place, name ) if not _TESTING and not isPlayerInACLGroup(player, g_Settings.admingroup) then return end if g_SToptimesManager and g_SToptimesManager.mapTimes then local row = g_SToptimesManager.mapTimes:renamett(place, name) if row then g_SToptimesManager:updateTopText() local mapName = tostring(g_SToptimesManager.mapTimes.mapName) local placeText = place and " #" .. tostring(place) or "" outputChatBox( "Top time"..placeText.." from '" .. tostring(row.playerName) .. "' renamed by " .. getPlayerName(player), getRootElement(), 255, 255, 0 ) outputChatBox( "Top time"..placeText.." has been renamed to " .. name, getRootElement(), 255, 255, 0 ) outputServerLog( "INFO: Top time"..placeText.." from '" ..tostring(row.playerName).. "' (" ..tostring(row.timeText).. " in " ..mapName.. ") renamed by " .. getAdminNameForLog(player) ) end end end ) Link to comment
TwiX! Posted February 7, 2012 Share Posted February 7, 2012 hm its work, btw error with client if timeText:sub(1,1) == '0' then timeText = ' ' .. timeText:sub(2) end Error - timeText 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