Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 14/03/17 in all areas

  1. بكيفك والله انا ماراح اغصبك على شي ماتبيه
    2 points
  2. اي واحد يخش المنتدى ويطلب مساعدة يعطوه الفنكشنات وبعدين يجيك واحد يعطيه كود جاهز ويطلع معاه كود ماسوي فيه لو 1% , ظاهره منتشره انا افضل ان الاخوه لاجت تساعد اول شي تعطيه الفنكشنات وبعدين محاولته وبعدين نصححله , ومانت مجبور تطبق كلامي , بالاخير انت الي تتعب ماهو انا
    2 points
  3. Alright, after severals hours, I managed to do this (game resolution: 1024x768, used my own images): MP4 (HQ) Maybe we can improve it using vectors I don't know but I'm not confortable with them. Here is the client code (the hard part is done. I left the debug drawings but you can remove everything that has the "-- debug" comment) junkyards = { -- x, y, z, width, length, height, {2164.6706542969, -1504.7607421875, 23.984375, 10, 10, 2} } items = { -- item id, chance (%), amount {13, 20, 1}, -- cigar {25, 60, 1}, -- rope {67, 40, 1}, -- lighter {68, 5, 100}, -- graffiti patron } local sx, sy = guiGetScreenSize() local junkSize = sx/2 local junkImageDistance = 50 local junkPositionX, junkPositionY = sx/2-junkSize/2, sy/2-junkSize/2 local junks = {} -- holds all junks images with position, rotation etc local board = {x = junkPositionX, y = junkPositionY, width = junkSize, height = junkSize} local mouseRadius = 20 -- how big the mouse's hitbox is (higher = easier to move junks) local repulseSpeed = 12 -- how fast the junks go away from mouse's hitbox local junkyardCollision = nil local searchTime = 1000 local searchTimeMultiplier = 1 local minimumSearchTimeMultiplier, maximumSearchTimeMultiplier = 5, 15 function createJunkyards() for k,v in ipairs(junkyards) do junkyardCollision = createColCuboid(v[1], v[2], v[3]-0.85, v[4], v[5], v[6]) end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), createJunkyards) local junkImages = { -- image, size, hitradius {"burgershot-bag", 128, 50}, {"cup", 128, 50}, {"boot", 256, 100}, {"bin-bag", 256, 100}, {"apple", 128, 50}, {"paper", 128, 50}, {"bottle", 128, 50}, {"glass", 128, 50}, {"tin-can", 128, 50} } function createJunks() junks = {} for k, v in ipairs(junkImages) do local size = v[2] local rot = math.random(1,360) local midX, midY = getRandomPointInCircle(board.x+board.width/2, board.y+board.width/2, board.width/4) local x, y = midX - size/2, midY - size/2 -- we want the middle of the image to be placed at that point table.insert(junks, {x = x, y = y, size = size, img = v[1], rot = rot, hitradius = v[3]}) end end showCursor(true) -- debug (add it to your command that shows the junk) bindKey("f5", "down", createJunks) -- debug (F5 to (re)create the junk) function renderJunk() dxDrawRectangle(board.x, board.y, board.width, board.height, tocolor(200, 0, 0, 255)) -- debug (junk board) dxDrawCircle(board.x+board.width/2, board.y+board.width/2, board.width/4, 1, 1, 0, 360, tocolor(0, 0, 0, 255)) -- debug (spawn area - black circle) for k, j in ipairs(junks) do local cx, cy = getCursorPosition() cx, cy = cx * sx, cy * sy -- absolute cursor position local imgCenterX, imgCenterY = j.x+j.size/2, j.y+j.size/2 -- center of the junk's image dxDrawImage(j.x, j.y, j.size, j.size, "junkyard/files/" ..j.img..".png", j.rot, 0, 0, tocolor(255,255,255,255), false) dxDrawCircle(imgCenterX, imgCenterY, j.hitradius, 1, 1, 0, 360, tocolor(0, 0, 200, 255)) -- debug (junk's hitbox - blue circle) dxDrawCircle(cx, cy, mouseRadius, 1, 1, 0, 360, tocolor(255, 255, 0, 255)) -- debug (mouse's hitbox) if getKeyState("mouse1") and isCircleInCircle(imgCenterX, imgCenterY, j.hitradius, cx, cy, mouseRadius) then -- move it away if it collides with the cursor's hitbox local angle = findRotation(imgCenterX, imgCenterY, cx, cy) local newX, newY = getPointFromDistanceRotation(imgCenterX, imgCenterY, repulseSpeed, -angle + 180) local offsetX, offsetY = imgCenterX - newX, imgCenterY - newY j.x, j.y = j.x-offsetX, j.y-offsetY -- debug: local newX, newY = getPointFromDistanceRotation(imgCenterX, imgCenterY, 200, -angle + 180) -- debug dxDrawLine(imgCenterX, imgCenterY, newX, newY, tocolor(0, 200, 0, 255)) -- debug (shows direction where the junk is going - green line) end end end addEventHandler("onClientRender", getRootElement(), renderJunk) function startSearching() if junkyardCollision and isElement(junkyardCollision) then if isElementWithinColShape(localPlayer, junkyardCollision) then searchTimeMultiplier = math.random(minimumSearchTimeMultiplier,maximumSearchTimeMultiplier) local finalSearchTime = searchTime*searchTimeMultiplier triggerServerEvent("syncSearchingFromServer", localPlayer, localPlayer, finalSearchTime) setTimer(function() triggerServerEvent("giveFoundJunkItem", localPlayer, localPlayer) end,finalSearchTime,1) else exports["cg_notifications"]:addNotification("Ezt a parancsot csak szeméttelepen tudod használni!", "error") end end end addCommandHandler("turkal", startSearching) ----------------------------------------------------- -- From https://wiki.multitheftauto.com/wiki/DxDrawCircle (was only used for debug drawings) function dxDrawCircle( posX, posY, radius, width, angleAmount, startAngle, stopAngle, color, postGUI ) if ( type( posX ) ~= "number" ) or ( type( posY ) ~= "number" ) then return false end local function clamp( val, lower, upper ) if ( lower > upper ) then lower, upper = upper, lower end return math.max( lower, math.min( upper, val ) ) end radius = type( radius ) == "number" and radius or 50 width = type( width ) == "number" and width or 5 angleAmount = type( angleAmount ) == "number" and angleAmount or 1 startAngle = clamp( type( startAngle ) == "number" and startAngle or 0, 0, 360 ) stopAngle = clamp( type( stopAngle ) == "number" and stopAngle or 360, 0, 360 ) color = color or tocolor( 255, 255, 255, 200 ) postGUI = type( postGUI ) == "boolean" and postGUI or false if ( stopAngle < startAngle ) then local tempAngle = stopAngle stopAngle = startAngle startAngle = tempAngle end for i = startAngle, stopAngle, angleAmount do local startX = math.cos( math.rad( i ) ) * ( radius - width ) local startY = math.sin( math.rad( i ) ) * ( radius - width ) local endX = math.cos( math.rad( i ) ) * ( radius + width ) local endY = math.sin( math.rad( i ) ) * ( radius + width ) dxDrawLine( startX + posX, startY + posY, endX + posX, endY + posY, color, width, postGUI ) end return true end -- From http://cgp.wikidot.com/circle-to-circle-collision-detection function isCircleInCircle(x1, y1, r1, x2, y2, r2) return math.sqrt( ( x2-x1 ) * ( x2-x1 ) + ( y2-y1 ) * ( y2-y1 ) ) < ( r1 + r2 ) end -- From https://wiki.multitheftauto.com/wiki/FindRotation function findRotation( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or t end -- From https://wiki.multitheftauto.com/wiki/GetPointFromDistanceRotation function getPointFromDistanceRotation(x, y, dist, angle) local a = math.rad(90 - angle); local dx = math.cos(a) * dist; local dy = math.sin(a) * dist; return x+dx, y+dy; end -- From https://gamedev.stackexchange.com/questions/26713/calculate-random-points-pixel-within-a-circle-image/26714 function getRandomPointInCircle(x, y, radius) local angle = math.random() * math.pi * 2 radius = math.random() * radius local x = x + radius * math.cos(angle) local y = y + radius * math.sin(angle) return x, y end How to use: Start the script and then press F5 to test it. Press the left mouse button and start moving the junks away. Then press F5 again to reset the junks positions. You might want to modify the hitradius/hitbox for each junk image for a better interaction with the junks. You might also want to modify the mouseRadius and the repulseSpeed (see comments for what they are meant for). This is a pretty complex script and I don't have time to add more comments in the code for tonight, but feel free to ask what you do not understand and I'll try my best to explain it.
    2 points
  4. مافي احلى من موداتي ههههههههههههه لا والله امزح امزح يعني محتار صراحه بين عناد وعبد الكريم @3NAD @Abdul KariM هذولي @@@ وفي واحد بس لو يشتغل شوي نصور احسه ساحب على وناسه @!#NssoR_) وعندك تنطيل مدري وش وضعه ليه ما يفتح سيرفر @</Mr.Tn6eL> يعني اشياء غريبه ترا الوقت والضيق مب عذر يب انا اتهاوش لا لا امزح ذذ حبيبي تنطيل @_@
    2 points
  5. لا تهرب امزح بس بدي اخذ رأيك في شي
    1 point
  6. مخدرات ليه بس هيك تدل الناس علي الفسق
    1 point
  7. Try this one: addEventHandler("onPlayerChat", root, function(message, msgTyp) local message = string.lower(message) for i,v in ipairs(cancelableworld) do if (string.find(message, cancelableworld[i])) then outputChatBox("*NO*", source, 255, 0, 0, false) cancelEvent() return end end local Level = getElementData(source,"Level" or 0) outputChatBox("#4C7759[LVL "..Level.."] #FFFFFF"..getPlayerName(source)..": #FFFFFF"..message,getRootElement(),255,2555,255,true) end)
    1 point
  8. You just made it more complex, that's not what he needs, his problem is that he don't want some words being shown, but because of the two onPlayerChat events he still can see the word he doesn't want to show. It could be an option to check on the other event - where you show the level of the chatting player - if the message has a bad word, but you would have to check it everywhere if you make another onPlayerChat event, I think there is an easier way where you don't have to check the bad words everytime.
    1 point
  9. as they said, It's your fault. anyway, You can ban him from your server.
    1 point
  10. يعطيك العافيه المره الجايه بحاول +_+
    1 point
  11. الموضوع أراء مهو سوالـيف #!ء المبرمجين المنتازين # بالنسبه لي # مودير - مود شفته بروم زومبي مدري وش كان بس رهيب ض ديفولت - كل موداته ماستر - كله حلو عبدالكريم - الأنظمه اللي بيعملها = هو حتى ذذ برستيج - قيم مود م نشرهـ ولا حد شافه ض1 غير القليل . نكست - الأسم العربي .. الخ كتير # جست , - لأنه فاهي أحسن مود يقدر يسويه ق8 تنطيل - م شفت له مود بس يعجبني روقانه ذذ شوكي مدري شيوكي - مود سواه إلي ق8 ^ الاسم اللي م عرفته أقراهه حياتي كلهـا :]
    1 point
  12. Moved to scripting section
    1 point
  13. Client function dxDrawFramedText(message, left, top, width, height, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, frameColor) color = color or tocolor(255, 255, 255, 255) frameColor = frameColor or tocolor(0, 0, 0, 255) scale = scale or 1.1 font = font or "default" alignX = alignX or "left" alignY = alignY or "top" clip = clip or false wordBreak = wordBreak or false postGUI = postGUI or false dxDrawText(message, left + 1, top + 1, width + 1, height + 1, frameColor, scale, font, alignX, alignY, clip, wordBreak, postGUI) dxDrawText(message, left + 1, top - 1, width + 1, height - 1, frameColor, scale, font, alignX, alignY, clip, wordBreak, postGUI) dxDrawText(message, left - 1, top + 1, width - 1, height + 1, frameColor, scale, font, alignX, alignY, clip, wordBreak, postGUI) dxDrawText(message, left - 1, top - 1, width - 1, height - 1, frameColor, scale, font, alignX, alignY, clip, wordBreak, postGUI) dxDrawText(message, left, top, width, height, color, scale, font, alignX, alignY, clip, wordBreak, postGUI) end Rnoteam = 255 Gnoteam = 0 bnoteam = 0 local x, y = guiGetScreenSize() function MedicRender() if getTeamName(getPlayerTeam(localPlayer)) == "Medic" then if getElementDimension(localPlayer) == 55 then return end if getElementData(localPlayer, "LegalStatus")== "Jailed" then return end if getElementData(localPlayer, "LegalStatus")== "Arrested" then return end if getElementData(localPlayer, "Kidnapped") then return end if getElementData(localPlayer, "bag") then return end if isPedInVehicle(localPlayer) then return end if (isPedDead (localPlayer)) then return end if not isPedOnGround(localPlayer) then return end if getElementData(localPlayer, "MStat") == "Open" then dxDrawFramedText("Press : [R] To Delete The Healing Marker Matker !!",x*0.01, y*0.640, x*0.99, y*0.97, tocolor(255, 0, 0, 255), 1, "default-bold", "left", "top", false, false, true, false, false) else dxDrawFramedText("Press : [R] To Create The Healing Marker Matker !!",x*0.01, y*0.640, x*0.99, y*0.97, tocolor(0, 255, 0, 255), 1, "default-bold", "left", "top", false, false, true, false, false) end end end addEventHandler("onClientRender", getRootElement(), MedicRender) ------------------------------- addEventHandler("onClientPlayerDamage", root, function(attacker, weapon) if attacker and getElementType(attacker) == "player" and attacker ~= source then local Model = getElementModel(attacker) local Team = getPlayerTeam(attacker) if Team and (getTeamName(Team) == "Medic") then cancelEvent() if not isTimer(waitTimer[source]) then triggerServerEvent("healPlayer", attacker, source, attacker) waitTimer[source] = setTimer(function(p) waitTimer[p] = nil end, 1500, 1, source) end end end end) function onCompleteKid() triggerServerEvent ("Medic",localPlayer ) end bindKey("R", "down", onCompleteKid) local healAmount = 75 local medicMarker = {} local medicTimer = {} function heal(helled, heller) local money = getElementData(helled, "Money") or 0 if (healAmount <= money) then local health = getElementHealth(helled) local maxHealth = getPlayerMaxHealth(helled) or 100 if (health <= (maxHealth - 25)) then setElementHealth(helled, health + 25) payTheMoney(heller, helled) elseif (health <= (maxHealth - 5)) and (health > (maxHealth - 25)) and (health < maxHealth) then setElementHealth(helled, health + (maxHealth - health)) payTheMoney(heller, helled) end end end addEvent("healPlayer", true) addEventHandler("healPlayer", root, heal) function getPlayerMaxHealth(player) local currentHealth = math.ceil(getElementHealth(player)) setElementHealth(player, 200) local MaxHealth = math.ceil(getElementHealth(player)) setElementHealth(player, currentHealth) return MaxHealth end function payTheMoney(heller, helled) setElementData(helled, "Money", (getElementData(helled, "Money") or 0) - healAmount) setElementData(heller, "Money", (getElementData(heller, "Money") or 0) + healAmount) exports["guimessages"]:outputServer(heller, "#00FFFF[Medic Job] :#00FF00 You have earned $"..healAmount, 0, 255, 0) exports["guimessages"]:outputServer(helled, "#00FFFF[Medic Job] :#FF9900 You've paid $"..healAmount.." for medical services.", 255, 125, 0) end addEvent("Medic", true) addEventHandler("Medic", root, function() local team = getPlayerTeam(source) local medicTeam = getTeamFromName("Medic") if team and medicTeam and team == medicTeam then if isElement(medicMarker[source]) then destroyElement(medicMarker[source]) medicMarker[source] = nil setElementFrozen(source, false) toggleAllControls(source, true) exports["guimessages"]:outputServer(source, "#00FFFF[Medic Job] :#FF0000 Medic marker unloaded successfully.", 255, 255, 0) setElementData(source, "MStat", "Destroy") else if (getElementData(source, "WantLvl") or 0) > 0 then exports["guimessages"]:outputServer(source, "#00FFFF[Medic Job] :#FF0000 Your wanted level prevent you from doing this action.", 255, 0, 0) elseif isPedDead(source) then exports["guimessages"]:outputServer(source, "#00FFFF[Medic Job] :#FF0000 What are you trying to do?!?! only alives can do this action!", 255, 0, 0) elseif getElementData(source, "LegalStatus")== "Jailed" then exports["guimessages"]:outputServer(source, "#00FFFF[Medic Job] :#FF0000 You Are Jailed you Can't do this Action!", 255, 0, 0) elseif getElementData(source, "LegalStatus")== "Arrested" then exports["guimessages"]:outputServer(source, "#00FFFF[Medic Job] :#FF0000 You Are Arrested you Can't do this Action!", 255, 0, 0) elseif isPedInVehicle(source) then exports["guimessages"]:outputServer(source, "#00FFFF[Medic Job] :#FF0000 You must be on foot to do this action.", 255, 0, 0) elseif not isPedOnGround(source) then exports["guimessages"]:outputServer(source, "#00FFFF[Medic Job] :#FF0000 You must be on the ground to do this action.", 255, 0, 0) else setElementFrozen(source, true) toggleAllControls(source, false, true, false) if isTimer(medicTimer[source]) then killTimer(medicTimer[source]) end medicTimer[source] = setTimer(function(source) local x, y, z = getElementPosition(source) if isElement(medicMarker[source]) then destroyElement(medicMarker[source]) medicMarker[source] = nil end medicMarker[source] = createMarker(x, y, z-1, "cylinder", 2.2, 100, 100, 255, 125) setElementInterior(medicMarker[source], getElementInterior(source)) setElementDimension(medicMarker[source], getElementDimension(source)) exports["guimessages"]:outputServer(source, "#00FFFF[Medic Job] :#00FF00 Medic marker created successfully.", 0, 255, 0) setElementData(source, "MStat", "Open") --exports["guimessages"]:outputServer(source, "Do /"..cmd.." again to unload.", 100, 100, 255) end, 200, 1, source) end end end end) function eventCheck() if isElement(medicMarker[source]) then destroyElement(medicMarker[source]) medicMarker[source] = nil setElementFrozen(source, false) toggleAllControls(source, true) end end addEventHandler("onPlayerQuit", root, eventCheck) addEventHandler("onPlayerWasted", root, eventCheck) addEventHandler("onElementDataChange", getRootElement(), function(Date) if Date == "Money" then setPlayerMoney(getElementData(source, "Money")) end end) setTimer(function() for heller, marker in pairs(medicMarker) do for i, helled in ipairs(getElementsWithinColShape(getElementColShape(marker), "player")) do if helled ~= heller then heal(helled, heller) end end end end, 3000, 0) Server
    1 point
  14. يعطيك العافيه #Edit: مدري صراحه ليه اعتزلت لكن الله المستعان احس فيك انا اللعبه صارت قديمه صراحه خلاص
    1 point
  15. سويته سيرفر سايد؟ +وش يطلع بالديبق +كذا غلط الصحيح marker[p]=createMarker(x,y,z-1,'cylinder ',1.5, 0, 255, 255, 150 )
    1 point
  16. بصراحة ماني متأكد لكن يمديك تجرب function Command ( Player ) local playerTeam = getPlayerTeam ( Player ) local teamName = getTeamName ( playerTeam ) if teamName == "team" then x, y, z = getElementPosition ( Player ) if mMarker then destroyElement ( mMarker ) mMarker = createMarker ( x, y, z, "cylinder", 1.5, 0, 255, 0, 150 ) else mMarker = createMarker ( x, y, z, "cylinder", 1.5, 0, 255, 0, 150 ) end end end addCommandHandler ( "CreateM", Command ) function onHit ( Hiter ) if source == mMarker then setElementHealth ( Hiter, 200 ) takePlayerMoney ( Hiter, 200 ) givePlayerMoney ( Player, 200 ) end end addEventHandler ( "onMarkerHit", root, onHit )
    1 point
  17. العفو بالتوفيق
    1 point
  18. لو سمحت ما ابي اقصف جبهتك واقولك مالك دخل +_+ ترا عطيتك مخالفه بمنتدانا رح شفها ههههههههه
    1 point
  19. local ID = ??? addEventHandler ( "onClientResourceStart", resourceRoot, function ( ) setTimer ( engineImportTXD ( engineLoadTXD ( "ngr500.txd", ID ), ID ) engineReplaceModel ( engineLoadDFF ( "ngr500.dff", ID ), ID ) end ,1000, 1 ) end )
    1 point
  20. حبيب قلبي انا ما اشيل من احد اهم شي ما تكون زعلان مني بس +_+
    1 point
  21. 1 point
  22. لا , بس كل غالي وله مقامه ي الغالي : )
    1 point
  23. function autostat() for i,v in ipairs(getElementsByType("player")) do setPedStat(v,24,1000) setElementHealth(v,255) end end addEventHandler("onResourceStart",resourceRoot,autostat) that should probably work as u wish
    1 point
  24. هههههههههههههههههه اكيد لقيت نفسي 990 قلت خلني اوصل 1000 ذذ #Edit: توني الاحظ في فرق هذا يعد اللاعبين انا حقتي الالمنت عادي لو سياره او شي مهب فارقه يعني تقدر تعتبرها اضافه جديده #Edit: هذي وظيفه مدري احد سواها قبل او لا المهم نبدا Code: function randomtable ( aTable ) local number={} for k,v in ipairs ( aTable ) do table.insert(number,k) end return math.random ( 0,#number ) end shared Function وظيفة جلب قيمه عشوائيه من التيبل Example: local master={} addCommandHandler('master',function(p,_,money) table.insert(master,getRandomPlayer()) givePlayerMoney(randomtable(master),money) end) وفي الختام اتمنى للجميع التوفيق ويا رب ما يكون احد سواها قبلي+_+
    1 point
  25. بالتوفيق مع اني فيني غبنه منك لكن اتمنالك الخير
    1 point
  26. Core i 5 ورام 4 مافي اي توافق نهائيا ضض كلامي ماله علاقه بمشكلتك
    1 point
  27. Sorry, but if you open executables from random people, it's your own fault. There's nothing we can do about it.
    1 point
  28. يعطيك العافية على السكربت ولاكن سؤال هل الاوبجكت بجهه كلينت ام سيرفر ؟ واذا كان بالسيرفر له متغير ولا سويت لكل لاعب اوبجكت ؟ ولاهنت على السكربت
    1 point
  29. عمل رائع لكن لدي أقتراح ان تضع اوبجكت واحد فقط ويجي معه مرفق اوبجكت معدل على شكل سجادة حمراء مثل حقت علاء الدين والعنوان بعد غريب سكري بالتوفيق حب
    1 point
  30. Hello everyone; As you know that I need to left MTA and I want to give back this community wich made me involved and interrested in programming and those stuff so I decide to start a tutorial series on my youtube channel contain 23 episodes from A to Z from setting up server till the end So this is the play list link : (Sorry If I made a mistake) Episode 1 : Setting Up The Server Episode 2 : More about acl and config file and installing resources Episode 3 : Creating first resource Episode 4 : LUA Introduction & Data Types (Important) Episode 5 : LUA Varriables (Important) Episode 6 : LUA Arithmetic & String Manipulation (Important) Episode 7 : LUA Logical & Relational Operators(Important) Episode 8 : LUA Conditional Statements(Important) Episode 9 : LUA Loops(Important) Episode 10 : LUA Tables & Loops(Important) Episode 11 : LUA Functions(Very Important) Episode 12 : LUA Scopes(LAST EPISODE IN LUA BASICS) Episode 13 : Multiplayer Concept (Client & Server Slide) Episode 14 : Event Handlers (I put a lot of effort here) Episode 15 : Custom Event Handlers Episode 16 : Exports Episode 16 : Importing Mods Do subscribe and like and comment if you have any question
    1 point
×
×
  • Create New...