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
)
سويت لك مثال كامل لاني والله ما فهمت عليك