Jump to content

تعديل


Adham

Recommended Posts



GUIEditor = {
    combobox = {},
    edit = {},
    button = {},
    window = {},
    gridlist = {},
    memo = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
	triggerServerEvent ( "onScirpt", source )
        GUIEditor.window[1] = guiCreateWindow(215, 138, 464, 275, "", false)
        guiWindowSetSizable(GUIEditor.window[1], false)

        GUIEditor.gridlist[1] = guiCreateGridList(10, 30, 348, 117, false, GUIEditor.window[1])
        guiGridListAddColumn(GUIEditor.gridlist[1], "Text", 0.3)
		guiGridListAddColumn(GUIEditor.gridlist[1], "ad", 0.2)
		guiGridListAddColumn(GUIEditor.gridlist[1], "card", 0.2)
        GUIEditor.edit[1] = guiCreateEdit(9, 206, 207, 27, "", false, GUIEditor.window[1])
        GUIEditor.memo[1] = guiCreateMemo(256, 225, 198, 40, "", false, GUIEditor.window[1])
        GUIEditor.button[1] = guiCreateButton(145, 152, 92, 28, "", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA")
        GUIEditor.combobox[1] = guiCreateComboBox(268, 167, 186, 100, "", false, GUIEditor.window[1])
        guiComboBoxAddItem(GUIEditor.combobox[1], "stc")    
    end
)

addEventHandler ( "onClientGUIClick", root,
	function (  ) 
		if source ==  GUIEditor.button[1] then
			local Text = guiGetText (  GUIEditor.edit[1] )
			local CardType = guiComboBoxGetItemText(GUIEditor.combobox[1], guiComboBoxGetSelected(GUIEditor.combobox[1]))
			local Adham = guiGetText ( GUIEditor.memo[1] )
			local aRow = guiGridListAddRow( GUIEditor.gridlist[1] )
			guiGridListSetItemText(GUIEditor.gridlist[1],aRow, 1, Text,false,false)
			guiGridListSetItemText(GUIEditor.gridlist[1],aRow, 3, CardType,false,false)
			guiGridListSetItemText(GUIEditor.gridlist[1],aRow, 2, Adham,false,false)
			triggerServerEvent ( "Handler", localPlayer, Text, Adham, CardType )
		end
    end
)

addEvent ( "lol", true )
addEventHandler ( "lol", root,
	function ( table )
		guiGridListClear(GUIEditor.gridlist[1])
		for i, Vaule in ipairs (table) do
			local aRow = guiGridListAddRow( GUIEditor.gridlist[1] )
			guiGridListSetItemText(GUIEditor.gridlist[1],aRow, 1, Vaule.text,false,false)
			guiGridListSetItemText(GUIEditor.gridlist[1],aRow, 2, Vaule.CardType,false,false)
			guiGridListSetItemText(GUIEditor.gridlist[1],aRow, 3, Vaule.Adham,false,false)
		end
	end
)

-- Server

executeSQLQuery( "CREATE TABLE IF NOT EXISTS Systems (text,CardType,Adham)" )

addEvent ( "onScirpt", true )
addEventHandler ( "onScirpt", root,
	function ( )
		local SQLListe = executeSQLQuery ( "SELECT * FROM Systems " )
		if #SQLListe ~= 0 then
			triggerClientEvent ( client, "lol", client, SQLListe )
		end
	end
)

addEvent ( "Handler", true )
addEventHandler ( "Handler", root,
	function ( text, CardType, Adham )
	executeSQLQuery("INSERT INTO Systems ( text, CardType, Adham ) VALUES ( ?, ?, ? )", tostring ( text ), tostring ( CardType ), tostring ( Adham ) )
	end
)

سويت لك مثال كامل لاني والله ما فهمت عليك

  • Like 2
Link to comment
Just now, خلف said:

GUIEditor = {
    combobox = {},
    edit = {},
    button = {},
    window = {},
    gridlist = {},
    memo = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
	triggerServerEvent ( "onScirpt", source )
        GUIEditor.window[1] = guiCreateWindow(215, 138, 464, 275, "", false)
        guiWindowSetSizable(GUIEditor.window[1], false)

        GUIEditor.gridlist[1] = guiCreateGridList(10, 30, 348, 117, false, GUIEditor.window[1])
        guiGridListAddColumn(GUIEditor.gridlist[1], "Text", 0.3)
		guiGridListAddColumn(GUIEditor.gridlist[1], "ad", 0.2)
		guiGridListAddColumn(GUIEditor.gridlist[1], "card", 0.2)
        GUIEditor.edit[1] = guiCreateEdit(9, 206, 207, 27, "", false, GUIEditor.window[1])
        GUIEditor.memo[1] = guiCreateMemo(256, 225, 198, 40, "", false, GUIEditor.window[1])
        GUIEditor.button[1] = guiCreateButton(145, 152, 92, 28, "", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA")
        GUIEditor.combobox[1] = guiCreateComboBox(268, 167, 186, 100, "", false, GUIEditor.window[1])
        guiComboBoxAddItem(GUIEditor.combobox[1], "stc")    
    end
)

addEventHandler ( "onClientGUIClick", root,
	function (  ) 
		if source ==  GUIEditor.button[1] then
			local Text = guiGetText (  GUIEditor.edit[1] )
			local CardType = guiComboBoxGetItemText(GUIEditor.combobox[1], guiComboBoxGetSelected(GUIEditor.combobox[1]))
			local Adham = guiGetText ( GUIEditor.memo[1] )
			local aRow = guiGridListAddRow( GUIEditor.gridlist[1] )
			guiGridListSetItemText(GUIEditor.gridlist[1],aRow, 1, Text,false,false)
			guiGridListSetItemText(GUIEditor.gridlist[1],aRow, 3, CardType,false,false)
			guiGridListSetItemText(GUIEditor.gridlist[1],aRow, 2, Adham,false,false)
			triggerServerEvent ( "Handler", localPlayer, Text, Adham, CardType )
		end
    end
)

addEvent ( "lol", true )
addEventHandler ( "lol", root,
	function ( table )
		guiGridListClear(GUIEditor.gridlist[1])
		for i, Vaule in ipairs (table) do
			local aRow = guiGridListAddRow( GUIEditor.gridlist[1] )
			guiGridListSetItemText(GUIEditor.gridlist[1],aRow, 1, Vaule.text,false,false)
			guiGridListSetItemText(GUIEditor.gridlist[1],aRow, 2, Vaule.CardType,false,false)
			guiGridListSetItemText(GUIEditor.gridlist[1],aRow, 3, Vaule.Adham,false,false)
		end
	end
)

-- Server

executeSQLQuery( "CREATE TABLE IF NOT EXISTS Systems (text,CardType,Adham)" )

addEvent ( "onScirpt", true )
addEventHandler ( "onScirpt", root,
	function ( )
		local SQLListe = executeSQLQuery ( "SELECT * FROM Systems " )
		if #SQLListe ~= 0 then
			triggerClientEvent ( client, "lol", client, SQLListe )
		end
	end
)

addEvent ( "Handler", true )
addEventHandler ( "Handler", root,
	function ( text, CardType, Adham )
	executeSQLQuery("INSERT INTO Systems ( text, CardType, Adham ) VALUES ( ?, ?, ? )", tostring ( text ), tostring ( CardType ), tostring ( Adham ) )
	end
)

سويت لك مثال كامل لاني والله ما فهمت عليك

يا طيب انشاء التيبل خطا على حسب ظني

  1. executeSQLQuery( "CREATE TABLE IF NOT EXISTS Systems (text,CardType,Adham)" )

ولا هل في قيمه افتراضيه؟

Link to comment
4 minutes ago, #Soking said:

اصلن لي حاط

 

 

جرب شيلها -__-

] i ]

عشان i

هي الرقم هو يستخرج القيمه حسب الرقم

مافي مشاكل لو تسويها

v.text

برضو

4 minutes ago, خلف said:


GUIEditor = {
    combobox = {},
    edit = {},
    button = {},
    window = {},
    gridlist = {},
    memo = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
	triggerServerEvent ( "onScirpt", source )
        GUIEditor.window[1] = guiCreateWindow(215, 138, 464, 275, "", false)
        guiWindowSetSizable(GUIEditor.window[1], false)

        GUIEditor.gridlist[1] = guiCreateGridList(10, 30, 348, 117, false, GUIEditor.window[1])
        guiGridListAddColumn(GUIEditor.gridlist[1], "Text", 0.3)
		guiGridListAddColumn(GUIEditor.gridlist[1], "ad", 0.2)
		guiGridListAddColumn(GUIEditor.gridlist[1], "card", 0.2)
        GUIEditor.edit[1] = guiCreateEdit(9, 206, 207, 27, "", false, GUIEditor.window[1])
        GUIEditor.memo[1] = guiCreateMemo(256, 225, 198, 40, "", false, GUIEditor.window[1])
        GUIEditor.button[1] = guiCreateButton(145, 152, 92, 28, "", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA")
        GUIEditor.combobox[1] = guiCreateComboBox(268, 167, 186, 100, "", false, GUIEditor.window[1])
        guiComboBoxAddItem(GUIEditor.combobox[1], "stc")    
    end
)

addEventHandler ( "onClientGUIClick", root,
	function (  ) 
		if source ==  GUIEditor.button[1] then
			local Text = guiGetText (  GUIEditor.edit[1] )
			local CardType = guiComboBoxGetItemText(GUIEditor.combobox[1], guiComboBoxGetSelected(GUIEditor.combobox[1]))
			local Adham = guiGetText ( GUIEditor.memo[1] )
			local aRow = guiGridListAddRow( GUIEditor.gridlist[1] )
			guiGridListSetItemText(GUIEditor.gridlist[1],aRow, 1, Text,false,false)
			guiGridListSetItemText(GUIEditor.gridlist[1],aRow, 3, CardType,false,false)
			guiGridListSetItemText(GUIEditor.gridlist[1],aRow, 2, Adham,false,false)
			triggerServerEvent ( "Handler", localPlayer, Text, Adham, CardType )
		end
    end
)

addEvent ( "lol", true )
addEventHandler ( "lol", root,
	function ( table )
		guiGridListClear(GUIEditor.gridlist[1])
		for i, Vaule in ipairs (table) do
			local aRow = guiGridListAddRow( GUIEditor.gridlist[1] )
			guiGridListSetItemText(GUIEditor.gridlist[1],aRow, 1, Vaule.text,false,false)
			guiGridListSetItemText(GUIEditor.gridlist[1],aRow, 2, Vaule.CardType,false,false)
			guiGridListSetItemText(GUIEditor.gridlist[1],aRow, 3, Vaule.Adham,false,false)
		end
	end
)

-- Server

executeSQLQuery( "CREATE TABLE IF NOT EXISTS Systems (text,CardType,Adham)" )

addEvent ( "onScirpt", true )
addEventHandler ( "onScirpt", root,
	function ( )
		local SQLListe = executeSQLQuery ( "SELECT * FROM Systems " )
		if #SQLListe ~= 0 then
			triggerClientEvent ( client, "lol", client, SQLListe )
		end
	end
)

addEvent ( "Handler", true )
addEventHandler ( "Handler", root,
	function ( text, CardType, Adham )
	executeSQLQuery("INSERT INTO Systems ( text, CardType, Adham ) VALUES ( ?, ?, ? )", tostring ( text ), tostring ( CardType ), tostring ( Adham ) )
	end
)

سويت لك مثال كامل لاني والله ما فهمت عليك

اللي احسه الخطا منه بسبب انه حاطط بالايفينت حق ادخال القيم بالجريد لست

2 جريد لست مختلفين

Edited by Master_MTA
Link to comment

الكود حق ابو خلف

اشتغل ويجي تمام

هل فيه خطأ شباب ؟

ونا ابيه يجي للاعب الكتب بالايديت وحدد

كود بو خلف

بيجي للكل ولا ؟

Edited by Deativated
Link to comment
2 minutes ago, Deativated said:

الكود حق ابو خلف

اشتغل ويجي تمام

هل فيه خطأ شباب ؟

ونا ابيه يجي للاعب الكتب بالايديت وحدد

كود بو خلف

بيجي للكل ولا ؟

انت لو تفهمنا وش تبي بس اكون شاكر

Link to comment

يخي فهمتك اكتر من 1000 مره فوق ..

ابي لما يكتب في ايديت

ويحدد كومب بوكس

ويكتب في الميمو

ويضعط علي زر

يجي في القريد لست

اول كلوم يجي فيه

الكتبو بالايديت

والتاني الحددو بالكومب بوكس

والتالت الكتبو ب الميمو

ويتحفظ ..

Link to comment
1 minute ago, Deativated said:

يخي فهمتك اكتر من 1000 مره فوق ..

ابي لما يكتب في ايديت

ويحدد كومب بوكس

ويكتب في الميمو

ويضعط علي زر

يجي في القريد لست

اول كلوم يجي فيه

الكتبو بالايديت

والتاني الحددو بالكومب بوكس

والتالت الكتبو ب الميمو

ويتحفظ ..

اعذرني اخوي لكن ما اقدر اساعدك بدون محاولات لك كذا كانك تطلب كود جاهز 

اعذرني اني ما افهم بسرعه

Link to comment
--- # Client Side 

addEventHandler ( "onClientGUIClick" , root , function ( )
if ( source == Send ) then 
	if guiGetText ( Edit1 ) ~= "" and guiGetText ( Memo ) ~= "" then		
		triggerServerEvent ( "Handler" , localPlayer , guiGetText ( Edit1 ) , guiGetText ( Memo ) , guiComboBoxGetItemText(ComBox ,guiComboBoxGetSelected(ComBox)) );
		else
		outputChatBox("تأكد من ملء الخانات ",0,255,0)
		end
	end
end )


addEvent ( "lol" , true )
addEventHandler ( "lol" , root , function ( deafult,CardType,Adham )
guiGridListClear(GUIEditor.gridlist[3])
local row = guiGridListAddRow (GUIEditor.gridlist[3]);
guiGridListSetItemText ( GUIEditor.gridlist[3] , row , 1 , tostring ( deafult ) , false , false )
guiGridListSetItemText ( GUIEditor.gridlist[3] , row , 2 , tostring ( CardType ) , false , false )
guiGridListSetItemText ( GUIEditor.gridlist[3] , row , 3 , tostring ( Adham ) , false , false )
end
end );

--- # Server Side 

executeSQLQuery( "CREATE TABLE IF NOT EXISTS `RentSystemW` (deafult ,CardType ,Adham)" )

--returnTable = function ( )
--l-ocal sqlite = executeSQLQuery ( "SELECT * FROM RentSystemW" );
--if ( sqlite and type ( sqlite ) == "table" and #sqlite >= 0 ) then 
--return sqlite
--end
--end

addEvent("Handler", true )
addEventHandler("Handler" , getRootElement ( ) ,
function ( deafult, CardType, Adham )
if ( deafult and CardType and Adham ) then
executeSQLQuery ( "INSERT INTO RentSystemW(deafult,CardType,Adham) VALUES (?,?,?)",deafult, CardType, Adham )
triggerClientEvent ( source , "lol" , source , deafult,CardType,Adham )
end
end )

 

Link to comment

@iMr.WiFi..!

 

عندك اخطاء و كمان ماراح يظهر للكل

المهم انا سويته

 

كلينت :

aGridList_ , g = GUIEditor.gridlist[2] , guiGetText

guiSetFont( aGridList_ , 'default-bold-small' )

if ( Send ) then
addEventHandler ( 'onClientGUIClick' , Send ,
    function ( ) 
        local aText1 , aText2 , aCardType = g ( Edit1 ) , g ( memo ) , ( guiComboBoxGetItemText ( com , guiComboBoxGetSelected( com ) ) )
            if ( aText1 and aText2 and aCardType ) then
                triggerServerEvent ( 'aTrigger' , localPlayer , aText1 , aText2 , aCardType )
        end
    end , false )
end

addEventHandler ( 'onClientResourceStart' , resourceRoot ,
function ( )
    setTimer ( triggerServerEvent , 50 , 1 , 'aHandler' , localPlayer ) 
end )

addEvent ( 'AddRows', true )
addEventHandler ( 'AddRows', root ,
function ( aValue )
    for _ , v in ipairs ( aValue ) do
        local aRow = guiGridListAddRow( aGridList_ )
            guiGridListSetItemText( aGridList_ , aRow , 1, v['aText1'] , false , false )
            guiGridListSetItemText( aGridList_ , aRow , 2, v['aCardType'] , false , false )
            guiGridListSetItemText( aGridList_ , aRow , 3, v['aText2'] , false, false )
    end
end )

addEvent ( 'AddRow' , true )
addEventHandler ( 'AddRow' , root ,
function ( _1 , _2 , _3 )
    local aRow , aTable = guiGridListAddRow( aGridList_ ) , { _1 , _2 , _3 }
        for Index = 1 , 3 do
            guiGridListSetItemText( aGridList_ , aRow , Index , aTable[Index] , false , false )
    end
end )

 

سيرفر

executeSQLQuery( 'CREATE TABLE IF NOT EXISTS aRentSystem_ ( aText1 , aCardType , aText2 )' )

addEvent('aHandler', true )
addEventHandler('aHandler' , getRootElement ( ) ,
function (  )
    local aValue = executeSQLQuery( 'SELECT * FROM aRentSystem_' )
        if ( aValue and #aValue > 0 ) then
            triggerClientEvent ( source , 'AddRows' , source , aValue )
    end
end )

addEvent( 'aTrigger' , true )
addEventHandler ( 'aTrigger' , root ,
function ( aText1_ , aCardType_ , aText2_ )
    local _1 , _2 , _3 = aText1_ , aCardType_ , aText2_
    executeSQLQuery('INSERT INTO aRentSystem_ ( aText1 , aCardType , aText2 ) VALUES( ? , ? , ? ) ' , aText1_ , aCardType_ , aText2_ )
    triggerClientEvent ( root , 'AddRow' , root , _1 , _2 , _3 )
end )

 

  • Like 1
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...