Jump to content

Tyres


WhoAmI

Recommended Posts

I thought that object 2899 destroys tyres by itself, but as I can see it doesn't. Is there any function to destroy them? And shall I use colision for it or is there any other way to do that?

You can use

SetVehicleWheelStates 

https://wiki.multitheftauto.com/wiki/Se ... heelStates

How i can do that I'm putting this object on front of me?

Not like this: http://scr.hu/4lpu/7x9fs

You mean droping the spikes in front of you?

or want the object to be placed stright?

Link to comment
        local x, y, z = getElementPosition ( player ) 
        local _, _, rz = getElementRotation ( player ) 
        outputChatBox ( rz ) 
        local x, y = x, y+2.5 
        kolczatka [ player ] = createObject ( 2899, x, y, z-0.8, 0, 0, rz ) 
        kCol [ player ] = createColCuboid ( x-1, y-2.5, z-0.8, 2, 5, 1 ) 

It creates well only if my "z" rotation is 90. Then it creates object in front of me, in other angles it doesn't work well.

Link to comment
The 2892 is bigger one.

I'm using right now createColCuboid. I just want to know how I can rotate it/create it on different angle.

just do it with;

onMarkerHit 
createMarker 
setVehicleWheelStates 
isElementWithinMarker 

more easy, I guess

Edited by Guest
Link to comment
        local x, y, z = getElementPosition ( player ) 
        local _, _, rz = getElementRotation ( player ) 
        outputChatBox ( rz ) 
        local x, y = x, y+2.5 
        kolczatka [ player ] = createObject ( 2899, x, y, z-0.8, 0, 0, rz ) 
        kCol [ player ] = createColCuboid ( x-1, y-2.5, z-0.8, 2, 5, 1 ) 

It creates well only if my "z" rotation is 90. Then it creates object in front of me, in other angles it doesn't work well.

local x2, y2, z2 = getElementPosition(kolczatka) 
kCol [ player ] = createColCuboid ( x2, y2, z2, 3) 

Link to comment
        local x, y, z = getElementPosition ( player ) 
        local _, _, rz = getElementRotation ( player ) 
        outputChatBox ( rz ) 
        local x, y = x, y+2.5 
        kolczatka [ player ] = createObject ( 2899, x, y, z-0.8, 0, 0, rz ) 
        kCol [ player ] = createColCuboid ( x-1, y-2.5, z-0.8, 2, 5, 1 ) 

It creates well only if my "z" rotation is 90. Then it creates object in front of me, in other angles it doesn't work well.

local x2, y2, z2 = getElementPosition(kolczatka) 
kCol [ player ] = createColCuboid ( x2, y2, z2, 3) 

Can you post an example on how to do that?

Link to comment
        local x, y, z = getElementPosition ( player ) 
        local _, _, rz = getElementRotation ( player ) 
        outputChatBox ( rz ) 
        local x, y = x, y+2.5 
        kolczatka [ player ] = createObject ( 2899, x, y, z-0.8, 0, 0, rz ) 
        kCol [ player ] = createColCuboid ( x-1, y-2.5, z-0.8, 2, 5, 1 ) 

It creates well only if my "z" rotation is 90. Then it creates object in front of me, in other angles it doesn't work well.

local x2, y2, z2 = getElementPosition(kolczatka) 
kCol [ player ] = createColCuboid ( x2, y2, z2, 3) 

Can you post an example on how to do that?

Sure

This will create spikes near a player when you type, /dropspike . It will destroy the vehicle tyres when you drive any vehicle above it.

Server side.

addCommandHandler("dropspike", 
    function(player) 
        if (player) then 
        local x, y, z = getElementPosition(player) 
        local spikestring = createObject(2899,x+2,y-2,z-0.9) 
        local x2, y2, z2 = getElementPosition(spikestring) 
        local coll = createColSphere(x2, y2, z2, 3) 
        addEventHandler("onColShapeHit",coll,function (player) 
        if player and getElementType(player) == "player" then 
        if isPedInVehicle(player) then 
                local pedoveh = getPedOccupiedVehicle(player)     
                setVehicleWheelStates(pedoveh,1,1,1,1) 
                end end 
        end) end 
end) 

Link to comment

Ofc it will work, but it's not correct... Why would u surround this object in a sphere.. just a matter of logic.

You will damage ur tyres if u pass over the middle (center) of the object without actually touching it.

I was just posting my advice, they are free to do whatever they want.

Link to comment
Sphere? It should be a cuboid. Also you'd need to check the wheels that actually touched the spikes, because you're ignoring this in that script snippet.

Well, you can't rotate a col-cuboid, so a sphere is definitely the best alternative.

right, I tried unpredictable's example and it fine for me.

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...