-
Posts
8 -
Joined
-
Last visited
Posts posted by ByCash
-
-
Spoiler
Hello dear friends, first of all, I am writing this text using translate. I apologize to everyone for my bad English. Forgive me if I put the issue in the wrong section. - I want to enlarge the wheels of the vehicles and make camber adjustments and I came across this content in the forum https://forum.multitheftauto.com/topic/92222-custom-wheel/ but the system in this content applies only to the front wheels and it goes underground when the wheel grows and how I will fix these errors from you I want your help, thank you very much in advance. :)
Client-Side
Spoiler-- Table containing vehicles that have custom wheels local createdCustomWheels = { } --[[ /customwheels [ number tilt, number scale ] Adds custom wheels to your currently occupied vehicle and optionally applies a tilt angle and wheel scale. ]] addCommandHandler( 'customwheels', function( _, tilt, scale ) -- Let's get our vehicle local vehicle = getPedOccupiedVehicle( localPlayer ) -- Oh, we have a vehicle! if ( vehicle ) then -- Let's give it a wheel now addVehicleCustomWheel( vehicle, 1075, tilt, scale ) end end ) -- Let's bind that command to F2 as requested by OP bindKey( 'f2', 'down', 'customwheels' ) --[[ void addVehicleCustomWheel ( vehicle vehicle, number model [ , number tilt, number scale ] ) Adds custom wheels to the vehicle. ]] function addVehicleCustomWheel( vehicle, model, tilt, scale ) -- If we've given the object's model number if ( tonumber( model ) ) then -- Let's delete any old ones for _, wheel in pairs( createdCustomWheels[ vehicle ] or { } ) do destroyElement( wheel.object ) end -- And let's nil it to be clear createdCustomWheels[ vehicle ] = nil -- Let's set some component names we want to customize local wheels = { 'wheel_lf_dummy', 'wheel_rf_dummy' } -- Let's iterate through those components for i = 1, #wheels do -- Let's hide the existing component setVehicleComponentVisible( vehicle, wheels[ i ], false ) -- Initialize our wheel table local wheel = { tilt = tonumber( tilt ) or 0, -- We'll default a non-number tilt angle to 0 name = wheels[ i ], -- Let's store the component name object = createObject( model, Vector3( ) ) -- Let's make a new wheel object } -- Let's set the vehicle as the wheel object's parent setElementParent( wheel.object, vehicle ) -- Let's make sure the wheel is not colliding with the vehicle setElementCollidableWith( wheel.object, vehicle, false ) -- Let's change the scale setObjectScale( wheel.object, tonumber( scale ) or 0.7 ) -- Let's update that original table wheels[ i ] = wheel end -- And let's store all of those wheels now createdCustomWheels[ vehicle ] = wheels end end --[[ void calculateVehicleWheelRotation ( vehicle vehicle, table wheel ) Let's calculate the wheel rotation for given wheel(s). ]] function calculateVehicleWheelRotation( vehicle, wheel ) -- If we have many wheels in the given argument if ( type( wheel ) == 'table' ) and ( #wheel > 0 ) then -- Let's iterate through them all for i = 1, #wheel do -- Let's call the method alone with just the iterator calculateVehicleWheelRotation( vehicle, wheel[ i ] ) end -- Let's stop here now return end -- If we have an object if ( wheel.object ) then -- Let's get the rotation vector of the original component local rotation = Vector3( getVehicleComponentRotation( vehicle, wheel.name, 'world' ) ) -- Let's set our tilt angle rotation.y = wheel.tilt -- Let's make sure the wheel is at the original component's position setElementPosition( wheel.object, Vector3( getVehicleComponentPosition( vehicle, wheel.name, 'world' ) ) ) -- Let's finally set the rotation (in ZYX order, important!) setElementRotation( wheel.object, rotation, "ZYX" ) end end -- Render-time! addEventHandler( 'onClientPreRender', root, function( ) -- Let's iterate through all the vehicles for vehicle, wheels in pairs( createdCustomWheels ) do -- If we have a vehicle, it's streamed in and it has wheels if ( vehicle ) and ( isElementStreamedIn( vehicle ) ) and ( #wheels > 0 ) then -- Let's calculate wheel rotation! calculateVehicleWheelRotation( vehicle, wheels ) end end end )
-
Tag Panel
Scripti görüntülemek için tıklayınız.
Versiyon 1 İndirmek için tıklayınız.
Versiyon 2 İndirmek için tıklayınız.
Versiyon 3 İndirmek için tıklayınız.
Versiyon 3.9 İndirmek için tıklayınız.
Versiyon 4 İndirmek için tıklayınız.
i.resimyukle.xyz/5aaeSb.png[/img]
Versiyon 4.1.1 ile eklenen özellik:
resmim.net/f/oIltFg.png[/img]
-
-
Delete please.
https://community.multitheftauto.com/index.php?p=resources&s=details&id=14418
DENIED (it's already suspended)
-
-
Tag Panel
ByCash / ShockWave
You can tag.
No authority to tag.
There are 18 tag capacities.
Key: Ohttp://i.hizliresim.com/G3RdDy.png
https://community.multitheftauto.com/index.php?p=resources&s=details&id=13650
ByCash/Skype: kadir_mazlum
ShockWave/Skype: onurnalban123 -
Hello, I will share the new admin panel with you this day.
https://community.multitheftauto.com/index.php?p=resources&s=details&id=14252
[HELP] Changing Wheel Size
in Scripting
Posted
Help me please?