Jump to content

Hydra

Members
  • Posts

    372
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by Hydra

  1. unii stiu ca lucram la acest proiect de tip nfs, din pacate am pierdut toate resursele din cauza unui reboot la laptop 😕

    Insa ca sa nu las oamenii care au intrat pe serverul de discord si au reactionat la fiecare actualizare dezamagiti ca nu mi-am tinut promisiunea, am inceput un proiect de tip RPG in stilul la GTA:V Online

    Discord: https://discord.gg/XcPJeahDQE

    Preview:

    https://streamable.com/sicxrf

    https://cdn.discordapp.com/attachments/1149262003370729503/1149696935326920734/gta_sa_2023-09-08_16-20-52-791.mp4

    https://cdn.discordapp.com/attachments/1149262003370729503/1149696936413233312/gta_sa_2023-09-08_16-22-12-699.mp4

    • Like 2
  2. 10 hours ago, Molvine said:

    Hello! I tried to do something similar, but even without animation, the code came out hard to read. I'm sure it's not optimal, but at least it works.

    Sorry, but my knowledge is hardly enough to create an animation. But I can try if you still need it! :)


    Video: 


    Code:

    local image = dxCreateTexture(":nfsmw/assets/icon.png")
    local selected = 1
    local count = 5
    local elementOffset = 10*scaleValue --padding between items in a menu list
    
    local w, h = 100*scaleValue, 100*scaleValue
    local offsetX, offsetY = 550*scaleValue, 50*scaleValue
    local x, y = getScreenStartPositionFromBox(w, h, offsetX, offsetY, "right", "bottom")
    
    function render()
    	local selectedPos = x
    	for i=1, count do
    		local difference = i-selected --get the difference between the selected element and the rendered element
    		local differenceCopy = difference
    
    
    		if difference < 0 then differenceCopy = -difference end
    		local height = h - (differenceCopy*20*scaleValue) --here we decrease the size as we move away from the selected element
    		local width = w - (differenceCopy*20*scaleValue)
    
    		local offset = 0
    		local step = 1
    		if difference < 0 then step = -step end
    		if difference ~= 0 then
    			for k=0, difference, step do --the loop calculates the offset using the width for each element. I didn't come up with a formula how to calculate it without a loop
    				offset = offset + (20*scaleValue)*k
    			end
    		end
    		if difference > 0 then offset = offset - 20*scaleValue*differenceCopy end --if the element is further than the selected one, then we decrease the offset by one point. without it, elements after the selected one have an offset one point less than required
    
    		local xImage = selectedPos + (w*difference) - offset + 10*scaleValue*difference --the actual position of the x-axis of the element
    		local yImage = y+(h-height)/2 --the actual y-axis position of the element
    
    		local alpha = 255 - 100*(differenceCopy) --transparency decreases with distance from the selected element
    		if alpha < 0 then alpha = 0 end
    
    		dxDrawImage(xImage, yImage, width, height, image, _, _, tocolor(255,255,255,alpha)) --element rendering
    	end
    end
    
    function startRender()
    	addEventHandler("onClientRender", root, render)
    end
    startRender()
    
    function selectElementInMenu(key, keyState, turn) --element select function
    	if turn == "right" then
    		if selected >= count then
    			selected = count
    			return
    		end
    		selected = selected + 1
    	elseif turn == "left" then
    		if selected <= 1 then
    			selected = 1
    			return
    		end
    		selected = selected - 1
    	end
    end
    bindKey("o", "up", moveMenu, "right")
    bindKey("i", "up", moveMenu, "left")

    Thank you so much!

  3. spacer.png

     


    Salut, dacă cauți un server de freeroam și pe comunitatea romanească țin să te anunț că serverul RPP-Gaming se redeschide azi de către fondatorul original (Dany Alex). Serverul va fi asa cum vi-l amintiti voi inainte să se inchidă. ?


    •  

    Serverul Conține:

     sign-check-icon.png- Moduri pe mașini, arme si skin-uri reale (/mods în joc)

     sign-check-icon.png -Tot felul de mape: Fun, Drift, DM-Race, Race etc.. (/teles în joc)

     sign-check-icon.png - Sistem Anti-Deathmatch în F1

     sign-check-icon.png - Arenă doar pentru deathmatch (/aa în joc)

     sign-check-icon.png - Serverul este optimizat și pentru cei cu PC-uri slabe (61 FPS constant)

     sign-check-icon.png - În fiecare săptămâna o să apară ceva nou pe server 

    Mai multe veți descoperi voi pe server

    Câteva poze ca să vedeți cum era atmosfera pe server:
    spacer.png

    pr7PzZ7.png

    spacer.png

     

     

    Discord Server: https://discord.gg/PbPxrF5jV6
    Serverul și-a făcut pentru prima dată apariția pe data de 15 martie 2012.

    • Like 1
  4. If I'm not mistaken, the possibility of using cheats/hacks on the MTA tends to 0% because the MTA uses a fairly good Anti-Cheat and does not allow entry to the servers with any kind of cheat or hack. On the contrary, you will be kicked automatically or banned from joining on any server on for a period of time or in the worse scenario, PERMANENT. I heard about 2 or 3 cheats that worked on MTA but I think the admins resolved that so you don't need to worry.

  5. function ShamalWeapons()
       if not s then
          s = true
          bindKey("lctrl", "down", ShamalProjectiles)
       else
          s = false
          unbindKey("lctrl", "down", ShamalProjectiles)
       end
    end
    addCommandHandler("tweap", ShamalWeapons)
    
    local projectiles = {}
    local antispam = {}
    
    function ShamalProjectiles()
       local vehicle = getPedOccupiedVehicle(localPlayer)
       if vehicle then
          if getElementModel(vehicle) == 519 then
             if not antispam[localPlayer] or antispam[localPlayer] + 500 <= getTickCount() then
                antispam[localPlayer] = getTickCount()
                local px, py, pz = getElementPosition(vehicle)
                local rx, ry, rz = getElementRotation(vehicle)
                projectiles[1] = createProjectile(vehicle, 19, px+2, py, pz-2, 3)
                projectiles[2] = createProjectile(vehicle, 19, px-2, py, pz-2, 3)
             else
                cancelEvent()
             end
          end
       end
    end

    You will need to do something like this and if I'm not wrong you will need to use trigger event in a server-side script for the rockets to be visible for everyone. 

    NOTE: this script will work only if you are using shamal aircraft

  6. --// Quick Example
    
    local ped = createPed(0, 0, 0, 10)
    local vehicle = createVehicle(411, 10, 0, 10)
    
    function lookAtVehicle()
       local px, py, pz = getElementPosition(ped)
       local vx, vy, vz = getElementPosition(vehicle)
       local rx, ry, rz = findRotation3D(px, py, pz, vx, vy, vz)
       setElementRotation(ped, rx, ry, rz)
    end
    addCommandHandler("trot", lookAtVehicle)
    
    
    function findRotation3D( x1, y1, z1, x2, y2, z2 ) 
    	local rotx = math.atan2 ( z2 - z1, getDistanceBetweenPoints2D ( x2,y2, x1,y1 ) )
    	rotx = math.deg(rotx)
    	local rotz = -math.deg( math.atan2( x2 - x1, y2 - y1 ) )
    	rotz = rotz < 0 and rotz + 360 or rotz
    	return rotx, 0,rotz
    end

    this will make the ped to rotate and look at vehicle every time

  7. 23 minutes ago, Kamran3478 said:

    I got these errors: 
    attempt to perform arithmetic on local 'x2' (a boolean value)  [DUP x4]
    Bad argument @ 'getElementPosition' [Expected element at argument 1, got nil]
    Bad argument @ 'getElementRotation' [Expected element at argument 1, got nil]
    Bad argument @ 'getDistanceBetweenPoints3D' [Expected vector3 at argument 1, got boolean]

     

    setTimer(function(localPlayer)
      setPedFollow(myPed, localPlayer)
    end, 1000, 0)
    
    function setPedFollow(theElement, theTarget)
       if theElement then
          local x, y, z = getElementPosition(theTarget)
          local rx, ry, rz = getElementRotation(theTarget)
          local ex, ey, ez = getElementPosition(theElement)
          local distance = getDistanceBetweenPoints3D(x, y, z, ex, ey, ez)
          local rotation = findRotation(ex, ey, x, y)
          setPedRotation(theElement, rotation)
          if distance > 2 then
             setPedControlState(theElement, "forwards", true)
          else
             setPedControlState(theElement, "forwards", false)
          end
       end
    end
    
    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

    Thats the script. Why its not working :(

    why did you put setTimer(function(localPlayer) lmao when I put it only setTimer(function()

  8. 7 minutes ago, Kamran3478 said:

    what is timer? can you show a example for this? :/

    local myPed = createPed(skinID, posX, posY, posZ)
    
    
    setTimer(function()
      setPedFollow(myPed, localPlayer)
    end, 1000, 0)
    
    function setPedFollow(theElement, theTarget)
       if theElement then
          local x, y, z = getElementPosition(theTarget)
          local rx, ry, rz = getElementRotation(theTarget)
          local ex, ey, ez = getElementPosition(theElement)
          local distance = getDistanceBetweenPoints3D(x, y, z, ex, ey, ez)
          local rotation = findRotation(ex, ey, x, y)
          setPedRotation(theElement, rotation)
          if distance > 2 then
             setPedControlState(theElement, "forwards", true)
          else
             setPedControlState(theElement, "forwards", false)
          end
       end
    end
    
    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

     

  9. local blip
    
    local teams = {
     {name = "Red Team", r = 255, g = 0, b = 0},
     {name = "Blue Team", r = 0, g = 0, b = 255}
    }
    
    
    function onTeam()
       local team = getPlayerTeam(source)
       if team then
          if getTeamName(team) == teams[1].name then
             for _, v in ipairs(getPlayersInTeam(team)) do
                 blip = createBlipAttachedTo(v, 0, 2, teams[1].r, teams[1].g, teams[1].b, 255)
             end
          elseif getTeamName(team) == teams[2].name then
             for _, v in ipairs(getPlayersInTeam(team)) do
                 blip = createBlipAttachedTo(v, 0, 2, teams[2].r, teams[2].g, teams[2].b, 255)
             end
          end
       end
    end
    addEventHandler("onPlayerSpawn", root, onTeam)

     

  10. --// Quick Example 
    
    local myCol = createColRectangle(1024, 512, 20, 20)  --// this is how you create the col
    local myRadar = createRadarArea(1024, 512, 20, 20, 0, 255, 0, 255, root) --// with radar area you can detect your col easier
    
    function onColHit(hit, dim)
       if getElementType(hit) == "player" then
          killPed(hit)
          outputChatBox("You were killed", hit, 255, 0, 0, true)
       end
    end
    addEventHandler("onColShapeHit", root, onColHit)

    You have 6 types of colshapes, in this example I used the Rectangle one

    • Like 1
×
×
  • Create New...