Jump to content

(Duda) EditBox y setTimer


Sergioks

Recommended Posts

Hola!

Alguien Podría Decirme, Como Usar una EditBox para ponerle un 'Timer' ( setTimer ) a mi GUI ( Panel STAFF ) ?

Osea, que no se tenga que poner ej: 1387665676 para que de un minuto.

Lo Que Quiero Decir, es. como hago, que, Lo Que Se Escriba en el EditBox, no sea leído por mili segundos, SI NO, Por Minutos.

Ej:

Escribo 10 en el EditBox. y le da, a dicho usuario, 10 minutos de Castigo. ( Sea Mute, o Ban ).

¿Alguien Podria Decirme Que Codigos Usar? o, que hacer para Ponerlo asi?

Client-Side:

function Ban1() 
local banned = guiGridListGetItemText ( GUIEditor.gridlist[1], guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ), 1 ) 
local reason = guiGetText (GUIEditor.edit[1]) 
local timeP = guiGetText ( GUIEditor.edit[2] ) 
showCursor ( true ) 
triggerServerEvent ("Ban", localPlayer, banned, reason, timeP) 
end 

Server-Side:

addEvent("Ban", true ) 
addEventHandler("Ban", root,  
function ( banned, reason, timeP ) 
  
    if ( hasObjectPermissionTo ( source, "function.banPlayer" ) ) then 
  
  
        banPlayer ( getPlayerFromName(banned), source, reason ) 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        outputChatBox ( "* " .. banned .. " Fue Baneado Por ".. timeP .." Minutos. (Razon: ".. reason ..") *", player, 255, 0, 0, true ) 
        exports["notifications"]:showBox ( source, "info","El Usuario " .. banned .. " Ha Sido Baneado Exitosamente!!\n\nRazon: " .. reason .."\nTiempo: ".. timeP ) 
        setTimer (timeP, 1) 
end 
end 
end 
) 

Agradecería Mucho Su Ayuda. :mrgreen:

Ya Esta Seria Mi Ultima Pregunta/Duda Sobre el Panel STAFF Que Estoy Desarrollando :lol:

Link to comment

Solo debes hacer el calculo, 1 minuto = 60000 milisegundos.

function Ban1() 
local banned = guiGridListGetItemText ( GUIEditor.gridlist[1], guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ), 1 ) 
local reason = guiGetText (GUIEditor.edit[1]) 
local timeP = guiGetText ( GUIEditor.edit[2] ) 
showCursor ( true ) 
triggerServerEvent ("Ban", localPlayer, banned, reason, tonumber(timeP)*60000) 
end 

Así puedes usar minutos en el 'GUIEditor.edit[2]', aunque no te veo utilizarlo al momento de bannear en server-side.

Link to comment
Solo debes hacer el calculo, 1 minuto = 60000 milisegundos.
function Ban1() 
local banned = guiGridListGetItemText ( GUIEditor.gridlist[1], guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ), 1 ) 
local reason = guiGetText (GUIEditor.edit[1]) 
local timeP = guiGetText ( GUIEditor.edit[2] ) 
showCursor ( true ) 
triggerServerEvent ("Ban", localPlayer, banned, reason, tonumber(timeP)*60000) 
end 

Así puedes usar minutos en el 'GUIEditor.edit[2]', aunque no te veo utilizarlo al momento de bannear en server-side.

Si, se me olvido ponerlo en el banPlayer. asi, no?

banPlayer ( getPlayerFromName(banned), source, reason, timeP ) 

y

setTimer (timeP, 1) 

o como..?

Link to comment
  • Recently Browsing   0 members

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