Advertisement
Guest User

race_ghost - deletetime addon

a guest
Apr 4th, 2011
484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.60 KB | None | 0 0
  1. -- Ghost deleting by Goomba
  2.  
  3. -- Add this into record_server.lua file:
  4.  
  5. addEvent("onGhostDataDelete", true)
  6. addEventHandler("onGhostDataDelete", g_Root,
  7.     function(mapName)
  8.         -- Delete current ghost
  9.         if fileExists("ghosts/" .. mapName .. ".ghost") then
  10.             fileDelete("ghosts/" .. mapName .. ".ghost")
  11.         end
  12.         -- Reinstall backup if exists
  13.         if fileExists("ghosts/" .. mapName .. ".backup") then
  14.             copyFile( "ghosts/" .. mapName .. ".backup", "ghosts/" .. mapName .. ".ghost" )
  15.         end
  16.     end
  17. )
  18.  
  19. -- Replace the deletetime command in toptimes_server.lua file:
  20.  
  21. addCommandHandler( "deletetime",
  22.     function( player, cmd, place )
  23.         if not _TESTING and not isPlayerInACLGroup(player, g_Settings.admingroup) then
  24.             return
  25.         end
  26.         if g_SToptimesManager and g_SToptimesManager.mapTimes then
  27.             local row = g_SToptimesManager.mapTimes:deletetime(place)
  28.             if row then
  29.                 g_SToptimesManager:updateTopText()
  30.                 local mapName = tostring(g_SToptimesManager.mapTimes.mapName)
  31.                 local placeText = place and " #" .. tostring(place) or ""
  32.                 outputChatBox( "Top time"..placeText.." from '" .. tostring(row.playerName) .. "' deleted by " .. getPlayerName(player) )
  33.                 outputServerLog( "INFO: Top time"..placeText.." from '" ..tostring(row.playerName).. "' (" ..tostring(row.timeText).. " in " ..mapName.. ") deleted by " .. getAdminNameForLog(player) )
  34.                 -- Delete ghostdata
  35.                 if place == 1 then
  36.                     local currentMap = exports.mapmanager:getRunningGamemodeMap()
  37.                     local mapName = getResourceName( currentMap )
  38.                     triggerEvent("onGhostDataDelete", getRootElement(), mapName)
  39.                 end
  40.             end
  41.         end
  42.     end
  43. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement