AnoirTiza Posted January 21, 2019 Share Posted January 21, 2019 (edited) شباب ليش ماقدر استعمل الإيديت بوكس في إيفينت ثاني؟؟ -- 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 January 21, 2019 by AnoirTiza Link to comment
[T]|O|[P]George Posted January 21, 2019 Share Posted January 21, 2019 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 1 Link to comment
AnoirTiza Posted January 22, 2019 Author Share Posted January 22, 2019 11 hours ago, [T]|O|[P]George said: string.gsub كيف استعملله Link to comment
KillerX Posted January 22, 2019 Share Posted January 22, 2019 5 hours ago, AnoirTiza said: كيف استعملله https://wiki.multitheftauto.com/wiki/AR/String 1 Link to comment
!# H E R O ,_ Posted January 22, 2019 Share Posted January 22, 2019 جرب. BadBoy = getRootElement ( ) addEventHandler ( "onClientGUIChanged", BadBoy, function ( ) if source == edit_box then -- اسم الاديت if not tonumber(guiGetText(source)) then guiSetText (source, "") end end end ) 1 Link to comment
N3xT Posted January 23, 2019 Share Posted January 23, 2019 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 = يحول القيمة الموجودة الى رقم, مثلاً يحول السترنق الى رقم 3 Link to comment
Simple. Posted January 27, 2019 Share Posted January 27, 2019 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now