WhoAmI Posted March 24, 2015 Share Posted March 24, 2015 Hello. 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? Also, How i can do that I'm putting this object on front of me? Not like this: http://scr.hu/4lpu/7x9fs Link to comment
Mr.unpredictable. Posted March 24, 2015 Share Posted March 24, 2015 WhoAmI said: 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 WhoAmI said: 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
WhoAmI Posted March 24, 2015 Author Share Posted March 24, 2015 Like this http://scr.hu/4lpu/lk1hr Link to comment
Mr.unpredictable. Posted March 24, 2015 Share Posted March 24, 2015 WhoAmI said: Like this http://scr.hu/4lpu/lk1hr I don't understand can you explain it ? Link to comment
WhoAmI Posted March 24, 2015 Author Share Posted March 24, 2015 I want to place this object in front of me, that's all. Not in middle of me or other. Another question. It looks now like this http://scr.hu/4lpu/sbkq7 But how i can rotate a colshape, because colshape is still the same when I'm trying to put the object on differen angle. http://scr.hu/4lpu/8r4th setElementRotation doesn't work for me. Link to comment
Mr.unpredictable. Posted March 24, 2015 Share Posted March 24, 2015 getElementPosition get the postion of object and then createColShape or createColSphere Edit: btw the object Id is 2892 Link to comment
WhoAmI Posted March 24, 2015 Author Share Posted March 24, 2015 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. Link to comment
Mr.unpredictable. Posted March 24, 2015 Share Posted March 24, 2015 can you post the part of the code, where you created the object and where you created the col ? Link to comment
WhoAmI Posted March 24, 2015 Author Share Posted March 24, 2015 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
Enargy, Posted March 24, 2015 Share Posted March 24, 2015 (edited) WhoAmI said: 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 March 24, 2015 by Guest Link to comment
Mr.unpredictable. Posted March 24, 2015 Share Posted March 24, 2015 WhoAmI said: 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
yesyesok Posted March 26, 2015 Share Posted March 26, 2015 unpredictable said: WhoAmI said: 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
Mr.unpredictable. Posted March 27, 2015 Share Posted March 27, 2015 yesyesok said: unpredictable said: WhoAmI said: 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
'LinKin Posted March 27, 2015 Share Posted March 27, 2015 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. Link to comment
Mr.unpredictable. Posted March 27, 2015 Share Posted March 27, 2015 ‘LinKin said: Sphere? It should be a cuboid. Sphere is fine, I Tried that it's working. It destroys the vehicle tyre when you drive above the object. You should have tested the code before posting. Link to comment
'LinKin Posted March 28, 2015 Share Posted March 28, 2015 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
WhoAmI Posted March 28, 2015 Author Share Posted March 28, 2015 Well, you are right though. But I couldn't set rotation of this cuboid after creating it. If there would be possibility to do that I would definitely use cuboid. Link to comment
Addlibs Posted March 29, 2015 Share Posted March 29, 2015 ‘LinKin said: 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. Link to comment
yesyesok Posted March 30, 2015 Share Posted March 30, 2015 MrTasty said: ‘LinKin said: 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now