Jump to content

طلب حل مشكلة في مود


Abu-Solo

Recommended Posts

Client

serialTable = { 
	["D30DD1F9735A43BBD31BB15F655D5EA2"] = true, 
}  
	local screenW, screenH = guiGetScreenSize()
    DaamWind = guiCreateWindow((screenW - 696) / 2, (screenH - 418) / 2, 696, 418, "", false)
    guiWindowSetSizable(DaamWind, false)
    guiSetAlpha(DaamWind, 1.00)
	guiSetVisible(DaamWind,false)
    Lab = guiCreateLabel(0.35, 0.08, 0.33, 0.05, "-| لوحة اعلى 30 داعم للسيرفر  |-", true, DaamWind)
    guiSetFont(Lab, "default-bold-small")
    guiLabelSetColor(Lab, 13, 254, 252)
    DaamWin = guiCreateGridList(0.03, 0.17, 0.95, 0.61, true, DaamWind)
	guiSetFont( DaamWin , "default-bold-small")
    Row = guiGridListAddColumn(DaamWin, "اسم اللاعب", 0.5)
    xRow = guiGridListAddColumn(DaamWin, "المبلغ", 0.5)
    BTN = guiCreateButton(0.29, 0.83, 0.39, 0.09, "close|#|اغلاق", true, DaamWind)
    guiSetProperty(BTN, "NormalTextColour", "FF5CFE0C")
    LAB2 = guiCreateLabel(0.03, 0.88, 0.14, 0.05, "By Mr.Kamaro", true, DaamWind)
    guiSetFont(LAB2, "default-bold-small")
    guiLabelSetColor(LAB2, 13, 254, 252)
    GUIELAB3 = guiCreateLabel(0.79, 0.90, 0.03, 0.06, "*", true, DaamWind)
    guiSetFont(GUIELAB3, "sa-header")
    guiLabelSetColor(GUIELAB3, 13, 254, 252)
    GUIELAB4 = guiCreateLabel(0.94, 0.90, 0.03, 0.06, "*", true, DaamWind)
    guiSetFont(GUIELAB4, "sa-header")
    guiLabelSetColor(GUIELAB4, 254, 14, 14)
    GUIELAB5 = guiCreateLabel(0.86, 0.90, 0.03, 0.06, "*", true, DaamWind)
    guiSetFont(GUIELAB5, "sa-header")
    guiLabelSetColor(GUIELAB5, 92, 254, 12)    
	EdarhBTN = guiCreateButton(0.02, 0.95, 0.06, 0.03, "ادارة", true, DaamWind)    
	EdarhWND = guiCreateWindow(0.25, 0.17, 0.24, 0.21, "ادارة اللوحة", true)
	guiSetVisible(EdarhWND,false)
	PlayerEdit = guiCreateEdit(0.03, 0.27, 0.59, 0.16, "", true, EdarhWND)
	PriceEdit = guiCreateEdit(0.03, 0.62, 0.59, 0.16, "", true, EdarhWND)
	LabPlayer = guiCreateLabel(0.02, 0.14, 0.59, 0.10, "اسم اللاعب", true, EdarhWND)
	guiSetFont(LabPlayer, "default-bold-small")
	guiLabelSetColor(LabPlayer, 0, 251, 254)
	guiLabelSetHorizontalAlign(LabPlayer, "center", false)
	guiLabelSetVerticalAlign(LabPlayer, "center")
	labPrice = guiCreateLabel(0.02, 0.53, 0.59, 0.10, "المبلغ", true, EdarhWND)
	guiSetFont(labPrice, "default-bold-small")
	guiLabelSetColor(labPrice, 0, 251, 254)
	guiLabelSetHorizontalAlign(labPrice, "center", false)
	guiLabelSetVerticalAlign(labPrice, "center")
	addData = guiCreateButton(0.63, 0.25, 0.28, 0.17, "اضافة", true, EdarhWND)
	--PriceSend = guiCreateButton(0.63, 0.61, 0.28, 0.17, "اضافة", true, EdarhWND)
	Close_Btn = guiCreateButton(0.84, 0.84, 0.13, 0.10, "X", true, EdarhWND)

	addCommandHandler('داعم',
	function()
		guiSetVisible(DaamWind,true)
		showCursor( true )
		triggerServerEvent("EventS",localPlayer,localPlayer)
   end
)
addEventHandler("onClientGUIClick", root,
	function ( )
		if ( source == addData ) then
			local playerText = guiGetText(PlayerEdit)  
			local priceText = guiGetText(PriceEdit)  
			if ( playerText == "" ) or ( priceText == "" ) then outputChatBox("يجب كتآبة التحديث",255,255,0,true) return end
			triggerServerEvent ( 'add:SQL:data' , localPlayer , playerText , priceText )
			triggerServerEvent("EventS",localPlayer,localPlayer)
			guiSetVisible ( EdarhWND , false )
			guiSetVisible ( DaamWind , true )
			showCursor ( true )
			guiSetInputEnabled(false)
			guiSetText(PlayerEdit,"" )
			guiSetText(PriceEdit,"" )
		elseif ( source == BTN ) then
			guiSetVisible(DaamWind, false)
			showCursor(false)
			guiSetInputEnabled(false)
		elseif ( source == Close_Btn ) then
			guiSetVisible(EdarhWND,false)
			showCursor(false)
		elseif ( source == EdarhBTN ) then
			local serial = getPlayerSerial()
			if serialTable[serial] then
				guiSetVisible(EdarhWND,true) 
				guiSetVisible(DaamWind,false) 
				showCursor(true)
			end
		end
	end
)
addEvent('refresh:grid' , true )
addEventHandler('refresh:grid' , root,
function ( sqlTable )
	if sqlTable then
	guiGridListClear(DaamWin)
		for i,v in ipairs (sqlTable) do
			local myRow = guiGridListAddRow ( DaamWin )
			guiGridListSetItemText ( DaamWin , myRow , 1 , sqlTable[i].playerName, false , false )
			guiGridListSetItemText ( DaamWin , myRow , 2 , sqlTable[i].price , false , false )
			guiGridListSetItemColor ( DaamWin , myRow , 1 , math.random ( 255 ), math.random ( 255 ), math.random ( 255 ) )
			guiGridListSetItemColor ( DaamWin , myRow , 2 , math.random ( 255 ), math.random ( 255 ), math.random ( 255 ) )
		end
	end
end )

addEventHandler("onClientRender",root,
	function()
		if guiGetVisible(DaamWind,false) then 
			showCursor(true)
		end
	end
)

 

 

Server

local database = dbConnect( "sqlite", "d3m.db" )
local connect = dbExec ( database, " CREATE TABLE IF NOT EXISTS `Donator` ( playerName, price ) " )
	
addEvent('add:SQL:data', true )
addEventHandler('add:SQL:data' , root ,
function ( playerText, priceText )
	if playerText and priceText then
		dbExec( database, ' INSERT INTO `Donator` VALUES(?,?) ', playerText, priceText )
		refresh ( client )
	end
end )

function refresh( client )
	local check = dbQuery( database, ' SELECT * FROM `Donator` ' )
	local results = dbPoll( check, -1 )
	if ( type( results ) == 'table' and #results == 0 or not results ) then return end
	triggerClientEvent( client, 'refresh:grid', client, results )
end
addEvent( 'EventS', true ) 
addEventHandler( 'EventS', root, refresh )

 

  • Like 1
Link to comment
3 minutes ago, N3xT said:

Client


serialTable = { 
	["D30DD1F9735A43BBD31BB15F655D5EA2"] = true, 
}  
	local screenW, screenH = guiGetScreenSize()
    DaamWind = guiCreateWindow((screenW - 696) / 2, (screenH - 418) / 2, 696, 418, "", false)
    guiWindowSetSizable(DaamWind, false)
    guiSetAlpha(DaamWind, 1.00)
	guiSetVisible(DaamWind,false)
    Lab = guiCreateLabel(0.35, 0.08, 0.33, 0.05, "-| لوحة اعلى 30 داعم للسيرفر  |-", true, DaamWind)
    guiSetFont(Lab, "default-bold-small")
    guiLabelSetColor(Lab, 13, 254, 252)
    DaamWin = guiCreateGridList(0.03, 0.17, 0.95, 0.61, true, DaamWind)
	guiSetFont( DaamWin , "default-bold-small")
    Row = guiGridListAddColumn(DaamWin, "اسم اللاعب", 0.5)
    xRow = guiGridListAddColumn(DaamWin, "المبلغ", 0.5)
    BTN = guiCreateButton(0.29, 0.83, 0.39, 0.09, "close|#|اغلاق", true, DaamWind)
    guiSetProperty(BTN, "NormalTextColour", "FF5CFE0C")
    LAB2 = guiCreateLabel(0.03, 0.88, 0.14, 0.05, "By Mr.Kamaro", true, DaamWind)
    guiSetFont(LAB2, "default-bold-small")
    guiLabelSetColor(LAB2, 13, 254, 252)
    GUIELAB3 = guiCreateLabel(0.79, 0.90, 0.03, 0.06, "*", true, DaamWind)
    guiSetFont(GUIELAB3, "sa-header")
    guiLabelSetColor(GUIELAB3, 13, 254, 252)
    GUIELAB4 = guiCreateLabel(0.94, 0.90, 0.03, 0.06, "*", true, DaamWind)
    guiSetFont(GUIELAB4, "sa-header")
    guiLabelSetColor(GUIELAB4, 254, 14, 14)
    GUIELAB5 = guiCreateLabel(0.86, 0.90, 0.03, 0.06, "*", true, DaamWind)
    guiSetFont(GUIELAB5, "sa-header")
    guiLabelSetColor(GUIELAB5, 92, 254, 12)    
	EdarhBTN = guiCreateButton(0.02, 0.95, 0.06, 0.03, "ادارة", true, DaamWind)    
	EdarhWND = guiCreateWindow(0.25, 0.17, 0.24, 0.21, "ادارة اللوحة", true)
	guiSetVisible(EdarhWND,false)
	PlayerEdit = guiCreateEdit(0.03, 0.27, 0.59, 0.16, "", true, EdarhWND)
	PriceEdit = guiCreateEdit(0.03, 0.62, 0.59, 0.16, "", true, EdarhWND)
	LabPlayer = guiCreateLabel(0.02, 0.14, 0.59, 0.10, "اسم اللاعب", true, EdarhWND)
	guiSetFont(LabPlayer, "default-bold-small")
	guiLabelSetColor(LabPlayer, 0, 251, 254)
	guiLabelSetHorizontalAlign(LabPlayer, "center", false)
	guiLabelSetVerticalAlign(LabPlayer, "center")
	labPrice = guiCreateLabel(0.02, 0.53, 0.59, 0.10, "المبلغ", true, EdarhWND)
	guiSetFont(labPrice, "default-bold-small")
	guiLabelSetColor(labPrice, 0, 251, 254)
	guiLabelSetHorizontalAlign(labPrice, "center", false)
	guiLabelSetVerticalAlign(labPrice, "center")
	addData = guiCreateButton(0.63, 0.25, 0.28, 0.17, "اضافة", true, EdarhWND)
	--PriceSend = guiCreateButton(0.63, 0.61, 0.28, 0.17, "اضافة", true, EdarhWND)
	Close_Btn = guiCreateButton(0.84, 0.84, 0.13, 0.10, "X", true, EdarhWND)

	addCommandHandler('داعم',
	function()
		guiSetVisible(DaamWind,true)
		showCursor( true )
		triggerServerEvent("EventS",localPlayer,localPlayer)
   end
)
addEventHandler("onClientGUIClick", root,
	function ( )
		if ( source == addData ) then
			local playerText = guiGetText(PlayerEdit)  
			local priceText = guiGetText(PriceEdit)  
			if ( playerText == "" ) or ( priceText == "" ) then outputChatBox("يجب كتآبة التحديث",255,255,0,true) return end
			triggerServerEvent ( 'add:SQL:data' , localPlayer , playerText , priceText )
			triggerServerEvent("EventS",localPlayer,localPlayer)
			guiSetVisible ( EdarhWND , false )
			guiSetVisible ( DaamWind , true )
			showCursor ( true )
			guiSetInputEnabled(false)
			guiSetText(PlayerEdit,"" )
			guiSetText(PriceEdit,"" )
		elseif ( source == BTN ) then
			guiSetVisible(DaamWind, false)
			showCursor(false)
			guiSetInputEnabled(false)
		elseif ( source == Close_Btn ) then
			guiSetVisible(EdarhWND,false)
			showCursor(false)
		elseif ( source == EdarhBTN ) then
			local serial = getPlayerSerial()
			if serialTable[serial] then
				guiSetVisible(EdarhWND,true) 
				guiSetVisible(DaamWind,false) 
				showCursor(true)
			end
		end
	end
)
addEvent('refresh:grid' , true )
addEventHandler('refresh:grid' , root,
function ( sqlTable )
	if sqlTable then
	guiGridListClear(DaamWin)
		for i,v in ipairs (sqlTable) do
			local myRow = guiGridListAddRow ( DaamWin )
			guiGridListSetItemText ( DaamWin , myRow , 1 , sqlTable[i].playerName, false , false )
			guiGridListSetItemText ( DaamWin , myRow , 2 , sqlTable[i].price , false , false )
			guiGridListSetItemColor ( DaamWin , myRow , 1 , math.random ( 255 ), math.random ( 255 ), math.random ( 255 ) )
			guiGridListSetItemColor ( DaamWin , myRow , 2 , math.random ( 255 ), math.random ( 255 ), math.random ( 255 ) )
		end
	end
end )

addEventHandler("onClientRender",root,
	function()
		if guiGetVisible(DaamWind,false) then 
			showCursor(true)
		end
	end
)

 

 

Server


local database = dbConnect( "sqlite", "d3m.db" )
local connect = dbExec ( database, " CREATE TABLE IF NOT EXISTS `Donator` ( playerName, price ) " )
	
addEvent('add:SQL:data', true )
addEventHandler('add:SQL:data' , root ,
function ( playerText, priceText )
	if playerText and priceText then
		dbExec( database, ' INSERT INTO `Donator` VALUES(?,?) ', playerText, priceText )
		refresh ( client )
	end
end )

function refresh( client )
	local check = dbQuery( database, ' SELECT * FROM `Donator` ' )
	local results = dbPoll( check, -1 )
	if ( type( results ) == 'table' and #results == 0 or not results ) then return end
	triggerClientEvent( client, 'refresh:grid', client, results )
end
addEvent( 'EventS', true ) 
addEventHandler( 'EventS', root, refresh )

 

علي بالطلاق انك شنب ولد شنب ورجال ولد رجال

والله انك فكيت ازمتي ياخي

 

يعطيك الف الف عافية

والله ماقصرت انت واللي حاولو يساعدوني

تســـلم علي المساعدة #

تقبل احلي مرور يا احلي مبرمج ^:^

  • Like 1
Link to comment
--#Client side
serialTable = { 
	["D30DD1F9735A43BBD31BB15F655D5EA2"] = true,
};
	local screenW, screenH = guiGetScreenSize()
    DaamWind = guiCreateWindow((screenW - 696) / 2, (screenH - 418) / 2, 696, 418, "", false)
    guiWindowSetSizable(DaamWind, false)
    guiSetAlpha(DaamWind, 1.00)
	guiSetVisible(DaamWind,false)
    Lab = guiCreateLabel(0.35, 0.08, 0.33, 0.05, "-| لوحة اعلى 30 داعم للسيرفر  |-", true, DaamWind)
    guiSetFont(Lab, "default-bold-small")
    guiLabelSetColor(Lab, 13, 254, 252)
    DaamWin = guiCreateGridList(0.03, 0.17, 0.95, 0.61, true, DaamWind)
	guiSetFont( DaamWin , "default-bold-small")
    Row = guiGridListAddColumn(DaamWin, "اسم اللاعب", 0.5)
    xRow = guiGridListAddColumn(DaamWin, "المبلغ", 0.5)
    BTN = guiCreateButton(0.29, 0.83, 0.39, 0.09, "close|#|اغلاق", true, DaamWind)
    guiSetProperty(BTN, "NormalTextColour", "FF5CFE0C")
    LAB2 = guiCreateLabel(0.03, 0.88, 0.14, 0.05, "By Mr.Kamaro", true, DaamWind)
    guiSetFont(LAB2, "default-bold-small")
    guiLabelSetColor(LAB2, 13, 254, 252)
    GUIELAB3 = guiCreateLabel(0.79, 0.90, 0.03, 0.06, "*", true, DaamWind)
    guiSetFont(GUIELAB3, "sa-header")
    guiLabelSetColor(GUIELAB3, 13, 254, 252)
    GUIELAB4 = guiCreateLabel(0.94, 0.90, 0.03, 0.06, "*", true, DaamWind)
    guiSetFont(GUIELAB4, "sa-header")
    guiLabelSetColor(GUIELAB4, 254, 14, 14)
    GUIELAB5 = guiCreateLabel(0.86, 0.90, 0.03, 0.06, "*", true, DaamWind)
    guiSetFont(GUIELAB5, "sa-header")
    guiLabelSetColor(GUIELAB5, 92, 254, 12)    
	EdarhBTN = guiCreateButton(0.02, 0.95, 0.06, 0.03, "ادارة", true, DaamWind)    
	EdarhWND = guiCreateWindow(0.25, 0.17, 0.24, 0.21, "ادارة اللوحة", true)
	guiSetVisible(EdarhWND,false)
	PlayerEdit = guiCreateEdit(0.03, 0.27, 0.59, 0.16, "", true, EdarhWND)
	PriceEdit = guiCreateEdit(0.03, 0.62, 0.59, 0.16, "", true, EdarhWND)
	LabPlayer = guiCreateLabel(0.02, 0.14, 0.59, 0.10, "اسم اللاعب", true, EdarhWND)
	guiSetFont(LabPlayer, "default-bold-small")
	guiLabelSetColor(LabPlayer, 0, 251, 254)
	guiLabelSetHorizontalAlign(LabPlayer, "center", false)
	guiLabelSetVerticalAlign(LabPlayer, "center")
	labPrice = guiCreateLabel(0.02, 0.53, 0.59, 0.10, "المبلغ", true, EdarhWND)
	guiSetFont(labPrice, "default-bold-small")
	guiLabelSetColor(labPrice, 0, 251, 254)
	guiLabelSetHorizontalAlign(labPrice, "center", false)
	guiLabelSetVerticalAlign(labPrice, "center")
	addData = guiCreateButton(0.63, 0.25, 0.28, 0.17, "اضافة", true, EdarhWND)
	--PriceSend = guiCreateButton(0.63, 0.61, 0.28, 0.17, "اضافة", true, EdarhWND)
	Close_Btn = guiCreateButton(0.84, 0.84, 0.13, 0.10, "X", true, EdarhWND)
addCommandHandler('داعم',
	function()
		guiSetVisible(DaamWind,true)
		showCursor( true )
   end
)
addEventHandler("onClientGUIClick", root,
	function ( )
		if ( source == addData ) then
			local playerText = guiGetText(PlayerEdit)  
			local priceText = guiGetText(PriceEdit)  
			if ( playerText == "" ) or ( priceText == "" ) then outputChatBox("يجب كتآبة التحديث",255,255,0,true) return end
			triggerServerEvent ( 'add:SQL:data' , localPlayer , playerText , priceText )
			guiSetVisible ( EdarhWND , false )
			guiSetVisible ( DaamWind , true )
			showCursor ( true )
			guiSetInputEnabled(false)
			guiSetText(PlayerEdit,"" )
			guiSetText(PriceEdit,"" )
		elseif ( source == BTN ) then
			guiSetVisible(DaamWind, false)
			showCursor(false)
			guiSetInputEnabled(false)
		elseif ( source == Close_Btn ) then
			guiSetVisible(EdarhWND,false)
			showCursor(false)
		elseif ( source == EdarhBTN ) then
			local serial = getPlayerSerial()
			if serialTable[serial] then
				guiSetVisible(EdarhWND,true) 
				guiSetVisible(DaamWind,false) 
				showCursor(true)
			end
		end
	end
)
addEvent('refresh:my:grid' , true )
addEventHandler('refresh:my:grid' , root,
function ( sqlTable )
	if sqlTable then
		for Value1 , Value2 in ipairs ( sqlTable ) do
			local myRow = guiGridListAddRow ( DaamWin )
			guiGridListSetItemText ( DaamWin , myRow , 1 , Value2.player , false , false )
			guiGridListSetItemText ( DaamWin , myRow , 2 , Value2.price , false , false )
			guiGridListSetItemColor ( DaamWin , myRow , 1 , math.random ( 255 ), math.random ( 255 ), math.random ( 255 ) )
			guiGridListSetItemColor ( DaamWin , myRow , 2 , math.random ( 255 ), math.random ( 255 ), math.random ( 255 ) )
		end
	end
end )
addEventHandler("onClientRender",root,
	function()
		if guiGetVisible(DaamWind,false) then 
			showCursor(true)
		end
	end
)
--#Server side
executeSQLQuery ( 'CREATE TABLE IF NOT EXISTS donatorTable ( player, price )' )
	
function refreshGrids( )
setTimer( function(  )
    result = executeSQLQuery( 'SELECT * FROM donatorTable' )
    if ( type ( result ) == "table" and #result == 0 or not result ) then return end
    triggerClientEvent ( root , 'refresh:my:grid' , root , result )
end, 1000, 1 )
end
addEvent('EventS', true )
addEventHandler('EventS' , root, refreshGrids)
addEventHandler('onResourceStart' , resourceRoot, refreshGrids)
	
addEvent('add:SQL:data', true )
addEventHandler('add:SQL:data' , root ,
function ( playerText, priceText )
	if playerText and priceText then
		result = executeSQLQuery("SELECT * FROM `donatorTable` WHERE `player` =?", playerText)
		if ( type ( result ) == "table" and #result == 0 ) or not result then
			executeSQLQuery( 'INSERT INTO donatorTable (player, price) VALUES ( ?,? )' , playerText, priceText )
			refreshGrids()
		else
			local updatePrice = result[1]["price"] + priceText
			executeSQLQuery( 'UPDATE donatorTable SET price =? WHERE player =?', updatePrice, playerText)	
			refreshGrids()
		end
	end
end )

لو حليت المشكلة خلاص ^

ماشفت الردود لأن الموضوع مارفرشته

Edited by MR.GRAND
  • Like 1
Link to comment

جانب سيرفر حقي عدله للتالي, لأن كان فيه خطأ بسيط

 

local database = dbConnect( "sqlite", "d3m.db" )
local connect = dbExec ( database, " CREATE TABLE IF NOT EXISTS `Donator` ( playerName, price ) " )
	
addEvent('add:SQL:data', true )
addEventHandler('add:SQL:data' , root ,
function ( playerText, priceText )
	if playerText and priceText then
		dbExec( database, ' INSERT INTO `Donator` VALUES(?,?) ', playerText, priceText )
		refresh ( )
	end
end )

function refresh( )
	local check = dbQuery( database, ' SELECT * FROM `Donator` ' )
	local results = dbPoll( check, -1 )
	if ( type( results ) == 'table' and #results == 0 or not results ) then return end
	triggerClientEvent( root, 'refresh:grid', root, results )
end
addEvent( 'EventS', true ) 
addEventHandler( 'EventS', root, refresh )

 

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