Advertisement
Guest User

Untitled

a guest
Jan 26th, 2015
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. elseif(string.sub(t,1,11) == "!removetime" && ply:IsAdmin()) then
  2. local args = string.Explode(" ",t)
  3. if #args < 2 then
  4. gtimer.AddText(ply,"Incorrect arguments for !removetime [style] [wr]")
  5. return ""
  6. else
  7. local s1 = tonumber(args[2])
  8. local s2 = tonumber(args[3])
  9. if not s1 or not s2 then
  10. gtimer.AddText(ply,"Incorrect arguments for !removetime (have to be both numbers)")
  11. return ""
  12. end
  13.  
  14. if s1 < 1 or (s1 > 6 and s1 != 100) then
  15. gtimer.AddText(ply,"Incorrect style number entered (1 normal, 2 sw, 3 wonly, 4 hsw, 5 cps, 6 scroll, 100 bonus)")
  16. return ""
  17. end
  18.  
  19. local suid, tuid = nil, nil
  20. for i,d in pairs(gtimer.records[s1]) do
  21. if i == s2 then
  22. if d['steam64_id'] and type(d['steam64_id']) == "string" then
  23. suid = tonumber(d['steam64_id'])
  24. end
  25. tuid = i
  26. break
  27. end
  28. end
  29.  
  30. if not suid then
  31. gtimer.AddText(ply,"No time found for this style")
  32. return ""
  33. else
  34. gtimer.AddText(ply,"Record found.")
  35. sql.Query( "DELETE FROM bh_worldrecords WHERE map_name = '" .. game.GetMap() .. "' AND steam64_id = " .. suid .. " AND type = " .. s1 )
  36. if tuid then table.remove(gtimer.records[s1], tuid) end
  37. gtimer.AddText(ply,"Record removed from table.")
  38.  
  39. if s2 == 1 then
  40. if WRBot[ s1 ] and WRBot[ s1 ]:IsValid() then
  41. WRBot[ s1 ]:Kick("Bot deleted")
  42. end
  43.  
  44. for _,v in pairs(player.GetAll()) do
  45. if v:IsBot() and IsValid(v) then
  46. if v.Style == s1 then
  47. v:Kick("Bot deleted")
  48. end
  49. end
  50. end
  51.  
  52. if(file.Exists("botfiles/"..game.GetMap().."_"..s1..".txt","DATA")) then
  53. file.Delete("botfiles/"..game.GetMap().."_"..s1..".txt")
  54. gtimer.AddText(ply,"Bot deleted")
  55. end
  56. end
  57.  
  58. net.Start("LoadWRs")
  59. net.WriteTable(gtimer.records)
  60. net.Broadcast()
  61.  
  62. return ""
  63. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement