--- Server Side
executeSQLQuery( "CREATE TABLE IF NOT EXISTS `RentSystem` (text,CardType,Adham)" )
returnTable = function ( )
local sqlite = executeSQLQuery ( "SELECT * FROM RentSystem" );
if ( sqlite and type ( sqlite ) == "table" and #sqlite > 0 ) then
return sqlite
end
end
addEvent("Handler", true )
addEventHandler("Handler" , getRootElement ( ) ,
function ( text, CardType, Adham )
if ( text and CardType and Adham ) then
executeSQLQuery ( "INSERT INTO RentSystem (text,CardType,Adham) VALUES (?,?,?)",text, CardType, Adham )
triggerClientEvent ( source , "lol" , source , returnTable ( ) )
end
end )
--- Client Side
addEventHandler ( "onClientGUIClick" , root , function ( )
if ( source == Send ) then
triggerServerEvent ( "Handler" , localPlayer , guiGetText ( Edit1 ) , guiGetText ( memo ) , guiComboBoxGetItemText(com,guiCheckBoxGetSelected(com)) );
end
end )
addEvent ( "lol" , true )
addEventHandler ( "lol" , root , function ( Table )
guiGridListClear(GridList_)
for i,v in ipairs ( Table ) do
local row = guiGridListAddRow ( GridList_ );
guiGridListSetItemText ( GridList_ , row , 1 , tostring ( v["text"] ) , false , false )
guiGridListSetItemText ( GridList_ , row , 2 , tostring ( v["CardType"] ) , false , false )
guiGridListSetItemText ( GridList_ , row , 3 , tostring ( v["Adham"] ) , false , false )
end
end );