Jump to content

N3xT

Retired Staff
  • Posts

    2,490
  • Joined

  • Days Won

    18

Everything posted by N3xT

  1. استبدل ذا بالسيرفر, واستعمل كودي الاول حق الزر عشان تعطيه الساعات exports.scoreboard:addScoreboardColumn('PlayTime') addEvent("addTime",true) addEvent("removeTime",true) addEvent("ToServer",true) addEventHandler("onResourceStart",resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS Prestege2_Save_Time ( PlayerAccount,Hours,Minuts,Seconds,PlayAllTime )" ) outputDebugString ("Execute SQL Loadded !") end ) local t = { } local w = {} addEventHandler("ToServer",root, function (word,get,time) if word and tonumber(get) and tonumber(time) then table.insert(w,{word,get}) setTimer(function () for _,v in ipairs(w) do if v[1] == word and v[2] == get then table.remove(w,i) end end end,time*60*60*1000,1) end end ) addEventHandler("onConsole",root, function (msg) for _,v in ipairs(w) do if msg == v[1] then local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then if not getAccountData ( playeraccount, "time-"..msg) then addPlayerTime(source,v[2]) setAccountData( playeraccount, "time-"..msg,true) outputChatBox ("#000000||=[Twze3_System]=|| :#00FF00 تم اعطائك الساعات ", source, 0, 255, 0) else outputChatBox ("#000000||=[Twze3_System]=|| :#FF0000 تم اعطائك ساعات من قبل", source, 255, 0, 0) end end end end end ) addEventHandler("addTime",root, function (to,time,prize,name) if to == "all" then for _,v in ipairs(getElementsByType("player")) do addPlayerTime(v,time) outputChatBox ("تم توزيع "..time.." ساعة لـ جميع اللاعبين",v,255,0,0,true ) end elseif to == "buy" then if ( name and name ~= "" ) then if ( prize and prize ~= 0 ) then local plr = getPlayerFromName ( name ) if ( plr ) then if ( getPlayerMoney ( plr ) >= prize ) then addPlayerTime(plr,time) outputChatBox ("تم أضافة "..time.." ساعة الى حسابككـ",plr,255,0,0,true ) takePlayerMoney ( plr, prize ) else outputChatBox ("#FF0000* #ffffff ليس لديك مال كافي",plr,0, 255, 0,true ) end end end end else plr = getPlayerFromName(to) if plr then addPlayerTime(plr,time) outputChatBox ("تم أضافة "..time.." ساعة الى حسابككـ",plr,255,0,0,true ) end end end ) addEventHandler("removeTime",root, function (to,time) if to == "all" then for _,v in ipairs(getElementsByType("player")) do removePlayerTime(v,time) outputChatBox ("تم حذف "..time.." ساعة من جمييع الاعبين",v,255,0,0,true ) end else plr = getPlayerFromName(to) if plr then removePlayerTime(plr,time) outputChatBox ("تم حذف "..time.." ساعة من حسآبككـ ",plr,255,0,0,true ) end end end ) function addPlayerTime(plr,time) time = math.floor(time) t[plr]['hour'] = tonumber(t[plr]['hour'] or 0) + time end function removePlayerTime(plr,time) time = math.floor(time) t[plr]['hour'] = tonumber(t[plr]['hour'] or 0) - time end function checkValues( source,arg1,arg2) if (arg2 >= 60) then t[ source ][ 'min' ] = tonumber( t[ source ][ 'min' ] or 0 ) + 1 t[ source ][ 'sec' ] = 0 end if (arg1 >= 60) then t[ source ][ 'min' ] = 0 t[ source ][ 'hour' ] = tonumber( t[ source ][ 'hour' ] or 0 ) + 1 end return arg1, arg2 end setTimer( function( ) for _, v in pairs( getElementsByType( "player" ) ) do if (not t[ v ]) then t[ v ] = { ["hour"] = 0, ["min"] = 0, ["sec"] = 0 } end t[ v ][ 'sec' ] = tonumber( t[ v ][ 'sec' ] or 0 ) + 1 local min,sec = checkValues ( v, t[ v ][ 'min' ] or 0, t[ v ][ 'sec' ] or 0 ) local hour = tonumber( t[ v ][ 'hour' ] or 0 ) setElementData( v, "PlayTime", tostring( hour )..':'..tostring( min )..':'..tostring( sec ) ) end end, 1000, 0 ) function SaveDataOnQuit () local acc = getPlayerAccount (source) if not isGuestAccount (source) then local sValue = getElementData( source,'PlayTime' ) local hour = tonumber( t[ source ][ 'hour' ] or 0 ) local min = tonumber( t[ source ][ 'min' ] or 0 ) local sec = tonumber( t[ source ][ 'sec' ] or 0 ) local accountName = getAccountName (acc) local Results = executeSQLQuery("SELECT * FROM Prestege2_Save_Time WHERE PlayerAccount=?", accountName) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then executeSQLQuery ( "INSERT INTO Prestege2_Save_Time ( PlayerAccount,Hours,Minuts,Seconds,PlayAllTime ) VALUES(?,?,?,?,?)", accountName,hour,min,sec,sValue ) else executeSQLQuery('UPDATE Prestege2_Save_Time SET Hours =?, Minuts =?, Seconds =?, PlayAllTime =? WHERE PlayerAccount =?', hour, min, sec, sValue, accountName) end t[ source ] = nil end end addEventHandler ("onPlayerQuit", root, SaveDataOnQuit) function SaveDataOnStop () for _,v in ipairs (getElementsByType ("player")) do if not isGuestAccount (getPlayerAccount (v)) then local acc = getPlayerAccount (v) local sValue = getElementData( v,'PlayTime' ) if not ( t [ v ] ) then t [ v ] = { } end local hour = tonumber( t[ v ][ 'hour' ] or 0 ) local min = tonumber( t[ v ][ 'min' ] or 0 ) local sec = tonumber( t[ v ][ 'sec' ] or 0 ) local Results = executeSQLQuery("SELECT * FROM Prestege2_Save_Time WHERE PlayerAccount=?", getAccountName (acc)) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then executeSQLQuery ( "INSERT INTO Prestege2_Save_Time ( PlayerAccount,Hours,Minuts,Seconds,PlayAllTime ) VALUES(?,?,?,?,?)", getAccountName (acc), hour,min,sec,sValue) else executeSQLQuery('UPDATE Prestege2_Save_Time SET Hours =?, Minuts =?, Seconds =?, PlayAllTime =? WHERE PlayerAccount =?', hour, min, sec, sValue, getAccountName (acc)) end end end end addEventHandler ("onResourceStop", resourceRoot, SaveDataOnStop) function GetDataOnStart () for _,v in ipairs (getElementsByType ("player")) do if not isGuestAccount (getPlayerAccount (v)) then local acc = getPlayerAccount (v) local Results = executeSQLQuery("SELECT * FROM Prestege2_Save_Time WHERE PlayerAccount=?", getAccountName (acc)) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then return end if not t[ v ] then t[ v ] = {} end t[ v ]["hour"] = tonumber(Results[1]["Hours"]) t[ v ]["min"] = tonumber(Results[1]["Minuts"]) t[ v ]["sec"] = tonumber(Results[1]["Seconds"]) end end end addEventHandler("onResourceStart", resourceRoot, GetDataOnStart) function GetDataOnLogin (_, acc) local Results = executeSQLQuery("SELECT * FROM Prestege2_Save_Time WHERE PlayerAccount=?", getAccountName (acc)) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then return end setElementData (source, "PlayTime", Results[1]["PlayAllTime"]) if not t[ source ] then t[ source ] = {} end t[ source ]["hour"] = tonumber(Results[1]["Hours"]) t[ source ]["min"] = tonumber(Results[1]["Minuts"]) t[ source ]["sec"] = tonumber(Results[1]["Seconds"]) end addEventHandler ("onPlayerLogin", root, GetDataOnLogin) addCommandHandler('ساعات', function(thePlayer) if getPlayerSerial (thePlayer) == "0201F96FC2B860A7CE6716140C7828F3" then triggerClientEvent(thePlayer,'openn',thePlayer) end end )
  2. سأزرع الكوكائين وابيع الهيروين
  3. روح لاعدادات حسابك بعدين Signature وفعل اول خيار
  4. Delete the resource [Base]Streak from your MTA directory.
  5. من اسمها كانسل افنت, انت شايف بالكود افنت؟
  6. addCommandHandler("تشغيل الرقص", function ( player ) setPedAnimation(player, "ped", "WOMAN_walknorm") outputChatBox("تم تشغيل الرقص",player,255,0,0) end ) addCommandHandler("ايقاف الرقص", function ( player ) setPedAnimation(player) outputChatBox("تم ايقاف الرقص",player,255,0,0) end )
  7. 20 = الساعات 5000 = الفلوس addEventHandler ( "onClientGUIClick" , root, function ( ) if ( source == button1 ) then triggerServerEvent("addTime", localPlayer, "buy", 20, 5000, getPlayerName ( localPlayer )) end end ) واستبدل ذا باللي عندك exports.scoreboard:addScoreboardColumn('PlayTime') addEvent("addTime",true) addEvent("removeTime",true) addEvent("ToServer",true) addEventHandler("onResourceStart",resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS Prestege2_Save_Time ( PlayerAccount,Hours,Minuts,Seconds,PlayAllTime )" ) outputDebugString ("Execute SQL Loadded !") end ) local t = { } local w = {} addEventHandler("ToServer",root, function (word,get,time) if word and tonumber(get) and tonumber(time) then table.insert(w,{word,get}) setTimer(function () for _,v in ipairs(w) do if v[1] == word and v[2] == get then table.remove(w,i) end end end,time*60*60*1000,1) end end ) addEventHandler("onConsole",root, function (msg) for _,v in ipairs(w) do if msg == v[1] then local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then if not getAccountData ( playeraccount, "time-"..msg) then addPlayerTime(source,v[2]) setAccountData( playeraccount, "time-"..msg,true) outputChatBox ("#FF0000* #ffffff [#ff0000 تم اعطاك ساعات #ffffff] ",plr,0, 255, 0,true ) else outputChatBox ("#FF0000* #ffffff [#ff0000 تم التوزيع من قبل #ffffff] ",plr,0, 255, 0,true ) end end end end end ) addEventHandler("addTime",root, function (to,time,prize,name) if to == "all" then for _,v in ipairs(getElementsByType("player")) do addPlayerTime(v,time) outputChatBox ("#FF0000* #ffffff [ #ff0000"..time.." #ffffff] #ffffff [#ff0000 تم توزيع ساعات لجميع الاعبين #ffffff] ",plr,0, 255, 0,true ) end if to == "buy" then if ( name and name ~= "" ) then if ( prize and prize ~= 0 ) then local plr = getPlayerFromName ( name ) if ( plr ) then if ( getPlayerMoney ( plr ) >= prize ) then addPlayerTime(plr,time) outputChatBox ("#FF0000* #ffffff [ #ff0000"..time.." #ffffff] #ffffff [#ff0000 تم اضافة ساعات الى حسابك #ffffff] ",plr,0, 255, 0,true ) takePlayerMoney ( plr, prize ) else outputChatBox ("#FF0000* #ffffff ليس لديك مال كافي",plr,0, 255, 0,true ) end end end end else local plr = getPlayerFromName(to) if plr then addPlayerTime(plr,time) outputChatBox ("#FF0000* #ffffff [ #ff0000"..time.." #ffffff] #ffffff [#ff0000 تم اضافة ساعات الى حسابك #ffffff] ",plr,0, 255, 0,true ) end end end ) addEventHandler("removeTime",root, function (to,time) if to == "all" then for _,v in ipairs(getElementsByType("player")) do removePlayerTime(v,time) outputChatBox ("#FF0000* #ffffff [ #ff0000"..time.." #ffffff] #ffffff [#ff0000 تم حذف ساعات من جميع الاعبين #ffffff] ",v,0, 255, 0,true ) end else plr = getPlayerFromName(to) if plr then removePlayerTime(plr,time) outputChatBox ("#FF0000* #ffffff [ #ff0000"..time.." #ffffff] #ffffff [#ff0000 تم حذف ساعات من حسابك #ffffff] ",plr,0, 255, 0,true ) end end end ) function addPlayerTime(plr,time) time = math.floor(time) t[plr]['hour'] = tonumber(t[plr]['hour'] or 0) + time end function removePlayerTime(plr,time) time = math.floor(time) t[plr]['hour'] = tonumber(t[plr]['hour'] or 0) - time end function checkValues( source,arg1,arg2) if (arg2 >= 60) then t[ source ][ 'min' ] = tonumber( t[ source ][ 'min' ] or 0 ) + 1 t[ source ][ 'sec' ] = 0 end if (arg1 >= 60) then t[ source ][ 'min' ] = 0 t[ source ][ 'hour' ] = tonumber( t[ source ][ 'hour' ] or 0 ) + 1 end return arg1, arg2 end setTimer( function( ) for _, v in pairs( getElementsByType( "player" ) ) do if (not t[ v ]) then t[ v ] = { ["hour"] = 0, ["min"] = 0, ["sec"] = 0 } end t[ v ][ 'sec' ] = tonumber( t[ v ][ 'sec' ] or 0 ) + 1 local min,sec = checkValues ( v, t[ v ][ 'min' ] or 0, t[ v ][ 'sec' ] or 0 ) local hour = tonumber( t[ v ][ 'hour' ] or 0 ) setElementData( v, "PlayTime", tostring( hour )..':'..tostring( min )..':'..tostring( sec ) ) end end, 1000, 0 ) function SaveDataOnQuit () local acc = getPlayerAccount (source) if not isGuestAccount (source) then local sValue = getElementData( source,'PlayTime' ) local hour = tonumber( t[ source ][ 'hour' ] or 0 ) local min = tonumber( t[ source ][ 'min' ] or 0 ) local sec = tonumber( t[ source ][ 'sec' ] or 0 ) local accountName = getAccountName (acc) local Results = executeSQLQuery("SELECT * FROM Prestege2_Save_Time WHERE PlayerAccount=?", accountName) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then executeSQLQuery ( "INSERT INTO Prestege2_Save_Time ( PlayerAccount,Hours,Minuts,Seconds,PlayAllTime ) VALUES(?,?,?,?,?)", accountName,hour,min,sec,sValue ) else executeSQLQuery('UPDATE Prestege2_Save_Time SET Hours =?, Minuts =?, Seconds =?, PlayAllTime =? WHERE PlayerAccount =?', hour, min, sec, sValue, accountName) end t[ source ] = nil end end addEventHandler ("onPlayerQuit", root, SaveDataOnQuit) function SaveDataOnStop () for _,v in ipairs (getElementsByType ("player")) do if not isGuestAccount (getPlayerAccount (v)) then local acc = getPlayerAccount (v) local sValue = getElementData( v,'PlayTime' ) if not ( t [ v ] ) then t [ v ] = { } end local hour = tonumber( t[ v ][ 'hour' ] or 0 ) local min = tonumber( t[ v ][ 'min' ] or 0 ) local sec = tonumber( t[ v ][ 'sec' ] or 0 ) local Results = executeSQLQuery("SELECT * FROM Prestege2_Save_Time WHERE PlayerAccount=?", getAccountName (acc)) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then executeSQLQuery ( "INSERT INTO Prestege2_Save_Time ( PlayerAccount,Hours,Minuts,Seconds,PlayAllTime ) VALUES(?,?,?,?,?)", getAccountName (acc), hour,min,sec,sValue) else executeSQLQuery('UPDATE Prestege2_Save_Time SET Hours =?, Minuts =?, Seconds =?, PlayAllTime =? WHERE PlayerAccount =?', hour, min, sec, sValue, getAccountName (acc)) end end end end addEventHandler ("onResourceStop", resourceRoot, SaveDataOnStop) function GetDataOnStart () for _,v in ipairs (getElementsByType ("player")) do if not isGuestAccount (getPlayerAccount (v)) then local acc = getPlayerAccount (v) local Results = executeSQLQuery("SELECT * FROM Prestege2_Save_Time WHERE PlayerAccount=?", getAccountName (acc)) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then return end if not t[ v ] then t[ v ] = {} end t[ v ]["hour"] = tonumber(Results[1]["Hours"]) t[ v ]["min"] = tonumber(Results[1]["Minuts"]) t[ v ]["sec"] = tonumber(Results[1]["Seconds"]) end end end addEventHandler("onResourceStart", resourceRoot, GetDataOnStart) function GetDataOnLogin (_, acc) local Results = executeSQLQuery("SELECT * FROM Prestege2_Save_Time WHERE PlayerAccount=?", getAccountName (acc)) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then return end setElementData (source, "PlayTime", Results[1]["PlayAllTime"]) if not t[ source ] then t[ source ] = {} end t[ source ]["hour"] = tonumber(Results[1]["Hours"]) t[ source ]["min"] = tonumber(Results[1]["Minuts"]) t[ source ]["sec"] = tonumber(Results[1]["Seconds"]) end addEventHandler ("onPlayerLogin", root, GetDataOnLogin) addCommandHandler('T1', function(thePlayer) if getPlayerSerial (thePlayer) == "B83098E832E840D8C1BE0151CE8A58A1" then triggerClientEvent(thePlayer,'openn',thePlayer) end end ) addCommandHandler(' هنا الكلمة الي تكتبها في اف 8 عشان تقدر توزيع ساعات ', function(thePlayer) if getPlayerSerial (thePlayer) == " هنا حط سريال خويك لافتح الوحه له " then triggerClientEvent(thePlayer,'openn',thePlayer) end end )
  8. حط داتا على اللاعب انه افك طيب, واذا تحرك تحقق انه عنده الداتا ورجعه للعالم الاساسي
  9. التحقق من الفلوس خليه بالسيرفر سايد, لأن الكلنت يرجع لك قيمة خاطئة احياناً
  10. في جميع الحالات جاب لك لاق ولا ما جاب, حاول تصلح الاخطاء دائماً
  11. اذا مافهمت شيء بتاخذ الكود وتلصقه وما بتستفيد شيء, حاول كلها ارقمنتين والمنتدى كله امثلة
  12. والله معرف اللي تتكلم عنه, انا ما العب تكتيك ولا عمري خشيت سيرفر تكتيك
  13. متقدرشي يراجل
  14. اجل خلاص ماتقدر لول
  15. for _,v in ipairs ( getElementsByType ( "player" ) ) if ( getPlayerName(v) == "Rayan" ) then -- end end مع اني ما ظنيت انها بتظبط لأنه راح يتحقق اذا فيه لاعب اسمه ريان راح يطبق الفنكشن على الكل لكن جرب وشوف
  16. هل جربت اللوب طيب؟
  17. .. تقدر مثلاً تسوي لوب للاعبين وتجيب اللاعب اللي تبيه, عن طريق السيريال, الداتا, الاسم, الحساب الخ وبعدين تستخدم الفنكشن, جربها يمكن تزبط ويمكن لا بما انه مافيه ارقمنت للاعب
  18. https://forum.multitheftauto.com/topic/91203-show-mta-discord-integration-api/
  19. شيل الكيك وحطه بالدمنشن, بعدين استخدم الحدث اللي فوق وتحقق اذا كان بالعالم الوهمي يرجعه للعالم الاساسي
  20. لازم يكون فيه تحقق ان القاتل ماهو السورس لأن اللاعب لو انتحر بيطلع له انه قتل نفسه بنفسه
×
×
  • Create New...