Jump to content

Ban Time and Reason GUI


Sasu

Recommended Posts

Sorry but How to ban a player with number that I writed on Edit(Minutes). and only ban If I write a reason.

Server-side:

function banear(text, adminBanner, timeBan, editText) 
        thePlayer = getPlayerFromName(text) 
        if not thePlayer then  
        outputChatBox("Selecciona a un jugador de la lista", source,255,0,0,true) return end 
        if tonumber(timeBan) then 
                theTimeBan = math.floor(tonumber(timeBan)*60*1000) 
                banPlayer(thePlayer, false, false, true, adminBanner, editText, theTimeBan) 
            end 
            end 
addEvent("banHim", true) 
addEventHandler("banHim", getRootElement(), banear) 

Client-Side:

function banearButton (text, adminBanner, timeBan, editText) 
    if source == banButton then 
        local timeBan = guiGetText(timeEdit) 
        local selected = guiGridListGetSelectedItem( playerLista ) 
        local text = guiGridListGetItemText( playerLista, selected, 1 ) 
        local editText = guiGetText( reasonEdit ) 
        local adminBanner = getPlayerName(getLocalPlayer()) 
        if timeBan then 
                triggerServerEvent("banHim", root, text, adminBanner, timeBan, editText) 
        else 
            outputChatBox("Escribe el tiempo de duracion",255,0,0,false) 
            end 
        end 
    end 
addEventHandler("onClientGUIClick", root, banearButton) 

Link to comment
function banearButton (text, adminBanner, timeBan, editText) 
    if source == banButton then 
        local timeBan = guiGetText(timeEdit) 
        local selected = guiGridListGetSelectedItem( playerLista ) 
        local text = guiGridListGetItemText( playerLista, selected, 1 ) 
        local editText = guiGetText( reasonEdit ) 
        local adminBanner = getPlayerName(getLocalPlayer()) 
        if string.len ( timeBan ) > 0 and string.len ( editText ) > 0 then 
                triggerServerEvent("banHim", root, text, adminBanner, timeBan, editText) 
        else 
            outputChatBox("Escribe el tiempo de duracion",255,0,0,false) 
            end 
        end 
    end 
addEventHandler("onClientGUIClick", root, banearButton) 

function banear(text, adminBanner, timeBan, editText) 
    thePlayer = getPlayerFromName(text) 
    if not thePlayer then 
        outputChatBox("Selecciona a un jugador de la lista", source,255,0,0,true) return end 
    if (timeBan) then 
        theTimeBan = math.floor(tonumber(timeBan)*60*1000) 
        banPlayer(thePlayer, false, false, true, adminBanner, editText, theTimeBan) 
    end 
end 
addEvent("banHim", true) 
addEventHandler("banHim", getRootElement(), banear) 

Link to comment
No. The reason its work but when I put 1 on timeBan it ban me 1363299062 miliseconds = 22721,651 minutes .__.

Yes because it's seconds :

seconds: The amount of seconds the player will be banned from the server for. This can be 0 for an infinite amount of time.

-_-

theTimeBan = math.floor(tonumber(timeBan)*60*1000) 
  

I convert the miliseconds to minutes ¬¬ . I writed 1 minute why it ban me for 22721,651 minutes -.-'

Link to comment

The same time :C

EDIT: I use the reason to get minutes ban and... ._.

banPlayer(thePlayer, false, false, true, adminBanner, editText.. "( "..theTimeBan.." Min )", theTimeBan) 

and said 0 min ._.

Edited by Guest
Link to comment
Where do you get: "timeBan" from?
function banearButton (text, adminBanner, timeBan, editText) 
    if source == banButton then 
        local timeBan = guiGetText(timeEdit) 
        local selected = guiGridListGetSelectedItem( playerLista ) 
        local text = guiGridListGetItemText( playerLista, selected, 1 ) 
        local editText = guiGetText( reasonEdit ) 
        local adminBanner = getPlayerName(getLocalPlayer()) 
        if string.len ( timeBan ) > 0 and string.len ( editText ) > 0 then 
                triggerServerEvent("banHim", root, text, adminBanner, timeBan, editText) 
        else 
            outputChatBox("Escribe el tiempo de duracion",255,0,0,false) 
            end 
        end 
    end 
addEventHandler("onClientGUIClick", root, banearButton) 

function banear(text, adminBanner, timeBan, editText) 
    thePlayer = getPlayerFromName(text) 
    if not thePlayer then 
        outputChatBox("Selecciona a un jugador de la lista", source,255,0,0,true) return end 
    if (timeBan) then 
        theTimeBan = math.floor(tonumber(timeBan)*60*1000) 
        banPlayer(thePlayer, false, false, true, adminBanner, editText, theTimeBan) 
    end 
end 
addEvent("banHim", true) 
addEventHandler("banHim", getRootElement(), banear) 

Link to comment

What do you mean by "it can be converted"? the function only accepts seconds as ban time.

seconds: The amount of seconds the player will be banned from the server for. This can be 0 for an infinite amount of time.

@Sasuke: Multiply your "timeToBan" by 60.

Link to comment
What do you mean by "it can be converted"? the function only accepts seconds as ban time.
seconds: The amount of seconds the player will be banned from the server for. This can be 0 for an infinite amount of time.

@Sasuke: Multiply your "timeToBan" by 60.

-_- Lol? but in the admin panel u can use min .

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...