Advertisement
actuallykane

Untitled

Apr 25th, 2020
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.52 KB | None | 0 0
  1. TriggerEvent("modmin:addModule", "mod.ban", function(_source, params, denied)
  2.     if not denied then
  3.         local license, licenseBanner
  4.  
  5.         for _, v in pairs(GetPlayerIdentifiers(params.id)) do
  6.             if string.find(v, "license") then
  7.                 license = v
  8.                 break
  9.             end
  10.         end
  11.  
  12.         for _, v in pairs(GetPlayerIdentifiers(_source)) do
  13.             if string.find(v, "license") then
  14.                 licenseBanner = v
  15.                 break
  16.             end
  17.         end
  18.  
  19.         if not license or not licenseBanner then
  20.             if(not license)then print("^1[ModMin]^7 Failed banning! Could not find license of banned user") end
  21.             if(not licenseBanner)then print("^1[ModMin]^7 Failed banning! Could not find license of banner user") end
  22.  
  23.             return
  24.         end
  25.  
  26.         MySQL.Async.execute("INSERT INTO modmin_ban (identifier, name, banned, expires, reason, bannedBy, bannedByName) VALUES (@identifier, @name, now(), @bannedUntil, @reason, @bannedBy, @bannedByName)", {['@identifier'] = license, ['@name'] = GetPlayerName(params.id), ['bannedUntil'] = params.time, ['@reason'] = params.reason, ['@bannedBy'] = licenseBanner, ['@bannedByName'] = GetPlayerName(_source)}, function(result)
  27.             print("^1[ModMin]^7 Successfully banned " .. GetPlayerName(params.id) .. ", by " .. GetPlayerName(_source) .. ". For: " .. params.reason .. " (until " .. params.time .. ")")
  28.             DropPlayer(params.id, "Banned: " .. params.reason)
  29.         end)
  30.     end
  31. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement