Jump to content

Handling flag


Recommended Posts

Hi.

A have a little question.

- How can i set the vehicle handling flags, one by one?

Example:

function setVehicleWheelWidth(side, value)
 	if side == "WHEEL_R_" then
		--[[
    		value = NORMAL, NARROW2, NARROW, WIDE, WIDE2 (this values in table and every values has a hex value)
    		NORMAL = 0x0000, -- this remove the current WHEEL_R_ flag and set it to the default GTA or MTA value
    		NARROW2 = 0x1000,
    		NARROW = 0x2000,
    		WIDE = 0x4000,
    		WIDE2 = 0x8000
    		-- in the WHEEL_F_ this hex values not 0x..Xthousand, but 0x..Xhundred (0x000, 0x100, 0x200, 0x400, 0x800)
    	]]
    	-- setVehicleHandling... how can i calculate it or something to fit the old flag values?
    	-- I'm tried more codes but every code is not work very well. (e.g.: i'm changed the wheel width in one Lowrider car (with automatic hydraulic geom flag) and the hydraulic get bugged. Not worked after i'm changed the wheel width.)
    end
 end

 

Thanks the replies to this topic. Have a nice day :-)

Link to comment

Okay.

 

Láttam, hogy magyar  vagy ezért ezt magyarul írom mert az angolom elég gyászos :(

Szóval.. azt szeretném megtudni, hogy a handling flageket hogy lehet külön külön változtatgatni?

Eddig ami volt flag változtatóm azzal az volt a baj, hogy az olyan autókon amiken alapból van HYDRAULIC_GEOM flag (Blade, Savanna stb.. lowriderek) és elkezdtem játszani a kerék szélesség állításával akkor a ez a HYDRAULIC_GEOM vagy kitörlődött, vagy megmaradt és mellé berakta a HYDRAULIC_INST flaget is ami azzal jár, hogy hidraulika lesz a kocsiban az addVehicleComponent nélkül (ez a baj :/). Ugyan ez érvényes volt a nitróra is: NITRO_INST.

Remélem valamennyire érthető a probléma.

 

In very bad english:

So ... I want to know how handling flags can be separately changed?

So far, what was my flag change was the problem of having a HYDRAULIC_GEOM flag (Blade, Savanna, etc .. lowrider) on the base and I started to play with the wheel width adjustment, this is HYDRAULIC_GEOM or deleted or stayed and added The HYDRAULIC_INST flag also means that there will be hydraulics in the car without the addVehicleComponent (this is the problem: /). Although this was valid for nitrous: NITRO_INST.

I hope the problem is somewhat understandable.

Edited by Chris18
Link to comment

Gimme a minute, testing it atm.

Szóval, tuti hogy lenne könnyebb megoldása ennek de ez egy működőképes dolog.

addCommandHandler("changetire", function(thePlayer, cmdName, newValue)
	if isPedInVehicle(thePlayer) then
		local pVeh = getPedOccupiedVehicle(thePlayer)
		local defHandling = string.format("%x", getVehicleHandling(pVeh)["handlingFlags"])
		local newHandling = "0x" .. string.sub(defHandling, 0, 2) .. newValue .. string.sub(defHandling, 5)
		outputChatBox("Default handling: " .. "0x" .. defHandling)
		outputChatBox("New handling: " .. newHandling)
		setVehicleHandling(pVeh, "handlingFlags", tonumber(newHandling))
	end
end)

 

Link to comment

Szóval nekem a Blade-en alapból van HYDRAULIC_GEOM, LOW_RIDER, SWINGING_CHASSIS flag, és neked is ott van. De amit kapsz a getVehicleHandlingből az visszafelé írja.

Default handling: 0x12010000

Az első az utolsó bájt a 8-as és az értéke 1 azaz SWINGING_CHASSIS

A második az utolsó előtti bájt a 7-es és az értéke 2-es azaz LOW_RIDER

A harmadik az 6-os bájt és az értéke 3-as azaz nincsen se OFFROAD_ABILITY,ABILITY2,HALOGEN,PROC_REARWHEEL flag

A negyedik az 5-ös bájt és az értéke 1-es azaz HYDRAULIC_GEOM

 

Remélem érthető :D

Link to comment

Ahh, és tényleg, egy kicsit várj, megcsinálom.

Nézd meg ezt.

addCommandHandler("changetire", function(thePlayer, cmdName, newValue)
	if isPedInVehicle(thePlayer) then
		local pVeh = getPedOccupiedVehicle(thePlayer)
		local defHandling = string.reverse(string.format("%08x", getVehicleHandling(pVeh)["handlingFlags"]))
		local newHandling = string.sub(defHandling, 0, 2) .. newValue .. string.sub(defHandling, 5)
		outputChatBox("Default handling: " .. "0x" .. defHandling)
		outputChatBox("New handling: " .. "0x" .. newHandling)
		setVehicleHandling(pVeh, "handlingFlags", tonumber("0x" .. string.reverse(newHandling)))
	end
end)

 

  • Haha 1
Link to comment

Nem tudom miért veszi ki, mert annak köze nincs a handlingFlags attributehoz. De ezzel működik.

addCommandHandler("changetire", function(thePlayer, cmdName, newValue)
	if isPedInVehicle(thePlayer) then
		local pVeh = getPedOccupiedVehicle(thePlayer)
		local vehUpgrades = getVehicleUpgrades(pVeh)
		local hasHydra = false
		for i, k in ipairs(vehUpgrades) do
			if k == 1087 then
				hasHydra = true
				break
			end
		end
		local defHandling = string.reverse(string.format("%08x", getVehicleHandling(pVeh)["handlingFlags"]))
		local newHandling = string.sub(defHandling, 0, 2) .. newValue .. string.sub(defHandling, 5)
		outputChatBox("Default handling: " .. "0x" .. defHandling)
		outputChatBox("New handling: " .. "0x" .. newHandling)
		setVehicleHandling(pVeh, "handlingFlags", tonumber("0x" .. string.reverse(newHandling)))
		addedH = hasHydra and addVehicleUpgrade(pVeh, 1087) or false
		outputChatBox(addedH and "Readded hydraulics." or "Didn't have hydraulics.")
	end
end)

 

  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...