Jump to content

nxFairlywell

Members
  • Posts

    1,849
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by nxFairlywell

  1. مافيه اكواد محدده عشان نعرف المشكلة وزي ماقلت انت انو عندك قيم مود كامل
  2. I don't know how they do it, But I suggest you to change the "walk_player" animation. This is the default animation for the walk
  3. اكواد السيرفر حطها اخر شي بملف السيرفر وكذلك اكواد الكلينت ماراح تخرب عليك نهائياً بس عدل المتغيرات
  4. "onPlayerLogout" -- عند تسجيل الخروج من الحساب "onPlayerQuit" -- عند مغادرة اللاعب للسيرفر
  5. addEventHandler("onPlayerJoin",root,function() setPlayerWantedLevel(source,0); end)
  6. اقل شي عبر الاكواد اللي كتبتها لك وحطها في الكود حقك لول ?
  7. يعني اللاعب خرج كيف تبي تمسح نجومه وهو اصلاً مافيه لاعب
  8. Server -- Server addEventHandler("onResourceStart",resourceRoot, function() executeSQLQuery("CREATE TABLE IF NOT EXISTS BAN_LIST (PlayerSerial TEXT,ResponsibleSerial TEXT)"); end ) function onPlayerBanned(responsible) local player = source; local playerSerial = getPlayerSerial(player); local responsibleSerial = getPlayerSerial(responsible); local SQL = executeSQLQuery("SELECT * FROM BAN_LIST WHERE PlayerSerial=?",playerSerial); if SQL[1] == nil then executeSQLQuery("INSERT INTO BAN_LIST (PlayerSerial,ResponsibleSerial) VALUES(?,?)",playerSerial,responsibleSerial); local SQL = executeSQLQuery("SELECT * FROM BAN_LIST WHERE PlayerSerial=?",playerSerial); if SQL[1] ~= nil and SQL[1].PlayerSerial == playerSerial then triggerClientEvent(player,"onClientPlayerBanned",player,responsible); end else outputChatBox("هذا اللاعب في قائمة الحظر بالفعل !",responsible); end end addEvent("onPlayerBanned",true); addEventHandler("onPlayerBanned",root,onPlayerBanned); addEvent("OnClientStart",true); addEventHandler("OnClientStart",root,function() local playerSerial = getPlayerSerial(source); local SQL = executeSQLQuery("SELECT * FROM BAN_LIST WHERE PlayerSerial=?",playerSerial); if SQL[1] == nil then triggerClientEvent(source,"OnClientStart",source); else triggerClientEvent(source,"OnClientStart",source,true); end end) Client BanPlayer(player): player : اللاعب اللي تبي تحظره , طبعاً انت تحدد طريقة اختيار اللاعب انا ماحددت طريقة انا حطيت الفنكشن بس -- client local key1 = "F2"; -- زر اللوحة الاولى local key2 = "F3"; -- زر اللوحة الثانية local window1 = var1; -- الى متغير اللوحة الاولى var1 غير local window2 = var2; -- الى متغير اللوحة الثانية var2 غير function OpenFirstWindow() if not guiGetVisible(window1) then guiSetVisible(window1,true); showCursor(true); else guiSetVisible(window1,false); showCursor(false); end end function OpenSecondWindow() if not guiGetVisible(window2) then guiSetVisible(window2,true); showCursor(true); else guiSetVisible(window2,false); showCursor(false); end end addEventHandler("onClientResourceStart",resourceRoot,function() triggerServerEvent("OnClientStart",localPlayer); end); function BanPlayer(player) if player and isElement(player) and getElementType(player)=="player" then local responsible = localPlayer; triggerServerEvent("onPlayerBanned",player,responsible); return true; end return false; end function onClientPlayerBanned(responsible) outputChatBox("لقد تم حظرك من قبل "..getPlayerName(responsible):gsub("#%x%x%x%x%x%x",""),244,14,14); unbindKey("زر اللوحة المحظورة","down",OpenFirstWindow); bindKey("زر اللوحة الثانية","down",OpenSecondWindow); guiSetVisible(window1,false); showCursor(false); end addEvent("onClientPlayerBanned",true); addEventHandler("onClientPlayerBanned",root,onClientPlayerBanned); addEvent("OnClientStart",true); addEventHandler("OnClientStart",root,function(isBanned) if not isBanned then bindKey(key1,"down",OpenFirstWindow); else bindKey(key2,"down",OpenSecondWindow); end end)
  9. تعلم اول شي وبعدين تقدر تسوي كل شي هذا السكربت راح ياخذ منك مجهود وانصحك تنسى موضوعه لين تتعلم اكثر
  10. Actually you don't need to get the marker from server-side
  11. That will fix the problem ?
  12. Cylinder1 = createMarker(3139.8, -3254.3, 123.22222, "cylinder", 1.0, 0, 255, 255, 255) function TEST(playerhit) if source == Cylinder1 then if playerhit and getElementType(playerhit)=="player" then outputChatBox("U hit marker", root) end end end addEventHandler("onMarkerHit", root, TEST)
  13. Remove the if-statement "isElementWithinMarker"
  14. check meta.xml or remove "isElementWithinMarker" function and output the message directly
  15. In second part add an if-statement addEventHandler("onClientRender", getRootElement(), function () for _, player in ipairs(getElementsByType("player")) do if getElementData(player, "Room") then if getElementDimension(player)==getElementDimension(localPlayer) then dxDrawTextOnElement(player, getPlayerName(player), 0.9, 70, 255, 255, 255, 255, 1.5, "sans") end end end end)
  16. You should use 'executeSQLQuery' in the beginning. This will be fine for your start ? Let's see how it works.. In the following example, We have 4 values to save them in the Database. the user's account name the user's money the user's car ID the user's custom points Now we going to create a table in local Database and it's name will be "aeroTable" : addEventHandler("onResourceStart",getThisResource(), function() executeSQLQuery("CREATE TABLE IF NOT EXIST `aeroTable`") end ) Done! We have created an aeroTable. But, We haven't created the columns that we need to save the values in them!! Let's make some columns : addEventHandler("onResourceStart",getThisResource(), function() executeSQLQuery("CREATE TABLE IF NOT EXIST `aeroTable` (account_name TEXT, money TEXT, carID TEXT, customPoints TEXT)") end ) Okay, Now we have created the columns, and the names have been as we named them before. Now we going to save the values in this columns .. function SaveValues(accountName,money,carID,customPoints) if accountName and type(accountName)=="string" and getAccount(accountName) then local SQL = executeSQLQuery("SELECT * FROM aeroTable WHERE account_name=?",accountName); if SQL and type(SQL)=="table" and #SQL > 0 then executeSQLQuery("UPDATE aeroTable SET money=?, carID=?, customPoints=?",money,carID,customPoints); print(accountName.." In Database updated!"); else -- There are no values, that means the account_name column is empty and this account we sent it has no values in the Database, So we have to set the values. executeSQLQuery("INSERT INTO aeroTable(account_name,money,carID,customPoints) VALUES(?,?,?,?)",accountName,money,carID,customPoints); print(accountName.." Has been successfully added to the aeroTable"); end return true; end return false; end And we going to add a command for testing : addCommandHandler("SaveMe", function(player,cmd) if not isGuestAccount(getPlayerAccount(player)) then local accountName = getAccountName(getPlayerAccount(player)); if accountName then local money = tostring ( getPlayerMoney(player) ); local carID; if getPedOccupiedVehicle(player) then carID = tostring( getElementModel(getPedOccupiedVehicle(player)) ); else carID = "N/A"; end local customPoints = getElementData(player,"points") and tostring(getElementData(player,"points")) or "0"; SaveValues(accountName,money,carID,customPoints); end end end ) Finally, We going to show the values for that user who just entered this command : "ShowMe" addCommandHandler("ShowMe", function(player,cmd) if not isGuestAccount(getPlayerAccount(player)) then local accountName = getAccountName(getPlayerAccount(player)); if accountName then local SQL = executeSQLQuery("SELECT * FROM aeroTable WHERE account_name=?",accountName); if SQL and type(SQL)=="table" and #SQL > 0 then outputChatBox(SQL[1].account_name,player); outputChatBox(SQL[1].money,player); outputChatBox(SQL[1].carID,player); outputChatBox(SQL[1].customPoints,player); else outputChatBox("Use SaveMe to save your information",player); end end end end ) Hope that was helpfully ? Post your issues here if you don't understand. Full code : addEventHandler("onResourceStart",resourceRoot, function() executeSQLQuery("CREATE TABLE IF NOT EXISTS aeroTable (account_name TEXT, money TEXT, carID TEXT, customPoints TEXT)") end ) function SaveValues(accountName,money,carID,customPoints) if accountName and type(accountName)=="string" and getAccount(accountName) then local SQL = executeSQLQuery("SELECT * FROM aeroTable WHERE account_name=?",accountName); if SQL and type(SQL)=="table" and #SQL > 0 then executeSQLQuery("UPDATE aeroTable SET money=?, carID=?, customPoints=?",money,carID,customPoints); print(accountName.." In Database updated!"); else -- There are no values, that means the account_name column is empty and this account we sent it has no values in the Database, So we have to set the values. executeSQLQuery("INSERT INTO aeroTable(account_name,money,carID,customPoints) VALUES(?,?,?,?)",accountName,money,carID,customPoints); print(accountName.." Has been successfully added to the aeroTable"); end return true; end return false; end addCommandHandler("SaveMe", function(player,cmd) if not isGuestAccount(getPlayerAccount(player)) then local accountName = getAccountName(getPlayerAccount(player)); if accountName then local money = tostring ( getPlayerMoney(player) ); local carID; if getPedOccupiedVehicle(player) then carID = tostring( getElementModel(getPedOccupiedVehicle(player)) ); else carID = "N/A"; end local customPoints = getElementData(player,"points") and tostring(getElementData(player,"points")) or "0"; SaveValues(accountName,money,carID,customPoints); end end end ) addCommandHandler("ShowMe", function(player,cmd) if not isGuestAccount(getPlayerAccount(player)) then local accountName = getAccountName(getPlayerAccount(player)); if accountName then local SQL = executeSQLQuery("SELECT * FROM aeroTable WHERE account_name=?",accountName); if SQL and type(SQL)=="table" and #SQL > 0 then outputChatBox(SQL[1].account_name,player); outputChatBox(SQL[1].money,player); outputChatBox(SQL[1].carID,player); outputChatBox(SQL[1].customPoints,player); else outputChatBox("Use SaveMe to save your information",player); end end end end )
  17. استخدم الجداول local ads = { [1]={"Get free apples now!",likes=0}, [2]={"Buy your items using our website",likes=0}, }
  18. Because, Source in timers equals nil source = nil Also, You using the triggerServerEvent function in Server-side and that is wrong side for it.
  19. "Put a timer after tapping a command" -- command, id of car, txt of car, replace texture local cmdTime = 10000 local skins = { {"test", 411, "bopp", "test.png"}, } local PlayerTappedCommand = {}; function getSkinByCMD(cmd) if cmd and type(cmd)=="string" then local skin = {}; for i = 1, #skins do if skins[i][1]==cmd then skin[1]=cmd;skin[2]=skins[2];skin[3]=skins[3];skin[4]=skins[4]; return skin; end end return {}; end return false; end function DoSomething(plr, skin) if getPedOccupiedVehicle(plr) and getElementModel(getPedOccupiedVehicle(plr)) == skin[2] then triggerClientEvent(root, "onNalozPJ", root, getPedOccupiedVehicle(plr), skin[2], skin[3], "txt/"..skin[4]) PlayerTappedCommand[plr] = false; end end function CommandFunc(player,cmd) if PlayerTappedCommand[player] then outputChatBox("you used the command before!",player) return false; end local skin = getSkinByCMD(cmd); if skin and type(skin)=="table" and #skin>0 then PlayerTappedCommand[player] = true; local Timer = setTimer(DoSomething, cmdTime, 1, player, skin); end outputConsole ("Wrong command or skin = {empty}",player); return false; end for i = 1, #skins do addCommandHandler(skins[i][1],CommandFunc) end
  20. Local player is actually the client! So server side script hasn't local player because the script is server side you should use this in client side triggerServerEvent("EventName",localPlayer) -- localPlayer = source of the event in server side and you can receive your event from server side like this : addEvent("EventName",true) addEventHandler("EventName",root, function() local localPlayer = source; -- source is that player you put in the triggerServerEvent -- now you have the localPlayer in the server end ) also, there are another methods you can use, but this is a simple example. Note : When you need to use the localPlayer in server side, you will be automatically must be using the triggerServerEvent function. So in the logic you have to trigger an event When you want to use localPlayer?
  21. اتوقع يقصد زي نظام المنتدى يعني بوست وعليه لايكات وكذا اذا تقصد كذا استخدم المتغيرات والداتا
  22. path1 - path2 - path3 - path4 هي مسارات الصورة الجديده , تكتبها بين علامتين تنصيص "path1.png" - "path2.png" ...etc image1 -2-3-4 (StaticImage)هي متغيرات الصور اللي انت مسويها local Time = 10; -- الوقت بين التغييرات بالثواني function ChangeImage() guiStaticImageLoadImage(image1,path1); -- 1 guiStaticImageLoadImage(image2,path2); -- 2 guiStaticImageLoadImage(image3,path3); -- 3 guiStaticImageLoadImage(image4,path4); -- 4 -- image1 = StaticImage1 -- وكذلك مع بقية الصور -- path1 = مسار الصورة الاولى الجديد -- وكذلك مع البقية return true end setTimer(ChangeImages, Time*1000, 0) اذا تبي تغيير الصور عشوائي يعني عندك صور كثيره وتبي يختار عشوائي حط ذا الكود local Time = 40; -- الوقت بين التغييرات بالثواني local path = { "path.png", "path1.png", "path2.png", }; function ChangeImage() guiStaticImageLoadImage(image1,path[math.random(1,#path)]); -- 1 guiStaticImageLoadImage(image2,path[math.random(1,#path)]); -- 2 guiStaticImageLoadImage(image3,path[math.random(1,#path)]); -- 3 guiStaticImageLoadImage(image4,path[math.random(1,#path)]); -- 4 -- image1 = StaticImage1 -- وكذلك مع بقية الصور -- path[math.random(1,#path)] = مسار صورة عشوائي return true end setTimer(ChangeImages, Time*1000, 0) عاد انت لازم تعدل عليه وتضيف الاشياء الناقصه مثل متغيرات الصور ومسارات الصور في الجدول
×
×
  • Create New...