Jump to content

مشكلة + حسب فهمي


+Source|>

Recommended Posts

  • Replies 65
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

سم ي الكفو

 

-- Client
addEvent ( 'AddInGrid' , true )
addEventHandler ( 'AddInGrid' , root ,
	function( Table )
		guiGridListClear( teamList )
		for i, v in ipairs( Table ) do
		local Row = guiGridListAddRow( grdnk )
		local plr = getPlayerFromName( source )
		guiGridListSetItemText( grdnk, Row, 1, v.Serial , false, false )
		guiGridListSetItemText( grdnk, Row, 2, v.NK , false, false )
		guiGridListSetItemText( grdnk, Row, 3, v.NKC , false, false )
		guiGridListSetItemColor( grdnk, Row, 1, 0, 255, 255 )
		guiGridListSetItemColor( grdnk, Row, 2, 0, 255, 255 )
		guiGridListSetItemColor( grdnk, Row, 3, 0, 255, 255 )
		end
	end
)


addEventHandler("onClientGUIClick", root,
	function(  )
		if source == con then
			local NK1 , NKC1 = guiGetText( nkedit1 ) , guiGetText( nkedit2 )
			if ( NK1 ~= '' and NK1 ~= ' ' and NKC1 ~= '' and NKC1 ~= ' ' and NK1 ~= 'إسم التاج ؟' and NKC1 ~= 'كود اللون ؟' ) then
			triggerServerEvent ( 'add' , localPlayer , NK1 , NKC1 )
			else
			outputChatBox( " الرجاء كتابة تاج و كود لون ", 255, 0, 0, true )
			end
		end
	end
)
-- Server


addEventHandler("onResourceStart", root,
	function()
		executeSQLQuery( "CREATE TABLE IF NOT EXISTS aSave ( NK, NKC, Serial )" )
		setTimer( function()
		triggerEvent ('Refresh_',root )
		end,2000,1)
	end
)

addEvent("add", true)
addEventHandler("add", root,
	function( NK1, NKC1 )
        if NK1 and NKC1 then 
		local aSerial = getPlayerSerial ( source )
			executeSQLQuery( "INSERT INTO aSave ( NK, NKC, Serial ) VALUES( ? , ? , ? )", NK1, NKC1, aSerial )
      		for _, v in ipairs ( getElementsByType ( 'player' ) ) do
				triggerEvent ( 'Refresh_' , v )
			end
		end
	end
)

addEvent ( 'Refresh_' , true )
addEventHandler ( 'Refresh_' , root , 
	function ()
	local aSQL2 = executeSQLQuery ( 'SELECT * FROM aSave')
		if ( #aSQL2 ~= 0 ) then 
			triggerClientEvent ( root, 'AddInGrid' , root , aSQL2 )
		end 
	end 
)


addEvent("Done", true)
addEventHandler("Done", root,
	function( NK1 )
		executeSQLQuery ( "DELETE FROM aSave WHERE NK = ?", NK1 )
			for _, v in ipairs ( getElementsByType ( 'player' ) ) do
				triggerEvent ( 'Refresh_' , v )
			end
	end
)

 

Link to comment
3 minutes ago, Rakan# said:

سم ي الكفو

 


-- Client
addEvent ( 'AddInGrid' , true )
addEventHandler ( 'AddInGrid' , root ,
	function( Table )
		guiGridListClear( teamList )
		for i, v in ipairs( Table ) do
		local Row = guiGridListAddRow( grdnk )
		local plr = getPlayerFromName( source )
		guiGridListSetItemText( grdnk, Row, 1, v.Serial , false, false )
		guiGridListSetItemText( grdnk, Row, 2, v.NK , false, false )
		guiGridListSetItemText( grdnk, Row, 3, v.NKC , false, false )
		guiGridListSetItemColor( grdnk, Row, 1, 0, 255, 255 )
		guiGridListSetItemColor( grdnk, Row, 2, 0, 255, 255 )
		guiGridListSetItemColor( grdnk, Row, 3, 0, 255, 255 )
		end
	end
)


addEventHandler("onClientGUIClick", root,
	function(  )
		if source == con then
			local NK1 , NKC1 = guiGetText( nkedit1 ) , guiGetText( nkedit2 )
			if ( NK1 ~= '' and NK1 ~= ' ' and NKC1 ~= '' and NKC1 ~= ' ' and NK1 ~= 'إسم التاج ؟' and NKC1 ~= 'كود اللون ؟' ) then
			triggerServerEvent ( 'add' , localPlayer , NK1 , NKC1 )
			else
			outputChatBox( " الرجاء كتابة تاج و كود لون ", 255, 0, 0, true )
			end
		end
	end
)

-- Server


addEventHandler("onResourceStart", root,
	function()
		executeSQLQuery( "CREATE TABLE IF NOT EXISTS aSave ( NK, NKC, Serial )" )
		setTimer( function()
		triggerEvent ('Refresh_',root )
		end,2000,1)
	end
)

addEvent("add", true)
addEventHandler("add", root,
	function( NK1, NKC1 )
        if NK1 and NKC1 then 
		local aSerial = getPlayerSerial ( source )
			executeSQLQuery( "INSERT INTO aSave ( NK, NKC, Serial ) VALUES( ? , ? , ? )", NK1, NKC1, aSerial )
      		for _, v in ipairs ( getElementsByType ( 'player' ) ) do
				triggerEvent ( 'Refresh_' , v )
			end
		end
	end
)

addEvent ( 'Refresh_' , true )
addEventHandler ( 'Refresh_' , root , 
	function ()
	local aSQL2 = executeSQLQuery ( 'SELECT * FROM aSave')
		if ( #aSQL2 ~= 0 ) then 
			triggerClientEvent ( root, 'AddInGrid' , root , aSQL2 )
		end 
	end 
)


addEvent("Done", true)
addEventHandler("Done", root,
	function( NK1 )
		executeSQLQuery ( "DELETE FROM aSave WHERE NK = ?", NK1 )
			for _, v in ipairs ( getElementsByType ( 'player' ) ) do
				triggerEvent ( 'Refresh_' , v )
			end
	end
)

 

ينفع اخلي مكان السيريال اسم اللاعب

 

Link to comment
2 minutes ago, Rakan# said:

لا , الا لو اضفت داخل السكل عمود اضافي لل اسم ,

يعني كذا

addEventHandler("onResourceStart", root,
	function()
		executeSQLQuery( "CREATE TABLE IF NOT EXISTS aSave ( NK, NKC, name )" )
	end
)

addEvent("add", true)
addEventHandler("add", root,
	function( NK1, NKC1 )
        if NK1 and NKC1 then
		local aName = getPlayerName( source )
			executeSQLQuery( "INSERT INTO aSave ( NK, NKC, name ) VALUES( ? , ? , ? )", NK1, NKC1, aName )
			triggerEvent ( 'Refresh_' , root )
		end
	end
)

addEvent ( 'Refresh_' , true )
addEventHandler ( 'Refresh_' , root , 
	function ()
	local aSQL2 = executeSQLQuery ( 'SELECT * FROM aSave WHERE name = ? ', aName )
		if ( #aSQL2 ~= 0 ) then 
			triggerClientEvent ( root, 'AddInGrid' , root , aSQL2 )
		end 
	end 
)

addEvent("Donen", true)
addEventHandler("Donen", root,
	function(  )
		executeSQLQuery ( "DELETE FROM aSave" )
		triggerEvent ( 'Refresh_' , root )
	end
)

 

Link to comment

addEventHandler("onResourceStart", root,
	function()
		executeSQLQuery( "CREATE TABLE IF NOT EXISTS aSave ( NK, NKC, Serial, Name )" )
		setTimer( function()
		triggerEvent ('Refresh_',root )
		end,2000,1)
	end
)

addEvent("add", true)
addEventHandler("add", root,
	function( NK1, NKC1 )
        if NK1 and NKC1 then 
		local aSerial = getPlayerSerial ( source )
			executeSQLQuery( "INSERT INTO aSave ( NK, NKC, Serial, Name ) VALUES( ? , ? , ?  , ?)", NK1, NKC1, aSerial, Name )
      		for _, v in ipairs ( getElementsByType ( 'player' ) ) do
				triggerEvent ( 'Refresh_' , v )
			end
		end
	end
)

addEvent ( 'Refresh_' , true )
addEventHandler ( 'Refresh_' , root , 
	function ()
	local aSQL2 = executeSQLQuery ( 'SELECT * FROM aSave')
		if ( #aSQL2 ~= 0 ) then 
			triggerClientEvent ( root, 'AddInGrid' , root , aSQL2 )
		end 
	end 
)

يستحسن انك ماتشيل السيريال

 + Refresh_ بـ

لازم تخليه SELECT * FROM aSave

بدون WHERE Name مثلا

عشان يطلع لك كل اللي ارسلوا !

Edited by Rakan#
Link to comment
Just now, iMr.WiFi..! said:

 عدله لذا :


addEvent("Done", true)
addEventHandler("Done", root,
	function( NK1 )
		executeSQLQuery ( "DELETE FROM aSave WHERE NK = ?", NK1 )
			for _, v in ipairs ( getElementsByType ( 'player' ) ) do
				triggerEvent ( 'Refresh_' , v )
			end
	end
)

 

وقلي لو زبط ولا @_@ + اطرح الاخطاء الي تجيك بالديبق

نقصك تحقق ان NK1

موجود بالقاعدة.

Link to comment
1 minute ago, Deativated said:

نقصك تحقق ان NK1

موجود بالقاعدة.

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

بس ما ظبط

addEvent("Donen", true)
addEventHandler("Donen", root,
	function(  )
		executeSQLQuery ( "DELETE FROM aSave" )
		triggerEvent ( 'Refresh_' , root )
	end
)

 

Link to comment
1 hour ago, Source|> said:

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

بس ما ظبط


addEvent("Donen", true)
addEventHandler("Donen", root,
	function(  )
		executeSQLQuery ( "DELETE FROM aSave" )
		triggerEvent ( 'Refresh_' , root )
	end
)

 

addEvent ( 'Donen', true )
addEventHandler ( 'Donen', root, function (  )
    executeSQLQuery ( 'DROP TABLE aSave' )
        executeSQLQuery ( 'CREATE TABLE IF NOT EXISTS aSave ( NK, NKC, Serial, Name )' )
    triggerEvent ( 'Refresh_', root )
end )

او

addEvent ( 'Donen', true )
addEventHandler ( 'Donen', root, function (  )
    executeSQLQuery ( 'DELETE * FROM aSave' )
    triggerEvent ( 'Refresh_', root )
end )

الأثنين صحيحين

Edited by #,+( _xiRoc[K]; >
Link to comment
1 hour ago, #,+( _xiRoc[K]; > said:

addEvent ( 'Donen', true )
addEventHandler ( 'Donen', root, function (  )
    executeSQLQuery ( 'DROP TABLE aSave' )
        executeSQLQuery ( 'CREATE TABLE IF NOT EXISTS aSave ( NK, NKC, Serial, Name )' )
    triggerEvent ( 'Refresh_', root )
end )

او


addEvent ( 'Donen', true )
addEventHandler ( 'Donen', root, function (  )
    executeSQLQuery ( 'DELETE * FROM aSave' )
    triggerEvent ( 'Refresh_', root )
end )

الأثنين صحيحين

ممكن طلب ثاني

هذا لا يعمل

addEvent ( 'AddInGrid' , true )
addEventHandler ( 'AddInGrid' , root ,
	function( Table )
		guiGridListClear( grdnk )
		for i, v in ipairs( Table ) do
		local Row = guiGridListAddRow( grdnk )
		guiGridListSetItemText( grdnk, Row, 1, getPlayerName( source ) , false, false ) -- هنا
		guiGridListSetItemText( grdnk, Row, 2, v.NK , false, false )
		guiGridListSetItemText( grdnk, Row, 3, v.NKC , false, false )
		guiGridListSetItemColor( grdnk, Row, 1, 0, 255, 255 )
		guiGridListSetItemColor( grdnk, Row, 2, 0, 255, 255 )
		guiGridListSetItemColor( grdnk, Row, 3, 0, 255, 255 )
		end
	end
)

 

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...