Jump to content

مساعدة


Recommended Posts

شباب ليش ماقدر استعمل الإيديت بوكس في إيفينت ثاني؟؟

-- client
addEventHandler("onClientResourceStart",resourceRoot,
function ()
local screenW, screenH = guiGetScreenSize()

window = guiCreateWindow((screenW - 379) / 2, (screenH - 147) / 2, 379, 147, "Bank Security", false)
 edit_box = guiCreateEdit(42, 36, 296, 33, "", false, window)
end
)


	addEventHandler ( "onClientGUIChanged", edit_box, 
    function ( ) 
        if ( text == "" ) then 
            curText = "0" 
            guiSetText ( source, "0" ) 
            return 
        end 
  
        if ( not tonumber ( text ) ) then 
            guiSetText ( source, curText ) 
        else 
          curText = text 
        end 
    end, 
    false 
)

بدي اخليها ارقام بس تكتب في الإيديت 

Edited by AnoirTiza
Link to comment
6 minutes ago, AnoirTiza said:

شباب ليش ماقدر استعمل الإيديت بوكس في إيفينت ثاني؟؟


-- client
addEventHandler("onClientResourceStart",resourceRoot,
function ()
local screenW, screenH = guiGetScreenSize()

window = guiCreateWindow((screenW - 379) / 2, (screenH - 147) / 2, 379, 147, "Bank Security", false)
 edit_box = guiCreateEdit(42, 36, 296, 33, "", false, window)
end
)


	addEventHandler ( "onClientGUIChanged", edit_box, 
    function ( ) 
        if ( text == "" ) then 
            curText = "0" 
            guiSetText ( source, "0" ) 
            return 
        end 
  
        if ( not tonumber ( text ) ) then 
            guiSetText ( source, curText ) 
        else 
          curText = text 
        end 
    end, 
    false 
)

بدي اخليها ارقام بس تكتب في الإيديت 

string.gsub

 

  • Like 1
Link to comment
14 hours ago, #Bad_Boy, said:

جرب.


BadBoy = getRootElement ( )
addEventHandler ( "onClientGUIChanged", BadBoy,
	function ( )
		if source == edit_box then -- اسم الاديت
			if not tonumber(guiGetText(source)) then
				guiSetText (source, "")
			end
		end
	end
)

 

فاهم فكرة الفنكشن خطأ انت

tonumber = يحول القيمة الموجودة الى رقم, مثلاً يحول السترنق الى رقم

  • Like 3
Link to comment
On 22/01/2019 at 01:04, AnoirTiza said:

شباب ليش ماقدر استعمل الإيديت بوكس في إيفينت ثاني؟؟


-- client
addEventHandler("onClientResourceStart",resourceRoot,
function ()
local screenW, screenH = guiGetScreenSize()

window = guiCreateWindow((screenW - 379) / 2, (screenH - 147) / 2, 379, 147, "Bank Security", false)
 edit_box = guiCreateEdit(42, 36, 296, 33, "", false, window)
end
)


	addEventHandler ( "onClientGUIChanged", edit_box, 
    function ( ) 
        if ( text == "" ) then 
            curText = "0" 
            guiSetText ( source, "0" ) 
            return 
        end 
  
        if ( not tonumber ( text ) ) then 
            guiSetText ( source, curText ) 
        else 
          curText = text 
        end 
    end, 
    false 
)

بدي اخليها ارقام بس تكتب في الإيديت 

addEventHandler( "onClientGUIChanged", resourceRoot, function()
    if source == edit_box then
        local currText = guiGetText( source )
        local newText = string.gsub( currText, '[^0-9]', '' )
        if newText ~= currText then
            guiSetText( source, newText )
        end
    end
end)

 

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