iMr.3a[Z]eF Posted May 15, 2013 Share Posted May 15, 2013 السلآم عليكم ورحمة الله وبركاته .. -- Server addEventHandler ( "onResourceStart", resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS SQL_Amlak_System (serial,name,number)" ); outputDebugString("SQL Data Base Started!",0,0,255,0,0); for i, player in ipairs( getElementsByType( 'player' ) ) do if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( "Console" ) ) then setElementData( player, 'isAdmin', true); else setElementData( player, 'isAdmin', nil); end end end ); function setSQL_Amlak_System ( serial,name,number ) return executeSQLQuery ( "INSERT INTO `SQL_Amlak_System` ( `serial`, `name` , `number` ) VALUES ( ?,?,? )", tostring(name),tostring(serial),tostring(number) ); end; function SelectFromSql ( ) local data = executeSQLQuery ( "SELECT * FROM SQL_Amlak_System" ) if ( type ( data ) == "table" and #data == 0) or not data then return { }; else return data; end; end; function UpDateListInSql ( element ) if ( not isElement ( element ) ) then return; end; local Upsql = SelectFromSql ( ); triggerClientEvent ( element, "AddSerialName", element, Upsql ); end; addEvent ( "Rferesh", true ) addEventHandler ( "Rferesh", root, function ( ) UpDateListInSql ( source ); end ) addEvent ( "SQL_Save", true ) addEventHandler ( "SQL_Save", root, function ( serial,name,number ) setSQL_Amlak_System ( serial,name,number ); triggerClientEvent ( root, "AddDataSerialName", root,serial,name,number ); end ); addEventHandler( 'onPlayerLogin', root, function( _, acc ) if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( "Console" ) ) then setElementData( source, 'isAdmin', true); else setElementData( source, 'isAdmin', nil); end; end ); addEventHandler( 'onPlayerLogout', root, function( _, acc ) triggerClientEvent( source,'LogOutSetVisible',root); setElementData( source, 'isAdmin', nil); end ); addEventHandler( 'onPlayerJoin', root, function( _, acc, playerSource ) local sourceAccount = getPlayerAccount ( playerSource ) if isGuestAccount ( sourceAccount ) then setElementData( playerSource, 'isAdmin', nil); end; end ) أبي تضيفون أي أحد يخش السيرفر ما تطلع له اللوحة ذذ Link to comment
iPrestege Posted May 15, 2013 Share Posted May 15, 2013 -- Server addEventHandler ( "onResourceStart", resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS SQL_Amlak_System (serial,name,number)" ); outputDebugString("SQL Data Base Started!",0,0,255,0,0); for i, player in ipairs( getElementsByType( 'player' ) ) do if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( "Console" ) ) then setElementData( player, 'isAdmin', true); else setElementData( player, 'isAdmin', nil); end end end ); function setSQL_Amlak_System ( serial,name,number ) return executeSQLQuery ( "INSERT INTO `SQL_Amlak_System` ( `serial`, `name` , `number` ) VALUES ( ?,?,? )", tostring(name),tostring(serial),tostring(number) ); end; function SelectFromSql ( ) local data = executeSQLQuery ( "SELECT * FROM SQL_Amlak_System" ) if ( type ( data ) == "table" and #data == 0) or not data then return { }; else return data; end; end; function UpDateListInSql ( element ) if ( not isElement ( element ) ) then return; end; local Upsql = SelectFromSql ( ); triggerClientEvent ( element, "AddSerialName", element, Upsql ); end; addEvent ( "Rferesh", true ) addEventHandler ( "Rferesh", root, function ( ) UpDateListInSql ( source ); end ) addEvent ( "SQL_Save", true ) addEventHandler ( "SQL_Save", root, function ( serial,name,number ) setSQL_Amlak_System ( serial,name,number ); triggerClientEvent ( root, "AddDataSerialName", root,serial,name,number ); end ); addEventHandler( 'onPlayerLogin', root, function( _, acc ) if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( "Console" ) ) then setElementData( source, 'isAdmin', true); else setElementData( source, 'isAdmin', nil); end; end ); addEventHandler( 'onPlayerLogout', root, function( _, acc ) triggerClientEvent( source,'LogOutSetVisible',source); setElementData( source, 'isAdmin', nil); end ); addEventHandler( 'onPlayerJoin', root, function( ) setElementData( source, 'isAdmin', nil); end ) Link to comment
iMr.3a[Z]eF Posted May 15, 2013 Author Share Posted May 15, 2013 شكرا جزيلاً... تم الإفادة 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