Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ****************************************************************************
- --
- -- RECURSO: Bigeye
- -- ARCHIVO: comandos.lua
- -- PROPOSITO: Comandos de servidor.
- -- CREADORES: Stefano Aguilera Humeney < Gothem >
- --
- -- ****************************************************************************
- function f_agregarBan ( admin, jugador, razon, tiempo, ip, cuenta, serial )
- -- Revisa que efectivamente se posean los permisos para expulsar al jugador.
- if not Permiso ( admin, 'command.ban' ) then return false end
- -- Revisa si es que el jugador esta en juego
- if type( jugador ) == 'string' then
- jugador = ( t_jugadores[ tonumber(jugador) ] ) and t_jugadores[tonumber(jugador)][1] or getPlayerFromName( jugador ) or jugador
- end
- -- Si es que es un jugador en juego, lo expulsa.
- if isElement( jugador ) then
- -- Previene que se expulse a si mismo.
- if admin == jugador then
- outputChatBox ( '[BIGEYE] Por qué te intentas expulsar a ti mismo?', admin, 255, 0, 0 )
- return false
- end
- if not ip and not cuenta and not serial then
- outputChatBox ( '[BIGEYE] No hay metodo para expulsar...', admin, 255, 0, 0 )
- return false
- end
- local nadm = admin.name
- local incg = admin:getData("mincogn")
- if incg and incg == 1 then
- nadm = "Un staff"
- else
- nadm = tostring(admin.name)
- end
- outputServerLog("BIGEYE: BAN | ".. jugador.name .." | ".. admin.name .." | "..tiempo )
- if tonumber(tiempo) == 0 then
- outputChatBox ( '[BIGEYE] ' .. nadm .. ' ha baneado perma a ' .. jugador.name..' #ffffff(Razón: '..tostring(razon)..')', root, 255, 0, 0, true )
- elseif (tonumber(tiempo) > 0 and tonumber(tiempo) < 3600) then
- outputChatBox ( '[BIGEYE] ' .. nadm .. ' ha baneado a ' .. jugador.name..' por '..tonumber(tiempo/60)..' minutos #ffffff(Razón: '..tostring(razon)..')', root, 255, 0, 0, true )
- elseif (tonumber(tiempo) >= 3600 and tonumber(tiempo) < 86400) then
- outputChatBox ( '[BIGEYE] ' .. nadm .. ' ha baneado a ' .. jugador.name..' por '..tonumber(math.ceil(tiempo/3600))..' horas #ffffff(Razón: '..tostring(razon)..')', root, 255, 0, 0, true )
- elseif (tonumber(tiempo) >= 86400) then
- outputChatBox ( '[BIGEYE] ' .. nadm .. ' ha baneado a ' .. jugador.name..' por '..tonumber(math.ceil(tiempo/86400))..' días #ffffff(Razón: '..tostring(razon)..')', root, 255, 0, 0, true )
- end
- if cuenta then
- setAccountData(cuenta,"be_ban_cuenta",getRealTime().timestamp+tiempo)
- end
- return banPlayer ( jugador, ip and true or false, true, serial and true or false , admin, razon, tiempo )
- --return addBan()
- end
- -- Previene expulsión a si mismo.
- if ip == admin.ip or cuenta == admin.getAccount(admin) or serial == admin.serial then
- outputChatBox ( '[BIGEYE] Por qué te intentas expulsar a ti mismo?', admin, 255, 0, 0 )
- return false
- end
- return addBan ( ip, getAccountName(cuenta) or cuenta, serial, admin, razon, tiempo )
- end
- function f_ban_handler ( admin, _, jugador, tiempo, ip, serial, ... )
- local razon = table.concat( {...}, " " )
- ip = ( ip and ip:find("%w+%.%w+%.%w+%.%w+") ) and ip or nil
- serial = ( serial and serial:len() == 32 ) and serial or nil
- if not jugador or not tiempo then
- outputChatBox ( '[BIGEYE] /ban ( nombre_jugador | ID ) ( tiempo[s] ) [ (ip) (serial) ( razón ) ]', admin, 255, 255, 0 )
- return false
- end
- if not f_agregarBan ( admin, jugador, razon, tiempo, ip, serial ) then
- outputChatBox ( '[BIGEYE] No se pudo agregar la expulsión!', admin, 255, 0, 0 )
- return false
- end
- return true
- end
- addCommandHandler ( 'ban', f_ban_handler, true )
- function f_be_ban_handler ( jugador, razon, tiempo, ip, cuenta, serial )
- if not jugador or not razon or not tiempo then
- outputDebugString ( 'Faltan argumentos @ f_be_ban_handler', 2 )
- return false
- end
- if not ip and not cuenta and not serial then
- outputChatBox("[ERROR] No hay metodo de sanción.", source, 255, 0, 0)
- return
- end
- if tiempo == '' then
- tiempo = 0
- end
- if cuenta then
- cuenta = getPlayerAccount(jugador)
- end
- local nombre = ( type(jugador) == 'string' ) and jugador or getPlayerName(jugador)
- f_agregarBan ( client, jugador, razon, tiempo * 60, ip, cuenta, serial )
- end
- addEvent('be_ban', true)
- addEventHandler('be_ban', root, f_be_ban_handler)
- addEvent("be_unban",true)
- addEventHandler("be_unban",root,function(Jugador, IP, Serial)
- local nombreadm = getAccountName(getPlayerAccount(source))
- if Permiso(source,"command.unban") then
- for k,v in ipairs(getBans()) do
- if getBanIP(v) == IP or getBanSerial(v) == Serial then
- outputServerLog("BIGEYE: UNBAN | "..nombreadm.." | "..tostring(getBanUsername(v)).." | "..tostring(getBanIP(v)))
- removeBan(v,source)
- end
- end
- local accusr = getAccount(tostring(Jugador))
- if accusr then
- setAccountData(accusr,"be_ban_cuenta",false)
- end
- end
- end)
- function secoundsToDays(secound)
- if secound then
- local value,state
- if secound >= 86400 then
- value = math.floor(secound/86400)
- if secound - (value*86400) > (60*60) then
- value = value.." dias y "..math.floor((secound - (value*86400))/(60*60)).." horas"
- else
- value = value.." dias"
- end
- state = 1
- else
- value = 0 .." dias y "..math.floor(secound/(60*60)).." horas"
- state = 2
- end
- return value
- else
- return false
- end
- end
- function antilogincuentaban(accpr,accact)
- local trban = getAccountData(accact,"be_ban_cuenta")
- local tiempo = getRealTime().timestamp
- if trban and tonumber(trban) > tonumber(tiempo) then
- kickPlayer(source,"Console","La cuenta a la que quieres acceder está baneada. Tiempo restante: "..secoundsToDays(tiempo-trban))
- elseif trban and tonumber(trban) < tonumber(tiempo) then
- setAccountData(accact,"be_ban_cuenta",false)
- end
- end
- addEventHandler("onPlayerLogin",root,antilogincuentaban)
- function f_kill_handler ( admin, _, jugador )
- if not hasObjectPermissionTo(admin,"command.akill",false) then
- outputChatBox ( '[BIGEYE] No tienes acceso a este comando', admin, 255, 0, 0 )
- return
- end
- if type(jugador) ~= 'string' then
- outputChatBox ( '[BIGEYE] No se a ingresado el jugador', admin, 255, 0, 0 )
- return
- end
- local playerid = tonumber(jugador)
- jugador = getPlayerFromName( jugador )
- if playerid and t_jugadores[playerid] then
- outputChatBox ( '[BIGEYE] Asesinado ' .. t_jugadores[playerid][1].name, admin, 200, 200, 0 )
- killPed(t_jugadores[playerid][1])
- elseif isElement(jugador) then
- outputChatBox ( '[BIGEYE] Asesinado ' .. jugador.name, admin, 200, 200, 0 )
- killPed(jugador)
- else
- outputChatBox ( '[BIGEYE] No se encontro un jugador con ese nombre u id.', admin, 255, 0, 0 )
- end
- end
- addCommandHandler('akill', f_kill_handler, true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement