Jump to content

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


Abu-Solo

Recommended Posts

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

والله واجهتني مشكلة وما قدرت احلها مررره

ياريت اي احد يساعدني فيها,

المشكلة كلها بـ السيرفر سايد او الكلينت,

توضيح : انا مسوي مود ومسوي حفظ علي قاعدة البيانات, ولكن المشكلة لما اشغل المود يقول كذا

image.jpgfree photo hosting

 

 

 

الاكواد

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)
        Row = guiGridListAddColumn(DaamWin, "اسم اللاعب", 0.5)
        xRow = guiGridListAddColumn(DaamWin, "المبلغ", 0.5)
        for i = 1, 2 do
            guiGridListAddRow(DaamWin)
        end

        BTN = guiCreateButton(0.29, 0.83, 0.39, 0.09, "close|#|اغلاق", true, DaamWind)
        guiSetProperty(GUBTN, "NormalTextColour", "FF5CFE0C")
        LAB2 = guiCreateLabel(0.03, 0.88, 0.14, 0.05, "By Mr.Kamaro", true, DaamWind)
        guiSetFont(LAB2, "default-bold-small")
        guiLabelSetColor(GLAB2, 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")
PlayerSend = 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)


addEventHandler("onClientGUIClick", PlayerSend,
function ( )
    aText = guiGetText(PlayerEdit)
        if ( aText == "" ) or ( aText == " " ) then  outputChatBox("يجب كتآبة التحديث",255,255,0,true)return end
            triggerServerEvent ( 'Event' , localPlayer , aText )
            guiSetVisible ( EdarhWND , false )
            guiSetVisible ( wnd , true )
            showCursor ( true )
			guiSetInputEnabled(false)
			guiSetText(SendEdit," " )
end , false )


addEventHandler('onClientResourceStart' , resourceRoot ,
function ( )
    triggerServerEvent ( 'EventS' , localPlayer )
end )

guiSetFont( DaamWin , "default-bold-small")

addEvent('addText' , true )
addEventHandler('addText' , getRootElement ( ),
function ( )
    local XaRowsX = guiGridListAddRow ( DaamWin )
        guiGridListSetItemText ( DaamWin ,  XaRowsX , 1 , aText , false , false )
        guiGridListSetItemColor ( DaamWin , XaRowsX , 1 , math.random ( 255 ), math.random ( 255 ), math.random ( 255 ) )
end )

addEvent('EventT2' , true )
addEventHandler('EventT2' , getRootElement ( ),
function ( Value )
    for Value1 , Value2 in ipairs ( Value ) do
        local XaRowsX = guiGridListAddRow ( DaamWin )
            guiGridListSetItemText ( DaamWin , XaRowsX , 1 , Value2.xRow , false , false )
            guiGridListSetItemColor ( DaamWin , XaRowsX , 1 , math.random ( 255 ), math.random ( 255 ), math.random ( 255 ) )
    end
end )


 addEvent('addTextX' , true )
addEventHandler('addTextX' , getRootElement ( ),
function ( )
    local XaRowsXx = guiGridListAddRow ( DaamWin )
        guiGridListSetItemText ( DaamWin ,  XaRowsXx , 2 , aTextX , false , false )
        guiGridListSetItemColor ( DaamWin , XaRowsXx , 2 , math.random ( 255 ), math.random ( 255 ), math.random ( 255 ) )
end )

addEvent('EventT2X' , true )
addEventHandler('EventT2X' , getRootElement ( ),
function ( Value )
    for Value1 , Value2 in ipairs ( Value ) do
        local XaRowsXx = guiGridListAddRow ( DaamWin )
            guiGridListSetItemText ( DaamWin , XaRowsXx , 2 , Value2.Row , false , false )
            guiGridListSetItemColor ( DaamWin , XaRowsXx , 2 , math.random ( 255 ), math.random ( 255 ), math.random ( 255 ) )
    end
end )

 addEventHandler("onClientGUIClick", PriceSend,
function ( )
    aTextX = guiGetText(PriceEdit)
        if ( aTextX == "" ) or ( aTextX == " " ) then  outputChatBox("يجب كتآبة التحديث",255,255,0,true)return end
            triggerServerEvent ( 'EventX' , localPlayer , aTextX )
            guiSetVisible ( EdarhWND , false )
            guiSetVisible ( wnd , true )
            showCursor ( true )
			guiSetInputEnabled(false)
			guiSetText(SendEdit," " )
end , false )
addEventHandler('onClientResourceStart' , resourceRoot ,
function ( )
    triggerServerEvent ( 'EventX' , localPlayer )
end )

Server

  executeSQLQuery ( 'CREATE TABLE IF NOT EXISTS aSokingX22DXD ( Row )' )
	
addEvent('Event', true )
addEventHandler('Event' , getRootElement ( ) ,
function ( aText )
    executeSQLQuery( 'INSERT INTO aSokingX22DXD (Row) VALUES ( ? )' , aText )
    triggerClientEvent( getRootElement ( ) , 'addText', getRootElement ( ) , aText )
end )

addEvent('EventS', true )
addEventHandler('EventS' , getRootElement ( ) ,
function ( )
    Value = executeSQLQuery( 'SELECT * FROM aSokingX22DXD' )
        if ( #Value ~= 0 ) then
            triggerClientEvent ( source , 'EventT2' , source , Value )
    end
end )

-----------




addEvent('EventX', true )
addEventHandler('EventX' , getRootElement ( ) ,
function ( aTextX )
    executeSQLQuery( 'INSERT INTO aSokingX22DXD (xRow) VALUES ( ? )' , aTextX )
    triggerClientEvent( getRootElement ( ) , 'addTextX', getRootElement ( ) , aTextX )
end )

addEvent('EventSX', true )
addEventHandler('EventSX' , getRootElement ( ) ,
function ( )
    Value = executeSQLQuery( 'SELECT * FROM aSokingX22DXD' )
        if ( #Value ~= 0 ) then
            triggerClientEvent ( source , 'EventT2X' , source , Value )
    end
end )

 

Edited by Abu-Solo
Link to comment

فاهم, ولكن انا ابغي اخليها 

2 Rows

مو واحد

 

5 minutes ago, T!GER said:

Line 27 :

 


executeSQLQuery( 'INSERT INTO aSokingX22DXD (xRow) VALUES ( ? )' , aTextX )

 

xRow = عمود غير معرف لديك في السكل تيبل 

 

بدلها بـ Row

 

@Abu-Solo

أو انشئ عمود جديد باسمة

المشكلة انحلت, بس فيه مشكلة ثانية صايره معي

image.jpgphotos upload

 

وش السبب اللي مخليها كذا؟

 

 

 

addEvent('addTextX' , true )
addEventHandler('addTextX' , getRootElement ( ),
function ( )
     XaRowsX = guiGridListAddRow ( DaamWin )
        guiGridListSetItemText ( DaamWin ,  XaRowsX , 2 , aTexat , false , false )
        guiGridListSetItemColor ( DaamWin , XaRowsX , 2 , math.random ( 255 ), math.random ( 255 ), math.random ( 255 ) )
end )
addEvent('EventT2X' , true )
addEventHandler('EventT2X' , getRootElement ( ),
function ( Value1 )
    for Value12 , Value3 in ipairs ( Value1 ) do
        local XaRowsXX = guiGridListAddRow ( DaamWin )
            guiGridListSetItemText ( DaamWin , XaRowsXX , 2 , Value3.aRows , false , false )
            guiGridListSetItemColor ( DaamWin , XaRowsXX , 2 , math.random ( 255 ), math.random ( 255 ), math.random ( 255 ) )
    end
end )

 

Edited by Abu-Solo
Link to comment
4 minutes ago, T!GER said:

عدل كود انشاء القاعده الى التالي :

 


executeSQLQuery ( 'CREATE TABLE IF NOT EXISTS aSokingX22DXD ( Row,xRow )' )

 

table aSokingx22D has no column names xRow

وش المشكلة هنا, اذا أضفت شئ, يجيني 

يجي في الرو الاول مظبوط

ولكن الرو الثاني غير مظبوط 

 

image.jpgimagehost

Edited by Abu-Solo
Link to comment
1 minute ago, </Mr.Tn6eL> said:

executeSQLQuery( 'INSERT INTO aSokingX22DXD (xRow) VALUES ( ? )' , aTextX )

لاحظ زيادة حرف اكس باسم الكولمن احذفه لان اسم العمود بدون

انا ضايف الاحرف حق الاكس, لأني مسوي اثنين .

 

executeSQLQuery( 'INSERT INTO aSokingX22DD (xRow) VALUES ( ? )' , aText )

executeSQLQuery( 'INSERT INTO aSokingX22DD (aRows) VALUES ( ? )' , aTexat )

 

Link to comment
1 minute ago, T!GER said:

مافهمنا شيء ورينا الكود الجديد بعد الاضافه والتعديل كامل

سيرفر 

executeSQLQuery ( 'CREATE TABLE IF NOT EXISTS aSokingX22DD ( aRows,Row )' )
addEvent('Event', true )
addEventHandler('Event' , getRootElement ( ) ,
function ( aText )
    executeSQLQuery( 'INSERT INTO aSokingX22DD (aRows) VALUES ( ? )' , aText )
    triggerClientEvent( getRootElement ( ) , 'addText', getRootElement ( ) , aText )
end )

addEvent('EventS', true )
addEventHandler('EventS' , getRootElement ( ) ,
function ( )
    Value = executeSQLQuery( 'SELECT * FROM aSokingX22DD' )
        if ( #Value ~= 0 ) then
            triggerClientEvent ( source , 'EventT2' , source , Value )
    end
end )

----------
addEvent('EventX', true )
addEventHandler('EventX' , getRootElement ( ) ,
function ( aTexat )
    executeSQLQuery( 'INSERT INTO aSokingX22DD (aRows) VALUES ( ? )' ,aTexat)
    triggerClientEvent( getRootElement ( ) , 'addTextX', getRootElement ( ) , aTexat )
end )

addEvent('EventSX', true )
addEventHandler('EventSX' , getRootElement ( ) ,
function ( )
    ValueX = executeSQLQuery( 'SELECT * FROM aSokingX22DD ' )
        if ( #ValueX ~= 0 ) then
            triggerClientEvent ( source , 'EventT2X' , source , ValueX )
    end
end )

كلينت


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)
		guiGridListAddColumn(DaamWin, "اسم اللاعب", 0.5)
		guiGridListAddColumn(DaamWin, "المبلغ", 0.5)
        for i = 1, 2 do
            guiGridListAddRow(DaamWin)
        end

        BTN = guiCreateButton(0.29, 0.83, 0.39, 0.09, "close|#|اغلاق", true, DaamWind)
        guiSetProperty(GUBTN, "NormalTextColour", "FF5CFE0C")
        LAB2 = guiCreateLabel(0.03, 0.88, 0.14, 0.05, "By Mr.Kamaro", true, DaamWind)
        guiSetFont(LAB2, "default-bold-small")
        guiLabelSetColor(GLAB2, 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")
PlayerSend = 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)


 
addEventHandler ("onClientGUIClick", root,
        function()
        if (source == BTN) then
         guiSetVisible(DaamWind, false)
         showCursor(false)
         guiSetInputEnabled(false)
		 elseif source == Close_Btn then
guiSetVisible(EdarhWND,false)
showCursor(false)
        end
    end
)

 
 
----------------
 
addCommandHandler('داعم',
function()
guiSetVisible(DaamWind,true)
showCursor( true )
   end
)





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

_getSerial = getPlayerSerial
function getPlayerSerial(p)
	return (isElement(p) and getElementType(p) == "player") and getElementData(p, "serial") or _getSerial()
end
serials = { ["D30DD1F9735A43BBD31BB15F655D5EA2"] = true , 
[""] = true ,
[""] = true ,
[""] = true ,
}  


addEventHandler("onClientGUIClick",root,function()
if (serials [getPlayerSerial(localPlayer)]) then
if source == EdarhBTN then
guiSetVisible(EdarhWND,true) guiSetVisible(DaamWind,false) showCursor(true)
end
end
end
)
 
 

addEventHandler("onClientGUIClick", PlayerSend,
function ( )
    aText = guiGetText(PlayerEdit)
        if ( aText == "" ) or ( aText == " " ) then  outputChatBox("يجب كتآبة التحديث",255,255,0,true)return end
            triggerServerEvent ( 'Event' , localPlayer , aText )
            guiSetVisible ( EdarhWND , false )
            guiSetVisible ( wnd , true )
            showCursor ( true )
			guiSetInputEnabled(false)
			guiSetText(SendEdit," " )
end , false )



addEventHandler('onClientResourceStart' , resourceRoot ,
function ( )
    triggerServerEvent ( 'EventS' , localPlayer )
end )

guiSetFont( DaamWin , "default-bold-small")

addEvent('addText' , true )
addEventHandler('addText' , getRootElement ( ),
function ( )
XaRowsXD = guiGridListAddRow ( DaamWin )
        guiGridListSetItemText ( DaamWin ,  XaRowsXD , 1 , aText , false , false )
        guiGridListSetItemColor ( DaamWin , XaRowsXD , 1 , math.random ( 255 ), math.random ( 255 ), math.random ( 255 ) )
end )
addEvent('EventT2' , true )
addEventHandler('EventT2' , getRootElement ( ),
function ( Value )
    for Value1 , Value2 in ipairs ( Value ) do
        local XaRowsX = guiGridListAddRow ( DaamWin )
            guiGridListSetItemText ( DaamWin , XaRowsX , 1 , Value2.aRows , false , false )
            guiGridListSetItemColor ( DaamWin , XaRowsX , 1 , math.random ( 255 ), math.random ( 255 ), math.random ( 255 ) )
    end
end )
 
 ----------------

 
addEventHandler('onClientResourceStart' , resourceRoot ,
function ( )
    triggerServerEvent ( 'EventSX' , localPlayer )
end )

guiSetFont( DaamWin , "default-bold-small")

addEvent('addTextX' , true )
addEventHandler('addTextX' , getRootElement ( ),
function ( )
     XaRowsX = guiGridListAddRow ( DaamWin )
        guiGridListSetItemText ( DaamWin ,  XaRowsX , 2 , aTexat , false , false )
        guiGridListSetItemColor ( DaamWin , XaRowsX , 2 , math.random ( 255 ), math.random ( 255 ), math.random ( 255 ) )
end )
addEvent('EventT2X' , true )
addEventHandler('EventT2X' , getRootElement ( ),
function ( Value1 )
    for Value12 , Value3 in ipairs ( Value1 ) do
        local XaRowsXX = guiGridListAddRow ( DaamWin )
            guiGridListSetItemText ( DaamWin , XaRowsXX , 2 , Value3.aRows , false , false )
            guiGridListSetItemColor ( DaamWin , XaRowsXX , 2 , math.random ( 255 ), math.random ( 255 ), math.random ( 255 ) )
    end
end )

addEventHandler("onClientGUIClick", PriceSend,
function ( )
    aTexat = guiGetText(PriceEdit)
        if ( aTexat == "" ) or ( aTexat == " " ) then  outputChatBox("يجب كتآبة التحديث",255,255,0,true)return end
            triggerServerEvent ( 'EventX' , localPlayer , aTexat )
            guiSetVisible ( EdarhWND , false )
            guiSetVisible ( wnd , true )
            showCursor ( true )
			guiSetInputEnabled(false)
			guiSetText(SendEdit," " )
end , false )

 

المشكلة انه لما اضيف كلام يجي نفس الكلام زي ماهو فـ نفس القريد وما يجي مرتب @

مدري وش المشكلة

شوف الصورة

 

image.jpg

Edited by Abu-Solo
Link to comment
Just now, N3xT said:

أنت حايس بأم الكود لدرجة الواحد صار ما يفهم أنت وش قاعد تسوي فيه

شوف الصورة اللي فوق وبتعرف المشكله ^^ 

+ كل شوي يجيني رسائل في الخاص كـ مساعدة فـ الموضوع هذا

وساعدني بعض الناس فـ حل بعض المشاكل

وهذي مشاكل جديدة جاتني

ي ليت تفهم علي ^

Edited by Abu-Solo
Link to comment

جاري التجربه...

#Edit: تم . خليته  زرار واحد فقط ولكن المشكلة اذا اضاف الكلام يجي نفس الصورة اللي وريتك فوق

تجي وحده فـ اول 

row

والثانية تجي فـ اخر 

row

# ولما اسوي اعادة تشغيل لـ المود يجيب الكلام اللي حطيته في اسم اللاعب ويحطه في المبلغ .

قبل ما اسوي ريستارت 

 

image.jpgwindows 7 screenshot

 

 

بعد ما سويت ريستارت

 

image.jpgimage sharing

#Edit:  حليت المشكلة حقت اللي يكرر الكلام اللي اضفته

الحين ابغي احل المشكلة حق لما اضيف كلام ما يجي مرتب 

Edited by Abu-Solo
Link to comment

عدلت لك الكود تقريباً بشكل كامل, جربه ورد علي

كلينت

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(GUBTN, "NormalTextColour", "FF5CFE0C")
    LAB2 = guiCreateLabel(0.03, 0.88, 0.14, 0.05, "By Mr.Kamaro", true, DaamWind)
    guiSetFont(LAB2, "default-bold-small")
    guiLabelSetColor(GLAB2, 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 ( wnd , true )
				showCursor ( true )
				guiSetInputEnabled(false)
				guiSetText(PlayerEdit,"" )
				guiSetText(PriceEdit,"" )
			end
		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
)

 

سيرفر

 

executeSQLQuery ( 'CREATE TABLE IF NOT EXISTS donatorTable ( player, price )' )
	
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 )

function refreshGrids( )
    result = executeSQLQuery( 'SELECT * FROM donatorTable' )
    if ( type ( result ) == "table" and #result == 0 ) or not result then
        triggerClientEvent ( root , 'refresh:my:grid' , root , Value )
    end
end )
addEvent('EventS', true )
addEventHandler('EventS' , root, refreshGrids)
addEventHandler('onResourceStart' , resourceRoot, refreshGrids)

 

Link to comment
5 minutes ago, N3xT said:

عدلت لك الكود تقريباً بشكل كامل, جربه ورد علي

كلينت


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(GUBTN, "NormalTextColour", "FF5CFE0C")
    LAB2 = guiCreateLabel(0.03, 0.88, 0.14, 0.05, "By Mr.Kamaro", true, DaamWind)
    guiSetFont(LAB2, "default-bold-small")
    guiLabelSetColor(GLAB2, 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 ( wnd , true )
				showCursor ( true )
				guiSetInputEnabled(false)
				guiSetText(PlayerEdit,"" )
				guiSetText(PriceEdit,"" )
			end
		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
)

 

سيرفر

 


executeSQLQuery ( 'CREATE TABLE IF NOT EXISTS donatorTable ( player, price )' )	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	endend )function refreshGrids( )    result = executeSQLQuery( 'SELECT * FROM donatorTable' )    if ( type ( result ) == "table" and #result == 0 ) or not result then        triggerClientEvent ( root , 'refresh:my:grid' , root , Value )    endend )addEvent('EventS', true )addEventHandler('EventS' , root, refreshGrids)addEventHandler('onResourceStart' , resourceRoot, refreshGrids)

 

كودك مليان اخطأء, ويقول ان فيه خطأ فـ التريقر 

Link to comment

عطني السطور اتأكد منها ؟

 

وجرب ذا

 

كلينت

 

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(GUBTN, "NormalTextColour", "FF5CFE0C")
    LAB2 = guiCreateLabel(0.03, 0.88, 0.14, 0.05, "By Mr.Kamaro", true, DaamWind)
    guiSetFont(LAB2, "default-bold-small")
    guiLabelSetColor(GLAB2, 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 ( wnd , 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
)

 

سيرفر

 

executeSQLQuery ( 'CREATE TABLE IF NOT EXISTS donatorTable ( player, price )' )
	
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 )

function refreshGrids( )
    result = executeSQLQuery( 'SELECT * FROM donatorTable' )
    if ( type ( result ) == "table" and #result == 0 ) or not result then
        triggerClientEvent ( root , 'refresh:my:grid' , root , result )
    end
end
addEvent('EventS', true )
addEventHandler('EventS' , root, refreshGrids)
addEventHandler('onResourceStart' , resourceRoot, refreshGrids)

 

Edited by N3xT
  • Like 1
Link to comment

الاكواد هذي هي المشكله, مدري وش المشكله منه

لما اضيف الكلام ما ينضاف لـ القريد لست ولكن مافيه اي شئ فـ الدبق

---------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 )
   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 ( wnd , 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 

Quote

executeSQLQuery ( 'CREATE TABLE IF NOT EXISTS donatorTable ( player, price )' )
	
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 )
function refreshGrids( )
    result = executeSQLQuery( 'SELECT * FROM donatorTable' )
    if ( type ( result ) == "table" and #result == 0 ) or not result then
        triggerClientEvent ( root , 'refresh:my:grid' , root , result )
    end
end
addEvent('EventS', true )
addEventHandler('EventS' , root, refreshGrids)
addEventHandler('onResourceStart' , resourceRoot, refreshGrids)

 

 

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