Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 13/10/17 in all areas

  1. show me your codes because i tried it and its working
    2 points
  2. نعم اخوي تقدر , بشرط تكون بنفس الاسم
    2 points
  3. بسم الله الرحمن الرحيم سلام عليكم ورحمة الله وبركاته ,, حبيت اطرح شرح executeSQLQuery مفصل وكامل ان شاء الله . لكثرة الاعضاء الغير فاهمين له او الجاهلين له بسم الله نبدأ .. executeSQLQuery = عبارة عن قاعدة في سيرفرك dbConnect = عبارة عن قاعدة متصلة بالخادم او بالملف اولاً بننشئ كود الاتصال لو كنت بتستعمل dbFunctions test_db = dbConnect( "sqlite", "file.db" ) -- عبر ملف test_db = dbConnect( "mysql", "dbname=frank;host=1.2.3.4", "username", "password", "share=1" ) -- عن طريق الاتصال بالخادم .: ) فالنفترض انه عندنا القاعدة بهذا الشكل : { } فاضي صحيح ؟ طيب عشان ننشئ تيبل وندرج فيه المعلومات , بنحتاج نكتب هالكود : local result1 = executeSQLQuery ( "CREATE TABLE IF NOT EXISTS players (name TEXT, money TEXT, health TEXT)" ) local qh = dbQuery( test_db, "CREATE TABLE IF NOT EXISTS players (name TEXT, money TEXT, health TEXT)" ) -- نسوي الأمر local result2 = dbPoll( qh, -1 ) -- ونطلع النتيجة if ( result1 and result2 ) then print ( "Success to create tables" ) -- نكتب في الديبق نجاح في انشاء الجداول end -- CREATE TABLE IF NOT EXISTS players (name TEXT, money TEXT, health TEXT) -- الترجمة : -- players اصنع جدول اذا ماكان فيه جدول بأسم -- والأعمدة هي : -- name, money, health بيطلع الناتج في القاعدة ~> { players = { } } ^ الجدول حق players فاضي نبي نضيف عليه قيمة مثلا .. local result31 = executeSQLQuery ( "INSERT INTO players(name,money,health) VALUES(?,?,?)", 'wifi','1000','100' ) local qh2 = dbQuery( test_db, "INSERT INTO players(name,money,health) VALUES(?,?,?)", 'wifi','1000','100' ) -- نسوي الأمر local result41 = dbPoll( qh, -1 ) -- ونطلع النتيجة if ( result31 and result41 ) then print ( "Success to insert values" ) -- نكتب في الديبق نجاح في ادخال القيم end -- INSERT INTO players(name,money,health) VALUES(?,?,?) -- الترجمة : -- أدخال الى player -- والأعمدة هي : -- name, money, health -- والقيم : -- ?,?,? == 'wifi', '1000', '100' ملاحظة مهمة جداً : عند وضع سهم داخل الأمر او اي عملية SQL استبداله بالارقمنت خارج العملية كمثال : ("?,?",'wifi','1000') -- الاستفهام الاول بيستبدل بوايفاي -- والاستفاهم الثاني بيستبدل برقم ألف ("?,'1000'",'wifi') -- الاستفهام الاول بيستبدل بوايفاي ^ أتمنى تكون وضحت : بيطلع الناتج في القاعدة ~> { players = { { name='wifi', money='1000', health='100' } } } لو نبي نضيف قيمة ثانية بأسم نصور مثلاً وجا بروس قال انا الي ابي اصير القيمة وتضاربو وبعدين صار بروس القيمة ونصور راح .. كذا نسوي : local result3 = executeSQLQuery ( "INSERT INTO players(name,money,health) VALUES(?,?,?)", 'BrosS','-1000','10' ) local qh3 = dbQuery( test_db, "INSERT INTO players(name,money,health) VALUES(?,?,?)", 'BrosS','-1000','10' ) -- نسوي الأمر local result4 = dbPoll( qh, -1 ) -- ونطلع النتيجة if ( result3 and result4 ) then print ( "Success to insert values" ) -- نكتب في الديبق نجاح في ادخال القيم end -- INSERT INTO players(name,money,health) VALUES(?,?,?) -- الترجمة : -- أدخال الى player -- والأعمدة هي : -- name, money, health -- والقيم : -- ?,?,? == 'BrosS', '-1000', '10' بيطلع الناتج في القاعدة ~> { players = { { name='wifi', money='1000', health='100' }, { name='BrosS', money='-1000', health='10' }, } } طيب لو نبي نجيب فلوس واي فاي كيف ؟ بهذي الطريقة : local result5 = executeSQLQuery ( "SELECT money FROM players WHERE name=?", 'wifi' ) local qh4 = dbQuery( test_db, "SELECT money FROM players WHERE name=?", 'wifi' ) -- نسوي الأمر local result6 = dbPoll( qh, -1 ) -- ونطلع النتيجة if ( result5 and result6 ) then print ( "Success to select values" ) -- نكتب في الديبق نجاح في تحديد القيم print ( result5, result6 ) -- راح يطبع لنا فلوس واي فاي -- Result : -- 1000 end -- SELECT money FROM players WHERE name=? -- الترجمة : -- تحديد عامود money -- من جدول players -- اين القيمة المطابقة في عامود name -- والقيم : -- ? = 'wifi' شكل التحديد في القاعدة ~> -- > = التحديد -- ? = أين -- == = يطابق { >players = { { ?name=='wifi', >money='1000', health='100' }, { name='BrosS', money='-1000', health='10' }, } } -- توضيح اكثر { >players = { -- نحدد التيبل الي نريده { ?name='wifi', >money='1000', health='100' }, -- ? نحدد القيمة الي نريدها< + الي نبحث عنها { name='BrosS', money='-1000', health='10' }, } } مثال اخر لو نبي نجيب هيلث بروس : local result7 = executeSQLQuery ( "SELECT health FROM players WHERE name=?", 'BrosS' ) local qh5 = dbQuery( test_db, "SELECT health FROM players WHERE name=?", 'BrosS' ) -- نسوي الأمر local result8 = dbPoll( qh, -1 ) -- ونطلع النتيجة if ( result7 and result8 ) then print ( "Success to select values" ) -- نكتب في الديبق نجاح في تحديد القيم print ( result5, result6 ) -- راح يطبع لنا دم بروس -- Result : -- 10 end -- SELECT money FROM players WHERE name=? -- الترجمة : -- تحديد عامود money -- من جدول players -- اين القيمة المطابقة في عامود name -- والقيم : -- ? = 'BrosS' الآن لو نبي نعدل على فلوس واي فاي او هلث بروس شلون ؟ بهذه الطريقة . : local result9 = executeSQLQuery ( "UPDATE players SET health='5' WHERE name=?", 'BrosS' ) local qh6 = dbQuery( test_db, "UPDATE players SET health='5' WHERE name=?", 'BrosS' ) -- نسوي الأمر local result10 = dbPoll( qh, -1 ) -- ونطلع النتيجة if ( result9 and result10 ) then print ( "Success to edit values" ) -- نكتب نجاح في تعديل القيم end -- UPDATE players SET health='5' WHERE name=? -- الترجمة : -- تحديث جدول player -- تحديد عامود health='القيمة الجديدة' -- اين القيمة المطابقة في عامود name -- والقيم : -- ? = 'BrosS' النتيجة او الطريقة في القاعدة ~> -- > = التحديد -- ? = أين -- ! = تعديل -- == = يطابق { >players = { { name='wifi', money='1000', health='100' }, { ?name=='BrosS', money='-1000', !health='10' }, } } -- Result : { players = { { name='wifi', money='1000', health='100' }, { name='BrosS', money='-1000', health='5' }, } } ثم بروس صار دمه مره قليل وراح بروس المستشفى وعالجه نصور لكن للأسف مات ونبي نحذفه من الجدول شلون ؟ local result11 = executeSQLQuery ( "DELETE FROM players WHERE name=?", 'BrosS' ) local qh7 = dbQuery( test_db, "DELETE FROM players WHERE name=?", 'BrosS' ) -- نسوي الأمر local result12 = dbPoll( qh, -1 ) -- ونطلع النتيجة if ( result11 and result12 ) then print ( "Success to delete values" ) -- نكتب نجاح في حذف قيمة end -- DELETE FROM players WHERE name=? -- الترجمة : -- حذف من players -- اين القيمة المطابقة في عامود name -- والقيم : -- ? = 'BrosS' النتيجة او الطريقة في القاعدة ~> -- > = التحديد -- ? = أين -- ! = حذف -- == = يطابق { >players = { { name='wifi', money='1000', health='100' }, !{ ?name=='BrosS', money='-1000', health='5' }, } } -- Result : { players = { { name='wifi', money='1000', health='100' }, } } ثم فجأه واي فاي حزن لأن بروس مات وقال بيستقيل , وصار مافي اي قيمة باقية شلون نحذف الجدول ؟ local result7 = executeSQLQuery ( "DROP TABLE players" ) local qh8 = dbQuery( test_db, "DROP TABLE players" ) -- نسوي الأمر local result8 = dbPoll( qh, -1 ) -- ونطلع النتيجة if ( result7 and result8 ) then print ( "Success to drop table" ) -- نكتب نجاح في حذف الجدول end -- DROP TABLE players -- الترجمة : -- حذف جدول players تنبيه مهم : الترجمة ليست حرفية انما بالمعنى فقط او للتوضيح بنسبة لغة البرمجة المشاركون في المسرحية : @!#NssoR_) @#BrosS @iMr.WiFi..! من فضلكم تصفيق حار من اجلهم .. اعتذر اذا اشركت احدكم وماكان وده يشارك .. او العكس " الشرح مقدم على يد : واي فاي الحكمة من القصة لا تسلب حق غيرك لو كان في ابسط او اصغر الاشياء لأن بيجي شخص بيسلب حقك في اسوء او اكبر الاشياء وفي الختام اتمنى الشرح افادكم ولو قليل وتفهمون ان شاء الله وتقولون الله يرحمك ي بروس ?
    1 point
  4. السلام عليكم ورحمة الله وبركاته نبدأ بالشرح triggerServerEvent هذه الوظيفة لا تستخدم إلا في ملف كلآينت ، Client Side تستخدم هذه الوظيفة في الفنكشنات " الوظآئف " التي لا تستعمل في ملف كلآينت ونستقبل الترايقر في ملف سيرفر عن طريق الوظيفتين addEvent addEventHandler بناء الوظيفة أو الجملة التركيبية للوظيفة bool triggerServerEvent ( string event, element theElement, [arguments...] ) string event :- اسم الحدث / اسم الترايقير وعآدي تسمي آي اسم اهم شي يكون بين علآمتين العلامتين للي ما يعرف :- " " أو ' ' element theElement :- localPlayer الآعب واحيانا او دائما نحط [arguments...] :- ارقيومنتات اخرى ، مثلا نبي نجيب كلام الليبل أمثلة :- نبدأ بامثلة بسيطة وبعدين نبدا بالامثلة الصعبة نسبيا في هذا المثال عند ضغط زر يعطي الاعب كيك ، او بمعنى اخر يطرده -- Client Side addEventHandler("onClientGUIClick",root, function () if source == button then triggerServerEvent("kickMe",localPlayer) end end ) -- Server Side addEvent("kickMe",true) addEventHandler("kickMe",root, function () kickPlayer(source,"تم طردك كما أردت") end ) المثآل 2 :- نجلب المكتوب بالاديت ونرسل ترايقر به ، ولازم نستقبل الترايقربملف سيرفر ونطلع نص بالشات باللي كتبناه -- Cl-- Client Side addEventHandler("onClientGUIClick",root, function () if source == button then local text = guiGetText(edit) triggerServerEvent ("outPut",localPlayer,text) -- ارسلنا تريقر بالمكتوب بالاديت end end ) -- Server Side addEvent("outPut",true) addEventHandler("outPut",root, function (text) --الي بعثناه بالتريقر text عرفنا ال outputChatBox(" رسالة الادمن : "..text.." : رسالة الادمن " , root ) end ) المثآل 3 :- نضغط ع زر ونجيب القيمة الثالثة للترايقر ونستقبلها ب اي اسم تريده ، ونعطي اللي ضغط الزر فلوس حسب القيمة الثالثة -- Client Side addEventHandler("onClientGUIClick",root, function () if source == button then triggerServerEvent ("giveMoney",localPlayer,1000) elseif source == button2 then triggerServerEvent ("giveMoney",localPlayer,2000) end end ) -- Server Side addEvent("giveMoney",true) addEventHandler("giveMoney",root, function (money) givePlayerMoney (source,tonumber(money)) end ) وكذا اعطيناكم شوي من بعض اشكال الترايقر والله ولي التوفيق
    1 point
  5. Seria mais seguro vc fazer com banco de dados em vez de XML. Ainda mais pq, como vc mesmo disse, não tem experiência alguma com XML.
    1 point
  6. اها الان فهمتك اعذرني لكن على العموم طريقة حلوه يفضل انك تستخدم معها string.find واعذرني ثاني مره والله ايام الاجازه مب لاقي وقت اجلس على اللاب حتى الله يرحمنا من الجامعه ذي
    1 point
  7. HelpTable = { ['Test'] = 'Done Test' }
    1 point
  8. It's working perfectly now, thanks!
    1 point
  9. You can do it with handling
    1 point
  10. الحمد لله ما فهمت شي
    1 point
  11. It is duplicated because of double loops. Just use one. --for i,item in ipairs(itemList) do for ki = iCurrentCell, iVisibleRows+iCurrentCell-1 do local visibleI = ki - iCurrentCell dxDrawRectangle(x*050+x*350, y*090+y*640/iRows*iCurrentCell, 5, y*640/iRows*iVisibleRows) local index = ki + 1 -- ki starts at 0, in lua we start with 1. local item = itemList[index] if item then dxDrawRectangle(x*060, y*100+visibleI*31, x*200, y*30, tocolor(0, 0, 0, 200), false) -- NOT AN ELEMENT: itemBackground = dxDrawText(item[1],x*070, y*107+visibleI*31, x*250, y*30,tocolor(255,255,255, 255)) --Problem is here :C dxDrawRectangle(x*265, y*100+visibleI*31, x*60, y*30, tocolor(0, 0, 0, 200), false) -- NOT AN ELEMENT: useBackground = dxDrawText("Text",x*282, y*107+visibleI*31, x*250, y*30,tocolor(255,255,255, 255)) -- NOT AN ELEMENT: useText = dxDrawRectangle(x*330, y*100+visibleI*31, x*60, y*30, tocolor(0, 0, 0, 200), false) -- NOT AN ELEMENT: dropBackground = dxDrawText("Text",x*347, y*107+visibleI*31, x*250, y*30,tocolor(255,255,255, 255)) -- NOT AN ELEMENT: dropText = if isCursorOverRectangle(x*060, y*100+visibleI*31, x*200, y*30) or isCursorOverRectangle(x*265, y*100+visibleI*31, x*60, y*30) or isCursorOverRectangle(x*330, y*100+visibleI*31, x*60, y*30) then dxDrawRectangle(x*060, y*100+visibleI*31, x*200, y*30, tocolor(0, 77, 126,20)) dxDrawRectangle(x*265, y*100+visibleI*31, x*60, y*30, tocolor(0, 77, 126,20)) dxDrawRectangle(x*330, y*100+visibleI*31, x*60, y*30, tocolor(0, 77, 126,20)) end end end --end
    1 point
  12. قصدك المهم يضغط على السيرفر ؟ بدل هذا بالكود الي عطاك اياه ستورم عشان الضغط يقل addEventHandler ( 'onPlayerJoin' , root , function ( ) setElementData ( source , 'aSerial' , getPlayerSerial ( source ) ) setElementData ( source , 'aIP' , getPlayerIP ( source ) ) end ) addEventHandler ( 'onPlayerLogin' , root , function ( ) setElementData ( source , 'aAccount' , getAccountName ( getPlayerAccount ( source ) ) ) end ) addEventHandler ( 'onResourceStart' , resourceRoot , function ( ) for _ , v in ipairs ( getElementsByType ( 'player' ) ) do setElementData ( v , 'aAccount' , getAccountName ( getPlayerAccount ( v ) ) or "Guest" ) setElementData ( v , 'aIP' , getPlayerIP ( v ) ) setElementData ( v , 'aSerial' , getPlayerSerial ( v ) ) end end )
    1 point
  13. مسوي 3 احداث بنفس الاسم و3 لوبات لنفس الشيء حطهم بحدث واحد وبلوب واحد يقلل الضغط @_@
    1 point
  14. -_-" guiSetVisible(window1,not guiSetVisible(window1)) الصح : guiSetVisible(window1,not guiGetVisible(window1)) @Source|>
    1 point
  15. طيب وش الجدييد كتبتها نفسها جرب داا addCommandHandler('rp', function () if guiGetVisible( window1 ) then guiSetVisible( window1, false ) showCursor(false) else guiSetVisible( window1, true ) showCursor(true) changeGridListToPlayersAround ( gridlist, 1, 5 ) end end )
    1 point
  16. Exactly. If you fill in the buttons arguments too then you'll have a clickable button. Have you made GUIs before? Do you need help?
    1 point
  17. Install this patch: https://nightly.multitheftauto.com/?mtasa-1.5-latest
    1 point
  18. button = guiCreateButton() addEventHandler("onClientGUIClick",root, function () if source == button then triggerServerEvent("ChangeSkin",localPlayer,46,"Change Skin to id") end end ) addEvent("ChangeSkin",true) addEventHandler("ChangeSkin",root, function (id,text) setElementModel(source,id) outputChatBox(""..text.." ["..id.."]",source,255,0,0,true) end )
    1 point
  19. -_-" يصير كذا : guiSetVisible(window1,not guiGetVisible(window1))
    1 point
  20. وش قصدك ب احط رابط
    1 point
  21. السلام عليكم ورحمة الله وبركاته * Server Side removeAccountData وظيفة مسح الداتا من الحساب ------------------------------------------------------------------ Syntax bool removeAccountData ( element theElement, string key ) Required Arguments theElement: The element you wish to remove the data from. key: The key string you wish to remove. Code :- function removeAccountData ( playerAccount, data ) if ( playerAccount ~= "" ) and ( data ~= "" ) then if getAccount ( playerAccount ) then local dataName = getAccountData(playerAccount, data) if ( dataName ~= nil ) or ( dataName ~= "" ) then setAccountData(playerAccount, data, false) end end end end Example :- function reCheck( ) for i,player in ipairs ( getElementsByType('player') ) do if ( not isGuestAccount ( getPlayerAccount ( player ) ) ) then local acc = getPlayerAccount(player) if ( isObjectInACLGroup('user.'..getAccountName(getPlayerAccount(player)),aclGetGroup('Admin') ) ) then setAccountData ( acc , 'Admin' , true ) else removeAccountData(acc, 'Admin') end end end addEventHandler('onResourceStart',resourceRoot,reCheck) addEventHandler('onPlayerLogin',root,reCheck) addEventHandler('onPlayerLogout',root,reCheck) Thx To @N3xT والسلام خير الختام
    1 point
  22. I don't like it much.. too much colors for me.
    1 point
×
×
  • Create New...