Jump to content

Ban Time and Reason GUI


Sasu

Recommended Posts

Posted

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) 

State: Inactive

Posted

Instead of triggering the serverside event if TimeBan you can try

if editText and editText ~= "" then

TriggerSeverEvent here.

Posted

or you can use

string.len 

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted
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) 

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted

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

State: Inactive

Posted
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.

-_-

  

Posted
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 -.-'

State: Inactive

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

+

1*60*1000 = 60000

How could it become ' 22721,651 minutes ' ?

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted

._. only show banlist.xml ._.

    "6144C81929C21A254E0A4D087C9C9794" banner="Sasuke*" reason="Chau bitch puta" time="1363299062" unban="1363359062">

  

Sorry for the reason :3

State: Inactive

Posted

To convert seconds to minutes, use this:

theTimeBan = math.floor ( tonumber ( timeBan ) / 60 ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (edited)

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

State: Inactive

Posted

Where do you get: "timeBan" from?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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) 

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted

But that is useless, because the banPlayer function uses seconds, not minutes.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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 .

  

Posted

Because the script converts it.

@Sasuke: Yes, it should work.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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...