Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/07/17 in Posts

  1. local diffTimer, paydayTimer local lastPayDay = false addEventHandler("onResourceStart", resourceRoot, function() diffTimer = setTimer(function() local time = getRealTime() local hours = time.hour local minutes = time.minute paydayTimer = setTimer(payDay, 60 * 60000, 0) if hours == 7 then -- in case you were lucky enough to start the resource between 6 and 7 payDay() end end, (60 - minutes) * 60000, 1) -- timer that will start the actual payday timer exactly at hour:00 minutes -- 60 - currentMinutes; if the time is 12:44 |-> 60 - 44 = 12 -> 12 * 60000ms = 12 mins so the timer will start in 12 minutes end) function payDay() local time = getRealTime() local hours = time.hour local minutes = time.minute if hours == 7 and not lastPayDay then outputChatBox("payday...") lastPayDay = true -- just to be safe and make sure it cannot run twice else lastPayDay = false end end Make sure you are using getRealTime server side.. it will use the client PC's timer on client side.. not tested, but should work.
    3 points
  2. Sure i will help u but seriously u don't know scripting, local commands = { ['event'] = true, ['participate'] = true } function checkForEventJoining(commandName) if commands[commandName] then local playerResponsible = source if commandName == "event" then if (exports.integration:isPlayerLeadAdmin(playerResponsible)) then local playerName = getPlayerName ( playerResponsible ) outputChatBox("Admin Joined the Event Script Works!", playerResponsible, 255, 194, 14) else outputChatBox("You need Admin for joining event!", playerResponsible, 255, 194, 14) end elseif commandName == "participate" then if (exports.integration:isPlayerLeadAdmin(playerResponsible)) then local playerName = getPlayerName ( playerResponsible ) outputChatBox("Admin participated Script Works!", playerResponsible, 255, 194, 14) else outputChatBox("You need Admin for participating in event!", playerResponsible, 255, 194, 14) end end end end addEventHandler("onPlayerCommand", root, checkForEventJoining) help yourself by learning scripting and also see above how to do it Please re read my post as i edited it
    2 points
  3. What are you saying? do you mean like setting on there HUD or using a command to give cash?
    2 points
  4. Tired of editing meta.xml, editing your script, and looking up whatever modelID? Not even mentioned handling changes? Here's the perfect solution! Never having to edit meta.xml, never being too lazy to add new mods, no problems with custom handing, and working vehicle collisions. That's exactly what this resource does for you. It works simple, it checks your folder to see if it contains any new mod, and if it does the script will automatically add it to the meta.xml and restart the resource. And it doesn't stay with that! It also loads any custom handling to your vehicle and even loads vehicle collisions successfully! Isn't that great? First of all, this resource needs access to the restartResource function in order to work properly! You can simply add is as admin to the ACL. I don't know what is the minimum level to restart a resource lol Also, it's highly reccomended to change the resource name! If two servers use this resource, and you play on both, you will have to download the resource everytime you join the other server. So, this is easier for players, and saves you bandwidth usage. If you don't change the name, you will get notified anyway How does it work? Well simple. Just get a mod from any website, for example gtainside.com. Make sure all the files you place are lowercase, and thus not UPPERCASE! If not, ModLoader won't catch your mods. Also, make sure the file-extenstion is lowercase too. To install a mod: Vehicles Place the DFF and TXD in the "vehicles" folder. Also, in the mod you downloaded you might have a readme.txt containing a custom handling line. To install that handling: Create a new file, with the same name as your DFF and TXD, and .hnd as extension. So, for example, if you're adding a new infernus, call this file "infernus.hnd". Now open this file with notepad or any other text editor, place the handling line in it, and save it. Done! Note that custom collisions are DISABLED by default! To enable them, open replacer_c.lua and change allowCollisions to true. The reason why it's disabled is due instability problems. Vehicles that need a custom collision, need to be replaced again when there's a vehicle of that model streamed in. So, what I'm doing is creating that vehicle and then replace it. 1 - 5 custom vehicles shouldn't give a big problem, but imagine what happens when you have replaced every single vehicle of the game. Yeah, that won't work.. I'm looking into a way to fix this though. Important note Since version 1.0.3, ModLoader takes a little more time to load collisions. It can load 10 collisions consecutive with an interval of 300 MS.This means, if you have all 212 vehicles replaced, it will take a minute to load them all but it's almost guaranteed you won't crash.You can load more vehicles consecutive by changing "maxVehicles" in replacer_c.lua, but I do not recommend this. The reason I made it like this is to replace vehicles more stable. I've been experiencing crashes when there are too many vehicles replaced at a single time. Skins and weapons Simply place the DFF and TXD in the "skins" or "weapons" folder, depending what you want to replace. Note that special skins can't be replaced! Also, I've included an option to delete mods since 1.0.1. It works simple with this command: mdel [moddir] [modname] So, if you want to delete the vehiclemod infernus for example, the command is "mdel vehicles infernus". This deletes the TXD, DFF and the optional HND file. Besides, if you want to CLEAR the complete mod directory use the command: mclear [moddir] So, if you want to clear all vehicle mods, use "mdel vehicles". And ofcourse, ingame you use a slash ( '/' ) in front of a command https://community.multitheftauto.com/index.php?p=resources&s=details&id=3016 Yes, all cool and stuff but there's coming more! For the next version I'm adding weapondata support. Yes, that's right! Cazomino05 is currently working on functions to change weapon data, so this will be included in the next version. Also, if MTA ever gets fileScanDir i'm going to do map-support. So, full new map mods that fully work! But, as there are litterally THOUSANDS of objects that can be replaced ( unlike the rest, peds+weapons+vehicles hardly reach 700 ) I really need a fileScanDir function to make that working.
    1 point
  5. السلام عليكم ورحمة الله وبركاته ! بشرح لكم عن حدث لما يتكلم اللاعب بالشات "onPlayerChat" فاىدتها لما يتكلم الاعب بالشات , تقدر تسوي امر وبامكانك تمنعه من الكلام بالشات [ _ ] نأخذ البارمتر للوظيفة , البارمتر ينحطن داخل الوظيفة , وتقدر تتجاوز بارمتر باستخدام string message, int messageType string message :- " " الرسالة اللتي قام اللاعب بكتابتها ! , تكون بين سترنج اللي هو ' ' او int messageType :- ( me ) وفي الرسالة من اف 8( teamsay )وفي رسالة التيم ( say ) نوع الرسالة , كيف يعني ؟ , في الرسالة العامة طبعا تكون بالأرقام : - الرسالة العامة = 0 رسالة اف 8 = 1 رسالة اتيم = 2 من هو المصدر في هذا الايفنت ؟ source هو اللذي قام بكتابة الرسالة ويكون نأخذ مثال في هذا المثال اذا كتب اللاعب كلمة صحة نعطيه صحة ! addEventHandler ( "onPlayerChat" , root , -- حدث عندما يتكلم بالشات function ( msg , msgType ) -- وظيفة وتحتوي على البارمتر لل الحدث if msg == 'صحة' then -- التحقق من الرسالة المكتوبة setElementHealth ( source , 100 ) -- اعطائه صحة end -- انهاء التحقق من الرسالة end -- انهاء الوظيفة ) -- اغلاق الحدث مثال 2 في هذا المثال يقوم بالتحقق من نوع الرسالة المكتوبة اذا كانت 2 ف يلغي ارسالة addEventHandler ( "onPlayerChat" , root , -- حدث عند التكلم بالشات function ( _ , msgType ) -- وظيفة وتحتوي بارمتر الحدث -- تجاوزنا البارمتر الاول لاننا لا نحتاجه if msgType == 1 then -- التحقق من نوع الرسالة cancelEvent ( ) -- نكنسل الحدث بحيث ما تنرسل الرسالة end -- انهاء التحقق من نوع الراسلة end -- انهاء الوظيفة ) -- اغلاق الحدث اتمنى انكم استفدتوا والسلام عليكم ورحمة الله وبركاته
    1 point
  6. https://community.multitheftauto.com/index.php?p=resources&s=details&id=14568 Decided to go for a zombies script from scratch instead of relying on old and outdated ''zday'' zombies or slothboth. These zombies will follow you and try to kill you, once they get too close you'll be dead before you know it so make a good defense line. Location is open field near SF airport, zombies will only spawn and work inside that colshape. When player enters it (atleast one player must be there for any zombies to spawn and exist) he will see a stats window counting and saving his zombiekills, deaths and headshots on zombies. These stats will get saved to account if player is logged in. I will add a video demonstration soon. Zombie skins total size (34 gore skins): 250kb only (heavily optimized) and zombie moan/groan sound files about 77kbit each, no strain on client performance nor server (by the way, you can edit the amount of zombies and other variables in the beginning of zombies_s.lua;
    1 point
  7. السلام عليكمرورحنة الله وبركاته ، اليوم بشرح لكم 3 اشياء مهمة ورح تستخدمها دائما رح نشرحهن ال 3 مع بعض وناخذ امثلة else اول شي فايدته ينفي الحدث ، يعني انت سويت تحقق من ان اللاعب معه 500 ، اذا ما معه تنفيه elseif ثاني شي تقوم بتكرار الحدث مثلا انت تخققت انه اذا صحة اللاعب 50 يعطيه 10 ، وتكرر التحقق اذا معه 70 يعطيه 20 مثلا end ثالث شيء هو هذي تسمى انهاء ، تستخدم لانهاء التحققات ، وتستخدم للانهاء الوظيفة ( الفنكشن ) ؛ نأخذ مثال على بركة الله في هذا المثال ، لما يضغط الاعب على زر يتحقق من ماله اذا كان 100 يعطيه صحة 10 واذا ما معه ما يعطيه addEventHandler ( "onClientGUIClick" , root , -- حدث function ( ) -- وظيفة ( فنكشن if source == button then -- التخقق من الزر if not getElementHealth ( localPlayer ) == 100 then -- اذا ما كانت صحته 100 if getPlayerMoney ( ) >= 100 then -- التحقق من مال اللاعب انه اكبر او يساوي 100 setElementHealth ( localPlayer , 100 ) -- اعطائه صحة else -- اذا ما كان معه 100 outputChatBox ( " you dont money " ) -- اخراج نص بالشات بانه لا يمتلك مال -- هذي تابعة للتحقق الاول اللي هو اذا كان معه 100 end -- انهاء التحقق الاول else -- اذا كانت صحته 100 outputChatBox ( " Your health 100 ! " ) -- اخراج نص بالشات بانه صحته كاملة -- هذي تابعة للتحقق الثاني اللي هو اذا ما كانت صحته 100 end -- انهاء التحقق من صحة اللاعب end -- انهاء التحقق من الزر end -- انهاء التحقق من الوظيفة ) نأخذ مثال 2 على التكرار في هذا المثال اذا ضغط زر يعطيه مال واذا ضغط زر اخر يعطيه صحه addEventHandler ( "onClientGUIClick" , root , -- حدث عند الضغط ع الزر function ( ) -- وظيفة if source == button1 then -- التحقق من الزر givePlayerMoney ( 100 ) -- اعطائه مال elseif source == button2 then -- نكرر التحقق من الزر اذا ضغط على زر اخر setElementHealth ( localPlayer , 100 ) -- اعطائه صحة end -- انهاء التحقق من الزر end -- انهاء الوظيفة ) -- اغلاق الحدث -- تكرار التحقق من الزر ما يحتاج اند ! نأخذ مثال 3 عليهن كلهن في هذا المثال اذا ضغط زر يتحقق من ماله ويعطيه صحة واذا كان ليس معه مال ينفيه , واذا ضغط على زر اخر يتحقق من ماله ويسحب صحته واذا كان ما معه مال ينفي الحدث addEventHandler ( "onClientGUIClick" , root , -- حدث عند الضغط على الزر function ( ) -- وظيفة if source == button1 then -- التحقق من الزر if getPlayerMoney () >= 100 then -- التحقق من ان لديه مال setElementHealth ( localPlayer , 100 ) -- نعطيه صحة else -- اذا ما معه مال outputChatBox ( " you dont money " ) -- اخراج نص بالشات بان لا يمتلك مال end -- انهاء التحقق من المال -- لو ما انهينا التحقق من المال وكررنا الحدث ، رح يضل يتحقق من المال اللي معه elseif source == button2 then -- تكرار الحدث if getPlayerMoney ( ) >= 100 then -- التحقق من ماله setElementHealth ( localPlayer , 0 ) -- نسحب صحته else -- اذا ما معه فلوس outputChatBox ( " لا تملك مال " ) -- end -- انهاء التحقق من الفلوس end -- انهاء التحقق من الزر end -- انهاء الوظيفة ) -- اغلاق الحدث والسلام عليكم ورحمة الله وبركاته اتمنى تنكم استفدتو
    1 point
  8. السلام عليكم ورحمة الله وبركاته كيف الحال شباب باذن الله اليوم بشرحلكم كيف تستخمون executeSQLQuery بطريقه مفصله بس اهم شي دعواتكم لي في الاختبار +_+ حق القدرات والله المستعان بس بسم الله نبدا طيب اولا executeSQLQuery هي وظيفه ثابته ما تتغير لكن فقط ما بين الاقواس هو اللي يتغير يعني انا شرحي ما اعرف اوصل المعلومه صح لكن حاولو تفهمو مني على قدر استطاعتكم +_+ نبدا باول وظيفه وهي انشاء قاعدة بيانات او بمعنى اصح تيبل executeSQLQuery("CREATE TABLE IF NOT EXISTS players (clothes_head_texture TEXT, clothes_head_model TEXT, name TEXT)") طيب الان ناخذ ما بين الاقواس وحده وحده في حالة انشائك لاي تيبل بتكون هذي ثابته ما فيها اي تغيير ما تعدل عليها ابد CREATE TABLE IF NOT EXISTS الان نجيي للي بنعدل عليه players هذا وشو هذا اسم التيبل اللي تبيه وليكن حطيته انا ماستر Master بكذا يكون هذا اول متغير صادفك في انشاء التيبل (clothes_head_texture TEXT, clothes_head_model TEXT, name TEXT) نجي لهنا وش هي clothes_head_texture هذا اسم الكولمن اللي داخل التيبل اللي بندخل فيه القيم وما الى ذلك طيب وش هي TEXT هذا نوع الكولمن يحتوي بالمناسبه الكلومن=عمود على تكست فقط طيب والفاصله وش وظيفتها الفاصله تستخدمها لو تبي تسوي اكثر من كولمن مثلا في هذي الحاله هو هنا مسوي 3 كولمن الاول اسمه clothes_head_texture الثاني clothes_head_model والاخير name اتمنى وصلت فكرة انشاء التيبل طيب هنا نجي للحذف انا دخلت قيمه وما ابيها ابي احذفها من الجدول او مثلا سويت تفعيل اشتراك في رنت سيستم للاعب وابيه ينحذف من التيبل اللي عندي كيف بنشوف الان executeSQLQuery("DELETE FROM players WHERE name=?", playerName) وكالعاده هي ثابته DELETE FROM اما بالنسبه لذي players فهي بتكون ماستر لاننا بدلناها لو تذكرون في انشاء التيبل فوق هذا اسم التيبل اللي انشاناه ايا كان اسمهه Master زي ما قلنا فوق مثلا WHERE name=? هنا تبي تحذف من اي كولمن؟ اي عمود تبي تحذف منه هنا سوينا حذف من عمود name , playerName) الفاصله ثابته playername تكون القيمه اللي تبي تحذفها وليكن اسم اللاعب محمد ابي احذف محمد كيف بتكون كذا ,'محمد') على سبيل المثال فقط بالنسبه لكم انتم على حسب استخدامكم مثلا getPlayerName(source) المصدر اسم لاعب المصدر اللي بالايفينت على حسبكم انتم طيب افرض انا ابي احذف ايضا من clothes_head_texture هل بطر اسوي 2 سطر ورا بعض؟ executeSQLQuery("DELETE FROM players WHERE name=?", playerName) executeSQLQuery("DELETE FROM players WHERE clothes_head_texture=?", head) طبعا هيد تكونو معرفينها انتم ما يحتاج بس هل ذي طريقه صحيحه الجواب خطا الطريقه الصحيح لو تبي تحذف القيمه صح بتسوي كذا executeSQLQuery("DELETE FROM players WHERE clothes_head_texture=? AND name=?", head,playername) زي ما تلاحظون ظفت انت وحطيت فاصله بعد وبلاير نيم بالظبط هذا اللي بتسويه ملاحظه مهمه الان لازم كابيتال ما يصلح سمول نجيي للي بعده executeSQLQuery("DROP TABLE players" ) هذي وظيفه لحذف التيبل وفي حالة شرحنا بتكون زي ما قلنا ماستر يعني كذا executeSQLQuery("DROP TABLE Master" ) executeSQLQuery("SELECT score,health FROM players WHERE name=?", playerName ) طيب هذي وشو هذي تجيبلك بينات من التيبل للاعب معين مثلا اانت لما دخلت للتيبل سويت اللاعب مع نقاطه مثلا SELECT ثابته كالعاده score,health هذي اسماء الكولمن اللي تبي تختار منها البيانات في حالة شرحنا بتكون clothes_head_texture, clothes_head_model طيب FROM players WHERE name=? بشرحها دفعه وحده FROM ثابته players اسم التيبل وفي حالتنا بتكون Master WHERE ثابته name=? هذا اللي عندك قيمته تبي تختار من عمود الاسماء بينات اللاعب اللي جمبو اللي هي clothes_head_texture, clothes_head_model فهمتو طيب بيكون التعريف كذا مثلا local ss,mm=executeSQLQuery("SELECT clothes_head_texture, clothes_head_model FROM Master WHERE name=?", playerName ) بكذا بيطلعلك القيمتين المجهولتين نجي للي بعده اوه قبل لا نجي للي بعده في شي افرض انا ابي كل التيبل بسوي كذا local table=executeSQLQuery("SELECT * FROM Master" ) كذا بيكون عندي جمميع البيانات اللي بالتيبل نجي للي بعده executeSQLQuery("INSERT INTO players(name,color,sound) VALUES(?,?,?)", playerName, colorName, soundName ) وش وظيفتها الادخال في التيبل تبي تدخل قيم جديده INSERT INTO players(name,color,sound) VALUES(?,?,?) اولا الانزرت ثابته وانتو ثابته اما ما بين الاقواس فبتكون اسماء العمود اللي تبي تدخل فيه القيم وفي حالتنا INSERT INTO players (name,clothes_head_texture, clothes_head_model) VALUES(?,?,?) VALUES(?,?,?) وش هذي هذي عدد القيم ونعبر عنها باستفهام لاننا بنكتبها باخر السطر بنشوف افرض عندي اربع عواميد راح نزيد ,? وبالتالي بتصير كذا VALUES(?,?,?,?) لكن احنا حاليا شغالين على 3 فمافي داعي VALUES(?,?,?) نكمل , playerName, colorName, soundName ) playername هذا اللي تبي تدخله في العمود الاول حسب الترتيب (name,clothes_head_texture, clothes_head_model) اللي سويته هنا وكذلك الباقي نجي للي بعده executeSQLQuery("UPDATE players SET color=?,sound=? WHERE name=?", colorName, soundName, playerName ) هذي وظيفتها تحديث البيانات افرض اللاعب زادت نقاطه كل اللي عليك انك تستخدم هذي الوظيفه لتحديث بياناته UPDATE players SET ابديت ثابته players في حالتنا بتكون Master بالنسبه ل SET ثابته color=?,sound=? WHERE name=? color=?,sound=? في حالتنا بتكون كذا clothes_head_texture=?, clothes_head_model=? بالنسبه ل WHERE name=? هذا وين تبي تحدث انت عند اي اسم تبي تحدث؟ على حسب اسم اللاعب اللي زادت نقاطه مثلا طيب colorName, soundName, playerName colorName هذا زي ما قلت بالترتيب حق العواميد اللي سويته يعني ذا راح يروح ل clothes_head_texture soundName وهذا راح يروح ل clothes_head_model والقيمه الاخيره وهي اللي نبي نحدث عندها اسم اللاعب اللي زادت نقاطه playerName اللي بتكون عند WHERE name=? وفي الختام اتمنى من كل قلبي تكونو استفدتو ولا تنسو دعواتكم بالمناسبه الشرح لارضاء الاخ ابوسولو لانه بغا شرح له من زمن @Abu-Solo ولك ايضا عزيزي المتابع لا تنسوني من دعواتكم يقلبي بالتوفيق يا رب لي ولكم
    1 point
  9. السلام عليكم وىحمة الله وبركاته ، شرح الثوم قصير جدا ، وهو عن بعض الإشارات الرياضية هي lua طبعا الإشارات الرياضية بلغة > \ < \ == \ <= \ >= \ = \ ~= \ * \ \ \ + \ - نبدأ بأول واحد وهي > هذي الإشارة تعني أكبر ، ن مثال عليها if getPlayerMoney ( element ) > 100 then -- التحقق من مال اللاعب بانه اكبر من 100 ثاني واحدة وهي < و معناها اصغر ، مثال عليها if getElementHealth ( element ) < 1000 then -- التحقق من ان ثحة الاليمنت اصغر من 1000 ثالث واحدة وهي == معناها تساوي ، مثال if not getElementHealth ( element ) == 1000 then -- التحقق اذا ما كانت صحة الاليمنت تساوي 1000 رابع واحدة وهي <= معناها اصغر او يسازي ، مثال if getPlayerMoney ( palyer ) <= 100 then -- التحقق من ان مال الاعب اصغر او يساوي 100 خامس واحدة وهي >= ومعناها اكبر او يساوي ؛ مثال if string.len( getPlayerName ( element ) ) >= 10 then -- التحقق من ان اسم الاعب اكبر او يسواي 10 خامس واحدة وهي = وتستخدم للاعطاء شيء قيمة ، مثال local value = 10 -- قيمة اساسية addCommandHandle ( "value" , function ( ) value = 6 -- اعطائه قيمة اخرى end ) السادسة وهي ~= ، مثال not معناها لا تساوي وهي تعوض بدل if getElementData ( element , "data" ) ~= true then -- التحقق من ان الداتا لا تساوب صح السابعة وهي * معناها ضرب ، مثال outputChatBox ( " "..5*5.." money " ) -- اخراج نص بالشات بالجواب اللذي سوف يطلع -- الجواب 25 الثامنة وهي / ومعناها تقسيم ، مثال outputChatBox ( " "..5/5.." " ) -- اخراج نص بالشتت بالجواب من معادلة 5 تقسيم 5 -- الجواب 1 التاسعة وهي + معناها جمع , مثال outputChatBox ( " "..1+7.." " ) -- نص بالشات بالمعادلة -- الجواب 8 العاشرة وهي - معناها طرح ، مثال ouputChatBox ( " "..1-1.." " ) -- نص بالشات -- الجواب 0 والسلام عليكم ةرحمة الله وبركاته
    1 point
  10. بسم الله الرحمن الله الرحمن الرحيم سلام عليكم ورحمة الله وبركاته عندي شرح للتحققات مابين القوسين أو التحققات المصغرة , addEventHandler( "onClientGUIClick", root, -- سوينا حدث عند الضغط function ( ) -- وظيفة return ( source == aButton and outputChatBox ("لقد ضغطت على الزر") ) --[[ نسوي استرجاع مع تحقق مصغر اذا ضغط على الزر and , في التحقق المصغر == Then يعني كأنك كذا تسوي if source == aButton then outputChatBox ("لقد ضغطت على الزر") end بشكل مصغر !! ]] end ) طبعاً التحققات المصغرة غالباً تجي مع الريتورن !! اعطيك مثال ثاني addEventHandler ( "onPlayerWasted", root, -- سوينا حدث اذا اللاعب مات function ( _,killer ) -- تخطينا البارتمر الاول والي هو عدد الرصاصات + واخذنا البارتمر الثاني الي هو القاتل return ( killer == source and outputChatBox( "لقد قتلت نفسك" ) or outputChatBox( "لقد قتلك شخص آخر" ) ) --[[ سوينا استرجاع وتحققنا انه القاتل يساوي الي مات راح يرجعله outputChatBox( "لقد قتلت نفسك" ) or == else واذا ماقتل نفسه يرجعله outputChatBox( "لقد قتلك شخص آخر" ) ]] end ) إيه نعم , مثال : -- true = ترو -- false = فولس aWifi = false -- فولس aWifi نخلي قيمة function Check ( ) -- نسوي وظيفة بأسم Check local aWifi = ( aWifi == true and false or true ) -- نعرفه بتحقق --[[ اذا كان aWifi ترو راح يعرف قيمة aWifi فولس واذا ليس ترو راح يعرفه ترو ]] return tostring(aWifi) -- ونسترجع القيمة بـ النتيجة , ونحولها الى سترنق end outputChatBox( Check ( ) ) -- نظهره في شات وكان هاذي هي نهاية الشرح اذا عندك سؤال او استفسار تقدر تسئل في الموضوع + واذا عندك مثال اطرحه وسلام خير الختام
    1 point
  11. Copy from wiki and paste in your code, no other way.
    1 point
  12. from this server: https://www.youtube.com/watch?v=j2WlOyvdKAk&t=9632s And other parts of this script addCommandHandler("makeveh", function(player, _, ownerID, modelID, faction, r, g, b) if getElementData(player, "acc:admin") >= 7 then if not modelID or not tonumber(ownerID) then outputChatBox(rovid .. " /makeveh [Név/ID] [Model] [Frakció] [R] [G] [B]", player, 0, 0, 0, true) return end target, targetName = exports.mta_main:findPlayer(player, ownerID) if not target then return else ownerID = getElementData(target, "char:id") end if not tonumber(faction) then faction = 0 end if not tonumber(r) then r = 0 end if not tonumber(g) then g = 0 end if not tonumber(b) then b = 0 end r = tonumber(r) g = tonumber(g) b = tonumber(b) local vehname = tonumber(modelID) if not vehname then vehname = getVehicleModelFromName(modelID) end if not vehname then outputChatBox(rovid .. " Hibás jármű név vagy id", player, 0, 0, 0, true) return end local x, y, z = getElementPosition(target) local insertQuery = dbQuery(con, "INSERT INTO vehicle SET model=?, owner=?, pos=?, color=?, faction=?, rendszam=?", vehname, ownerID, toJSON({x,y,z}), toJSON({r,g,b}), faction, "modify") local insertResult, _, insertID = dbPoll(insertQuery, -1) if insertResult then addVehicle(ownerID, vehname, x, y, z, insertID, r, g, b, faction) exports.mta_item:giveItem(target, 34, insertID, 1, 0) exports.mta_admin:outputDeveloperMessage("#7cc576"..player:getData("char:anick").." #fffffflétrehozott egy járművet (ID: "..insertID.." Tulaj: "..targetName:gsub("_", " ")..")") dbFree(insertQuery) end end end) addCommandHandler("delveh", function(player, _, vehID) if getElementData(player, "acc:admin") < 7 then return end if not tonumber(vehID) then outputChatBox(rovid .. " /delveh [ID]", player, 0, 0, 0, true) return end vehID = tonumber(vehID) for _, car in ipairs(getElementsByType("vehicle")) do if tonumber(car:getData("veh:id")) == vehID then if getElementData(car, "rent.Owner") then setElementData(getElementData(car, "rent.Owner"), "rent.Car", false) end destroyElement(car) delQuery = dbQuery(con, "DELETE FROM vehicle WHERE id=?", vehID) exports.mta_admin:outputDeveloperMessage("#7cc576"..player:getData("char:anick").." #fffffftörölt egy járművet (ID: "..vehID..")") dbFree(delQuery) end end end) function addVehicle(tulajID, modelID, x, y, z, sqlID, r, g, b, fraki) if not fraki then fraki = 0 end local vehicleCreate = createVehicle(modelID,x,y,z) local str = "abcdefghijklmnopqrstuvwxyz" local plate = "" for index = 1, 3 do plate = plate .. string.char(str:byte(math.random(1, #str))) end plate = string.upper(plate) plate = plate .. "-" for index = 1, 3 do plate = plate .. math.random(1, 9) end setVehiclePlateText(vehicleCreate, plate) local insertQuery = dbQuery(con, "UPDATE vehicle SET rendszam=? WHERE id=?", plate, tonumber(sqlID)) dbFree(insertQuery) vehicleCreate:setData("veh:id",tonumber(sqlID)) vehicleCreate:setData("veh:perm",true) vehicleCreate:setData("veh:interior",0) vehicleCreate:setData("veh:dimension",0) vehicleCreate:setData("veh:fuel",10) vehicleCreate:setData("veh:light",true) vehicleCreate:setData("veh:motor",false) vehicleCreate:setData("veh:owner",tonumber(tulajID)) for _, v in ipairs(getElementsByType("player")) do if v:getData("char:id") == tulajID then oname = v:getData("char:name") end end vehicleCreate:setData("veh:oname", oname) vehicleCreate:setData("veh:faction",tonumber(fraki)) vehicleCreate:setData("handbrake",false) setVehicleColor(vehicleCreate,r,g,b) setVehicleOverrideLights(vehicleCreate, 1) -- Kikapcsolva setElementInterior(vehicleCreate,0) setElementDimension(vehicleCreate,0) if getVehicleType(vehicleCreate) == "BMX" then setVehicleEngineState(vehicleCreate,true) else setVehicleEngineState(vehicleCreate,false) end end function saveVehicle(veh) local dbid = tonumber(getElementData(veh, "veh:id")) or 0 if isElement(veh) and tostring(getElementType(veh)) == "vehicle" and dbid >= 0 then local fuel = getElementData(veh, "veh:status") local engine = getElementData(veh, "veh:motor") or false local locked = isVehicleLocked(veh) local fuel = getElementData(veh, "veh:fuel") local neon = tonumber(getElementData(veh, "veh:neon") or 0) local lights = getVehicleOverrideLights(veh) local health = getElementHealth(veh) local wheel1, wheel2, wheel3, wheel4 = getVehicleWheelStates(veh) local wheelState = toJSON( { wheel1, wheel2, wheel3, wheel4 } ) local panel0 = getVehiclePanelState(veh, 0) local panel1 = getVehiclePanelState(veh, 1) local panel2 = getVehiclePanelState(veh, 2) local panel3 = getVehiclePanelState(veh, 3) local panel4 = getVehiclePanelState(veh, 4) local panel5 = getVehiclePanelState(veh, 5) local panel6 = getVehiclePanelState(veh, 6) local panelState = toJSON( { panel0, panel1, panel2, panel3, panel4, panel5, panel6 } ) local door0 = getVehicleDoorState(veh, 0) local door1 = getVehicleDoorState(veh, 1) local door2 = getVehicleDoorState(veh, 2) local door3 = getVehicleDoorState(veh, 3) local door4 = getVehicleDoorState(veh, 4) local door5 = getVehicleDoorState(veh, 5) local doorState = toJSON( { door0, door1, door2, door3, door4, door5 } ) local x,y,z = getElementPosition(veh) local int = getElementInterior(veh) local dim = getElementDimension(veh) --local pos = toJSON({x,y,z,int,dim}) if dbPoll ( dbQuery( con, "UPDATE vehicle SET panel=?, wheel=?, door=?, fuel=?, motor=?, status=?, lampa=?, hp=? WHERE id='?'", panelState, wheelState, doorState, fuel, engine, locked, lights, health,dbid), -1 ) then -- outputDebugString("Mentve") end -- if dbPoll (dbQuery( kapcsolat,"UPDATE jarmuvek SET TuningMotor=?,TuningTurbo=?,TuningGumi=?,TuningFek=? WHERE id=?",Motor,Turbo,Gumik,Fek,dbid), -1 ) then -- outputDebugString("Jármű teljesítmény-ek mentve!") -- end end end function saveAllVeh() local count = 0 for i, p in ipairs(getElementsByType("vehicle")) do if (tonumber(getElementData(p, "veh:owner") or 0) >= 1) then saveVehicle(p) count = count + 1 end end outputDebugString("El lett mentve "..count.." kocsi adata!",0,0,130,150) end
    1 point
  13. Great! For the 64 bit server, install this: https://nightly.multitheftauto.com/?multitheftauto_linux_x64-1.5-latest You can install the 64 bit server into the same directory as the 32 bit server, but run MTA Server64.exe instead Obviously you'll need the 64 bit mysql module as well
    1 point
  14. I think mta_mysql.dll depends on VS2013 runtime redistributable: https://www.microsoft.com/en-gb/download/details.aspx?id=40784 Install vcredist_x86.exe if your MTA server is 32bit (which it looks like it is)
    1 point
  15. I mean @Tibi [NextMTA] lol. You posted "any proofs" and I thought you were the OP
    1 point
  16. السلام عليكم ورحمة الله و بركاته اليوم بنشرلكم الأيكسبريشن : return or اولاً أيش معنى return? لغوياً : فعل إرجاع برمجياً : تستخدم لترجيع قيمة كيف تستعمل؟ return [ value ] أمثلة : function outputChat(msg,element,r,b,g,bool) -- Function نسوي وظيفة if type(msg) ~= "string" then -- تحقق إذا الأرقمنت الأول سترنق return false -- يرجع قيمة false = خاطئ else -- أذا كان سترنق outputChatBox(msg,element,r,b,g,bool) end end outputChat(123) -- returns false outputChat("123") -- returns true function validate(num) if type(num) ~= "number" then return end -- اذا لم تكن القيمة رقم, يوقف الفنكشن givePlayerMoney(getLocalPlayer(),num) end ثانيا: or معنى لغوياً : أو برمجياً : اذا كان الصيغة القبل nil او false فيقوم بتكميل امثلة : givePlayerMoney(lafdksafksdakfk,100) or givePlayerMoney(source,100) طيب والأن, مثال لهم مع بعض guiSetVisible(rasfdsaf,false) or return false function isvalidpass(pass) if type(pass) ~= "string" or string.len(pass) =< 3 or pass == " " then return false else return pass end end للي عنده مثال ثاني يحطه تحت تحياتي
    1 point
  17. @Master_MTA الله يعطيك الف عافية ي كبير وصلت المعلومة
    1 point
  18. الحين الي اشوفو انك مسوي guiGridListAddRow برا اللوب لهيك هيسوي روو واحد فقط ذي اول شي لاحظتو ثاني شي وش تبي تسوي انت مو فاهم كودك من ناحيه كلنت الي فهمتو من كودك انك تبي تجيب الأكونتات الي معها الداتا و تحطها في جدول و تنقلو للكلنت و تحطو بجريد لست معرف اذا فهمي صح بس انا سويت لك علي حسب فهمي addEvent("getDe", true) addEventHandler("getDe", root, function(uTable) guiGridListClear(gridlist1) for _,value in ipairs(uTable) do local row = guiGridListAddRow(gridlist1) guiGridListSetItemText(gridlist1, row, 1, tostring(value["AccountName"]), false, false) guiGridListSetItemText(gridlist1, row, 2, tostring(value["AccountData"]), false, false) end end ) addEvent("DeRefresh", true) addEventHandler("DeRefresh", root, function() uTable = {} for _,account in ipairs(getAccounts()) do if getAccountData(account, "NoDerby") then table["insert"](uTable, {AccountName = getAccountName(account), AccountData = getAccountData(account, "NoDerby")}) end end triggerClientEvent (client, "getDe", client, uTable) end )
    1 point
  19. Displayed: 3815818.3 If I add the function string.format there will appear 3815818.30. Everything works, and if you add this feature it will cracks up. If I add 5 cents to my cash it will be 3815818.35, and in the hud with this function will appear 3815818.30 ;/
    1 point
  20. Wait a second. Did you save both dollars and pennies in the same element data (player:money)? Put this below your code: function test() local money = getElementData(localPlayer, "player:money") outputChatBox(money) end addCommandHandler("testcash", test) Restart the script and type '/testcash' in your server's chatbox. Tell me what shows up after that in the chat.
    1 point
  21. ببساطة متغير aWifi = false سوينا فنكشن aWifiوعرفنا ال داخله بس هنا خليناه بتحقق والتحقق هو اذا كان وايفاي يساوي ترو راح يرجع القيمة فولس واذا كان وايفاي يساوي فولس راح يرجع القيمة ترو ثم سويت استرجاع للقيمة برتورن وحولته لسترنق بعدها استعملت الفنكشن بالاوت شات بوكس
    1 point
  22. lol forget the onClientRender sorry event
    1 point
  23. Any time no problem your welcome
    1 point
  24. Works ! Thank you ! And yes, i need to learn lua. I'm beginner. At school i learn C++ so i've used the bases of that language. Thank you again ! Very much !
    1 point
  25. https://wiki.multitheftauto.com/wiki/ConvertNumber
    1 point
  26. first read how to post in this forum your code hurt my eyes and also go to mta wiki to learn some coding btw let me help you function joinEvent(thePlayer, commandName, ...) if (exports.integration:isPlayerLeadAdmin(thePlayer)) then local playerName = getPlayerName ( thePlayer ) outputChatBox("Adminul '" .. playerName.. "' testeaza un script personal.", thePlayer, 255, 194, 14) outputChatBox("Scrie /event pentru a participa !", thePlayer, 255, 194, 14) outputChatBox("Test", thePlayer, 255, 194, 14) else outputChatBox("Trebuie sa fi 'Lider Admin' pentru aceasta comanda !", thePlayer, 255, 194, 14) outputChatBox("Script creat de 'Griffin_Connor'.", thePlayer, 255, 194, 14) end end addCommandHandler("event", joinEvent) this should be correct as i don't know your language .
    1 point
  27. Try this btw u have to change many things in addEventHandler Thingy as : see below --// Made by: MoPoMaN --//Tables and other stuff tableLocationsX = {} tableLocationsY = {} tableLocationsZ = {} tableMoney = {} locationCount = 3 --//Location 1 tableLocationsX[1] = 2253.7 tableLocationsY[1] = -84.0 tableLocationsZ[1] = 25.3 tableMoney[1] = 500 --//Location 2 tableLocationsX[2] = 1093.7 tableLocationsY[2] = -931.6 tableLocationsZ[2] = 41.9 tableMoney[2] = 550 --//Location3 tableLocationsX[3] = -47.3 tableLocationsY[3] = -1137.5 tableLocationsZ[3] = 0.07 tableMoney[3] = 500 function startScript () --Marker marker = createMarker (2776.6, -2425.5, 12.6, "cylinder", 1.1, 0, 255, 0) addEventHandler ("onClientMarkerHit", marker, startMission) --Objects and Ped ped = createPed (302, 2776.7, -2428.1, 13.6) tableObj = createObject (2205, 2775.9, -2426.8, 12.6) chairObj = createObject (2309, 2776.7, -2427.4, 12.6) addEventHandler ("onClientPedWasted", getRootElement(), respawnPed) --Blip startBlip = createBlip (2776.9, -2423.9, 12.7, 51) end function startMission (hitElement) if getElementType (hitElement) == "player" then truck = createVehicle (515, 2779.6, -2437.2, 14.7, 0, 0, 90) trailer = createVehicle (450, 2789.2, -2437.1, 14.2, 0, 0, 90) randomLoc = math.random (1, locationCount) finish = createMarker (tableLocationsX[randomLoc], tableLocationsY[randomLoc], tableLocationsZ[randomLoc], "cylinder", 3, 0, 200, 55, 255, hitElement) blip = createBlip (tableLocationsX[randomLoc], tableLocationsY[randomLoc], tableLocationsZ[randomLoc], 0, 2, 255, 0, 0, 255, 0, 10000, hitElement) --addEventHandlers addEventHandler ("onClientTrailerDetach", getRootElement(), trailerDetach) addEventHandler ("onClientVehicleExit", getRootElement(), vehicleExit) addEventHandler ("onClientMarkerHit", finish, reward) addEventHandler ("onClientPlayerQuit", getRootElement(), onQuit) --other setVehicleLocked (truck, true) destroyElement (startBlip) player = hitElement outputChatBox ("#ffaa00***#ffffffDrive to the red blip on the map #ffaa00***", player, 255, 255, 255, true) setElementPosition (marker, -406, -64, 2.4) warpPedIntoVehicle (hitElement, truck) -- end else return false end end function trailerDetach () if source == trailer then --destroyThings outputChatBox ("#ffffffMission failed, go back for more cargo!", player, 255, 255, 255, true) destroyElement (trailer) destroyElement (finish) destroyElement (blip) --removeEventHandlers removeEventHandler ("onClientTrailerDetach", getRootElement(), trailerDetach) removeEventHandler ("onClientVehicleExit", getRootElement(), vehicleExit) removeEventHandler ("onClientPlayerQuit", getRootElement(), onQuit) --other startBlip = createBlip (2776.9, -2423.9, 12.7, 51) setElementPosition (marker, 2776.6, -2425.5, 12.6) else return false end end function vehicleExit (leaver) if source == truck and leaver == player then setVehicleLocked (truck, false) outputChatBox ("#ffaa00// #ffffffGo back to the truck in 10 seconds!", leaver, 255, 255, 255, true) destroyTimer = setTimer (destroyVehicle, 10000, 1) addEventHandler ("onClientVehicleEnter", getRootElement(), destrTimer) else return false end end function destrTimer (thePlayer) if source == truck and thePlayer == player then local team = getPlayerTeam (thePlayer) if getTeamName (team) == "Freeroam" or getTeamName (team) == "The Police" then return false else killTimer (destroyTimer) removeEventHandler ("onClientVehicleEnter", getRootElement(), destrTimer) setVehicleLocked (truck, true) end else return false end end function destroyVehicle () if destroyTimer then --destroyThings destroyElement (trailer) destroyElement (finish) destroyElement (blip) --removeEventHandlers removeEventHandler ("onClientTrailerDetach", getRootElement(), trailerDetach) removeEventHandler ("onClientVehicleExit", getRootElement(), vehicleExit) removeEventHandler ("onClientVehicleEnter", getRootElement(), destrTimer) removeEventHandler ("onClientPlayerQuit", getRootElement(), onQuit) --other startBlip = createBlip (2776.9, -2423.9, 12.7, 51) setElementPosition (marker, 2776.6, -2425.5, 12.6) else return false end end function onQuit () if source == player then --destroyThings destroyElement (truck) destroyElement (trailer) destroyElement (finish) destroyElement (blip) --removeEventHandlers removeEventHandler ("onClientTrailerDetach", getRootElement(), trailerDetach) removeEventHandler ("onClientVehicleExit", getRootElement(), vehicleExit) removeEventHandler ("onClientPlayerQuit", getRootElement(), onQuit) --other startBlip = createBlip (2776.9, -2423.9, 12.7, 51) setElementPosition (marker, 2776.6, -2425.5, 12.6) end end function reward (hitElement) if hitElement == truck then --other startBlip = createBlip (2776.9, -2423.9, 12.7, 51) outputChatBox ("#ffaa00// #ffffffGood job! You've been rewarded " .. tableMoney[randomLoc] .. "$", player, 255, 255, 255, true) setElementPosition (marker, 2776.6, -2425.5, 12.6) occupant = getVehicleOccupant (truck, 0) givePlayerMoney (occupant, tableMoney[randomLoc]) --destroyThings destroyElement (trailer) destroyElement (finish) destroyElement (blip) --removeEventHandlers removeEventHandler ("onClientTrailerDetach", getRootElement(), trailerDetach) removeEventHandler ("onClientVehicleExit", getRootElement(), vehicleExit) removeEventHandler ("onClientPlayerQuit", getRootElement(), onQuit) else return false end end function respawnPed () if source == ped then timer = setTimer (pedRespawn, 5000, 1) else return false end end function pedRespawn () killTimer (timer) destroyElement (ped) ped = createPed (302, 2776.7, -2428.1, 13.6) end addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), startScript)
    1 point
  28. I'm not sure if I'd rely on using that timer. I see a flaw in the logic of setting the timer to 1 per hour, what if the script was initiated at 5 minutes past the hour? If the timer is only then checking once per hour, it'll never work. Here's how I'd prefer to do it Clientside: local paydayValid = true local function realtime() local time = getRealTime() local hours = time.hour local minutes = time.minute if paydayValid == true then if hours == 7 and minutes == 0 then outputChatBox("Payday, ka-ching!") triggerServerEvent("onClientPayday", resourceRoot) paydayValid = false end else if hours == 6 and minutes == 59 then paydayValid = true end end end addEventHandler("onClientRender", getRootElement(), realtime) Serverside: local function payday() givePlayerMoney(client, 1500) end addEvent("onClientPayday", true) addEventHandler("onClientPayday", getRootElement(), payday) Not tested, but it's not exactly a complicated script excuse the indenting, the forum code editor uses 2 spaces whereas I use tab
    1 point
  29. Please add some more money so when you register you can do some :~. I'd also like to note that i liked your server
    1 point
  30. @Master_MTA انا ما زعلت :0 ولا حسيت بشي اصلا اقولك هيك فقط عشان تاخد بالك من = الي عند التيم عمل التيم + انا معتزل من زمان بس فكرت ادخل اشوف المنتدي اخبارو ايه فقط لا غير + شيك عند theTeam=createTeam هيطلع ايرور
    1 point
  31. The %MEM column shows mta-server using 15% I guess the VPS ram usage graph is including shared/swapped memory. Ask your VPS provider for clarification.
    1 point
  32. Your first? Let me know if you are in need of logical solutions that you are not able to solve. I started It 2 months ago, but I have the advantage due to the multiple programming language experience. Anyway, good night, thanks once more.
    1 point
  33. Now you can have your radio button, just update dgs DGS 2.67 has released. See update log: http://angel.mtaip.cn:233/dgsUpdate/
    1 point
  34. MTA:World - проект, который планировалось запустить в сети Prineside, и о котором речь шла в группе ВК (https://vk.com/mta_w, в новостях больше информации о проекте), выложен в свободный доступ на GitHub под лицензией MIT, так как разработка остановлена и сервер не будет запущен (причины этого так же можно найти в новостях группы). Исходный код, ресурсы и более подробное описание на GitHub: https://github.com/prineside/mtaw Лицензия MIT разрешает делать с кодом что угодно. Если вы планируете продолжить разработку или просто хотите узнать, как реализованы некоторые функции, желаю успехов!
    1 point
  35. Not by default, just go to the location with /zombies, and you must know the farm field its at right? (near SF airport)
    1 point
  36. function adminuzi(thePlayer, commandName, ...) outputDebugString("function is working P1") for group, serverGroupName in pairs( names ) do if group then outputDebugString("P2") if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group )) then outputDebugString("P3 - acl valid") message = table.concat({...}, " ") groupName = names[group] outputChatBox("#0088FF[SUPERFUN-Rangos]#d8001f "..groupName.." "..getFixedName(thePlayer)..": "..message,root,0,0,0,true) end end end end addCommandHandler("asay", adminuzi) Try that
    1 point
  37. تشكر على مجهودك لكن الاخ مستر جراند ماقصر بشرحه وشرح غلط فوق openو close المفروض معرفين وما شرحت الجملة التركيبية ذذ وناقص نوعا ما سوري
    1 point
  38. السلام عليكم ورحمة الله وبركاته نشرح لكم وظيفة مفيدة هذه الوظيفة يمكنك من خلالها قرائة البيانات من الجدول تركيب الوظيفة string inspect ( mixed var ) mixed var :- متغير من اي نوع من البيانات مثال الويكي local Table = { ["matrix"] = {position = {getElementPosition(localPlayer)},rotation = {getElementRotation( localPlayer )}}, ["localplayer"] = getPlayerName(localPlayer), } addEventHandler("onClientRender",root, function( ) dxDrawText(inspect(Table),10,250) end ) local Table = { قمنا بإنشاء جدول ["matrix"] = انشاء خانة جديدة تحتوي على :- احداثيات اللاعب , اتجاه اللاعب position = {getElementPosition(localPlayer)},rotation = {getElementRotation( localPlayer )}}, position = -- هذي لو تبي تحط شي قبله , يطلع بالشكل ذا position = { x , y , z } لو ما تحطها كذا تطلع { x , y , z } { هذي الاشارة قبل getElementPosition لو ما تحطها م يصير شي , لو تحط قبلها × تطلع كذا × x , y , z , -- هذي تسوي لنا سطر جديد لو م حطيتها رح يطلع كذا position ={ x , y , z } rotation = { x , y , z } ["localplayer"] = -- خان جديدة تحتوي على اسم الاعب getPlayerName(localPlayer), -- جلب اسم الاعب اذا حاب تشوف وش يطلع الشكل النهائي , افتح رابط الوظيفة والسلام خير الختام
    1 point
  39. Sql كيف حالكم ان شاء الله بخير , اليوم راح نشرح لكم سكربت مهم جدا للي مايعرف يستخدم قواعد البيانات او طبعا السكربت من صنع اخوان : عاشق الشرق , جزاه الله خير على السكربت سهل اشياء كثيرة للمبتدئين اولا لتحميل السكربت من هنا https://community.multitheftauto.com/index.php?p=resources&s=details&id=6313 طيب الحين بنشرح فنكشنات السكربت ووش فائدتها اول فنكشن والي هو setPlayerSerialData -- تخزين البيانات على سريال الاعب ارقمنتات الفنكشن , والفنكشن يرجل لنا بول ( صحيح , خاطئ )ء setPlayerSerialData( player thePlayer, string key, value ) -- player thePlayer = الاعب المراد تخزين عليه البيانات -- string key = المفتاح -- value = القيمة المراد تخزينها على الاعب او سريال الاعب الفنكشن الثاني والي هو getPlayerSerialData -- جلب البيانات المحفوظة على الاعب ارقمنتات الفنكشن , طبعا الفنكشن يرجع لنا بسترنق getPlayerSerialData( player thePlayer, string key ) -- player thePlayer = الاعب المرد جلب البيانات منه -- string key = المفتاح الي خزنها عليه البيانات الفنكشن الثالث والي هو removePlayerSerialData -- حذف البيانات من الاعب ارقمنتات الفنكشن , يرجع لنا بول ( صحيح , خاطئ )ء removePlayerSerialData( player thePlayer, string key ) -- player thePlayer = الاعب المراد حذف البيانات منه -- string key = المفتاح الفنكشن الرابع والاخير والي هو getAllPlayerSerialData ارقمنتات الفنكشن , يرجع لنا بتيبل فيه البيانات المخزنه على السريال getAllPlayerSerialData( player thePlayer ) -- player thePlayer = الاعب المراد جلب جميع البيانات منه طبعا ي شباب لو تلاحظون تركيب الفنكشنات شبيه بـ الالمنت داتا والاكونت داتا يعني استخدامه موب بذيك الصعوبة لو تعرف الاكونت داتا والالمنت داتا راح تعرف لهذا السكربت طبعا لاستخدم الفنكشنات تحتاج لاستدعاء او الاكسبورت راح نشوف كم مثال تسهل علينا الحفظ على سريال الاعب وبنفس الوقت ينحفظ بقاعدة بيانات : المثال الاول addEventHandler ( "onResourceStart" , resourceRoot, function ( ) if not( getResourceState ( getResourceFromName ( "sqldata" ) ) == "running" ) then cancelEvent ( true , "Please start Resource ( sqldata ) " ) outputChatBox ( getCancelReason ( ) ) end end ) ; addEventHandler ( "onPlayerQuit" , root , -- اول مايخرج الاعب function ( ) -- وظيفة local Money = getPlayerMoney ( source ) -- جلب مال الاعب if ( Money > 0 ) then exports [ "sqldata" ] : setPlayerSerialData ( source , "SaveMoney" , Money ) -- تخزين مال الاعب عليه end -- انهاء للتحقق end -- انهاء للوظيفة ) -- قوس اغلاق الحدث addEventHandler ( "onPlayerJoin" , root , -- عندما يدخل الاعب function ( ) local MoneyData = exports [ "sqldata" ] : getPlayerSerialData ( source , "SaveMoney" ) -- جلب المال المخزن على الاعب if ( MoneyData ) then -- تحقق من البيانات setPlayerMoney ( source , MoneyData ) -- اعطاء الاعب ماله end -- انهاء للتحقق end -- انهاء للوظيفة ) -- قوس اغلاق الحدث : المثال الثاني addEventHandler ( "onResourceStart" , resourceRoot, function ( ) if not( getResourceState ( getResourceFromName ( "sqldata" ) ) == "running" ) then cancelEvent ( true , "Please start Resource ( sqldata ) " ) outputChatBox ( getCancelReason ( ) ) end end ) ; addCommandHandler ( "saveMySkin" , -- امر function ( player ) -- وظيفة مع تعريف كاتب الامر if ( player ) then -- تحقق من كاتب الامر local Skin = getElementModel ( player ) -- جلب شخصية الاعب exports [ "sqldata" ] : setPlayerSerialData ( player , "SaveSkin" , Skin ) -- حفظ شخصية الاعب عليه end -- ايند التحقق من كاتب الامر end -- ايند انهاء الفنكشن ) ; -- قوس اغلاق الامر addEventHandler ( "onPlayerJoin" , root , -- عندما يدخل الاعب function ( ) -- وظيفة local SkinData = exports [ "sqldata" ] : getPlayerSerialData ( source , "SaveSkin" ) -- جلب الشخصية المخزنه على الاعب if ( SkinData ) then -- تحقق من البيانات setElementModel ( source , SkinData ) -- اعطاء الاعب شخصيته المحفوظة عليه end -- انهاء للتحقق end -- انهاء للوظيفة ) -- قوس اغلاق الحدث addCommandHandler ( "unSaveMySkin" , -- امر function ( player ) -- وظيفة مع تعريف كاتب الامر if ( player ) then -- تحقق من كاتب الامر exports [ "sqldata" ] : removePlayerSerialData ( player , "SaveSkin" ) -- حذف شخصية الاعب من الحفظ end -- ايند التحقق من كاتب الامر end -- ايند انهاء الفنكشن ) ; -- قوس اغلاق الامر طبعا هذه الامثلة ان شاء الله انها مفهومة واي شي حاب تستفسر عنه عندك الردود واخيرا ان اخطأت فهذا مني ومن الشيطان وان اصبت فهذا من الله لاتبخل علينا بالدعاء , وهذا وصل الله وسلم على نبينا محمد في امان الله وفي حفظ الرحمن
    1 point
×
×
  • Create New...