Jump to content

[GUI] Edit Field question


MatXpl

Recommended Posts

Posted

check what that person write in the editbox and if is not a number 0-9 then cancel it

Ingame Name : |DGT|Puma

DGT Clan Server 24/7 Owner/Scripter

MultiGameMode in progress :

n-560x95_FFFFFF_FFFFFF_0283C4_000000.png

Posted
function checkEdit(edit) 
    local text = guiGetText(edit) 
    if not tonumber(text) then return false end 
    local text = tonumber(text) 
    if text < 1 or text < 10 then return true else return false end 
end 

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.

Posted

Solidsnake14's script check if you write a number so you can only write number's

Ingame Name : |DGT|Puma

DGT Clan Server 24/7 Owner/Scripter

MultiGameMode in progress :

n-560x95_FFFFFF_FFFFFF_0283C4_000000.png

Posted

iirc cancelEvent() does nothing onClientGUIChanged. it doesnt prevent the editbox value from changing.

moreover, editbox already has it's value changed when it's called.

  
local edit = guiCreateEdit(0, 0, 1, 0.1, "", true) -- your editbox 
addEventHandler("onClientGUIChanged", edit, function()  
  guiSetText(source, guiGetText(source):gsub("[^0-9]","")) 
end) 
  

?

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