Jump to content

Al3grab

Members
  • Posts

    431
  • Joined

Everything posted by Al3grab

  1. I made these functions long time ago to simplify things function FILEGetFile(name) if fileExists("Data/"..name..".data") then return fileOpen("Data/"..name..".data") else return fileCreate("Data/"..name..".data") end end function FILESet(what,to) if what and to then local file = FILEGetFile(what) if file then if fileExists("Data/"..what..".data") then fileClose(file) fileDelete("Data/"..what..".data") end local file = FILEGetFile(what) if file then fileWrite(file,to) fileFlush(file) fileClose(file) end end end end function FILEGet(what) if what then local file = FILEGetFile(what) if file then local data while not fileIsEOF(file) do if data then data = data..fileRead(file, 500) else data = fileRead(file, 500) end end fileClose(file) -- return data or false end end end function setData(data,key) if ( data and key ) then return FILESet(data,key) end end function getData(data) if ( data ) then return FILEGet(data) or false end end Use them like this PasswordTable = {"Username","Password"} -- or however you want to store your data .. function savePassword() setData("LoginInfo",toJSON(PasswordTable)) end function getPassword() local pTable = fromJSON(getData("LoginInfo")) or {} if pTable and #pTable > 0 then return pTable[1],pTable[2] -- user,password else return -- no password saved end end much more like setElementData right
  2. Use fileWrite to write what you want, if it's a table use toJSON to convert it to a string; fileRead to read the file again; fromJSON will get your table back Oh and don't forget to flush and close the file each time you write into it
  3. SQLite is perfect and with good execution, because it's able to get more size of data plus it's faster than other ways, it's creating an unique file and store all the things into it, instead of creating one for each resource. About XML it's just for saving normal stuffs but i recommend you to use sqlite in case you have more stuffs to save. Also you can use MySQL it's similar to SQLite but the advantage about MySQL is that you can use phpMyAdmin or any other PHP file and display the data to a web page. It's much more functional since, if you need, for example, to control your server from the web or from a smart phone, it's much easier to implement with MySQL than with SQLite, SQLite create a file complied so you can't manage it not like Mysql, but it still your choice. I have been using xml and file since forever and they're just fine. I was just wondering if using other methods would improve the performance of the script
  4. Which one is the best for a medium size of data and for a better performance ?
  5. _outputChatBox = outputChatBox outputChatBox = function(a,b,c,d,e,f) if not string.find(string.lower(a),"al3grab") then _outputChatBox(a,b,c,d,e,f) end end حط هذا الكود اي مكان سيرفر سايد ومايجيك شي في الشات
  6. What's wrong with black? you're a racist or something ?
  7. seriale = { ["8FA762ECCF76593B06B1482201801C52"] = true, } addEventHandler ( 'onPlayerJoin', getRootElement ( ), function ( ) local Serial = getPlayerSerial(source) if ( seriale[Serial] ) then banPlayer ( source, false, false, true, getRootElement ( ), 'Wypierdalaj kurwo !' ) end end ) You could also cancel the onPlayerConnect event instead of spamming your ban list
  8. Or this way storing all datas in one function to avoid repeating local messages = {'First message'} table.insert(messages, {'Second message','Third message'}) meh, that would be local messages = {'First message'} for u,sk in ipairs ( {'Second message','Third message'} ) do table.insert(messages,sk) end
  9. parameters of onPlayerWasted int totalAmmo, element killer, int killerWeapon, int bodypart, bool stealth killer = القاتل source = المقتول if killer == source then outputChatBox ("Yoi killed yourself :~", killer, 0, 255, 0) return end تشوف اذا القاتل نفسه المقتول وتوقف الفنكشن
  10. مافيه إيفنت اسمه onPlayerKilled الا اذا كنت انت مسويه تقدر تغيره addEvent ("onPlayerWasted", true) addEventHandler ("onPlayerWasted", root, function (ammo,killer, weapon) if killer == source then outputChatBox ("Yoi killed yourself dipshit", killer, 0, 255, 0) return end givePlayerMoney (killer, 300) outputChatBox ("You have been killed by " .. getPlayerName (killer), source, 255, 0, 0) outputChatBox ("You have killed " .. getPlayerName (source) .. " and you earned $300", killer, 0, 255, 0) end )
  11. كيف يا حلوين ؟ * ملاحظة : القيم مود مترجم بالكامل لأي لغة
  12. لا يوصف Edit عندي لك فكرة رصاص بلحق الشخص يكون مثل الصواريخ يلي تلحق المركبات بس رصاص و من سلاح رشاش مدري اذا بنفع لا يوصف ؟؟ عادي ما فيه لاق لا معهم سيرفيرات محترمه قصدي يدفعون كثير مو 10 ريال و 20 ريال اللاق هذا ممكن يكون من جهة اللاعب مو السيرفر يعني انت وجهازك
  13. لا يوصف Edit عندي لك فكرة رصاص بلحق الشخص يكون مثل الصواريخ يلي تلحق المركبات بس رصاص و من سلاح رشاش مدري اذا بنفع كل شي يصير بس وش تحس فيه
  14. القيم مود للحين باقي عليه شغل واجد. باخذ طلة على هالموضوع بشوف لكن
  15. مشاغل الدنيا > *يطلع فيها* أسئلة مالها أجوبة حاليا
×
×
  • Create New...