Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- elseif(string.sub(t,1,11) == "!removetime" && ply:IsAdmin()) then
- local args = string.Explode(" ",t)
- if #args < 2 then
- gtimer.AddText(ply,"Incorrect arguments for !removetime [style] [wr]")
- return ""
- else
- local s1 = tonumber(args[2])
- local s2 = tonumber(args[3])
- if not s1 or not s2 then
- gtimer.AddText(ply,"Incorrect arguments for !removetime (have to be both numbers)")
- return ""
- end
- if s1 < 1 or (s1 > 6 and s1 != 100) then
- gtimer.AddText(ply,"Incorrect style number entered (1 normal, 2 sw, 3 wonly, 4 hsw, 5 cps, 6 scroll, 100 bonus)")
- return ""
- end
- local suid, tuid = nil, nil
- for i,d in pairs(gtimer.records[s1]) do
- if i == s2 then
- if d['steam64_id'] and type(d['steam64_id']) == "string" then
- suid = tonumber(d['steam64_id'])
- end
- tuid = i
- break
- end
- end
- if not suid then
- gtimer.AddText(ply,"No time found for this style")
- return ""
- else
- gtimer.AddText(ply,"Record found.")
- sql.Query( "DELETE FROM bh_worldrecords WHERE map_name = '" .. game.GetMap() .. "' AND steam64_id = " .. suid .. " AND type = " .. s1 )
- if tuid then table.remove(gtimer.records[s1], tuid) end
- gtimer.AddText(ply,"Record removed from table.")
- if s2 == 1 then
- if WRBot[ s1 ] and WRBot[ s1 ]:IsValid() then
- WRBot[ s1 ]:Kick("Bot deleted")
- end
- for _,v in pairs(player.GetAll()) do
- if v:IsBot() and IsValid(v) then
- if v.Style == s1 then
- v:Kick("Bot deleted")
- end
- end
- end
- if(file.Exists("botfiles/"..game.GetMap().."_"..s1..".txt","DATA")) then
- file.Delete("botfiles/"..game.GetMap().."_"..s1..".txt")
- gtimer.AddText(ply,"Bot deleted")
- end
- end
- net.Start("LoadWRs")
- net.WriteTable(gtimer.records)
- net.Broadcast()
- return ""
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement