Tekken Posted May 1, 2020 Share Posted May 1, 2020 So in my server I have a lots of peds but when I try to drive them over they do nothing but blocking the car. How can I do that they tumbles down? Link to comment
Moderators IIYAMA Posted May 1, 2020 Moderators Share Posted May 1, 2020 (edited) 15 minutes ago, Tekken said: How can I do that they tumbles down? You could disable the collision between the car and ped for 1 or 2 frames after you ram it. https://wiki.multitheftauto.com/wiki/OnClientVehicleCollision https://wiki.multitheftauto.com/wiki/SetElementCollidableWith This way it could be more easy to ran them over. Edited May 1, 2020 by IIYAMA Link to comment
Scripting Moderators ds1-e Posted May 1, 2020 Scripting Moderators Share Posted May 1, 2020 47 minutes ago, Tekken said: So in my server I have a lots of peds but when I try to drive them over they do nothing but blocking the car. How can I do that they tumbles down? Other solution, you might try to use animation when they got hit by car. (onClientPedDamage) Link to comment
Tekken Posted May 1, 2020 Author Share Posted May 1, 2020 @majqq What about the peds that are managed by slothbot? As those ones have continuos animations and those interpolates. @IIYAMA I don't see how this will work? I tried like this but that does nothing besides letting the ped pass through the vehicle for a fraction of a second. addEventHandler("onClientVehicleCollision", root, function(hitElement) if hitElement and getElementType(hitElement) == "ped" then setElementCollidableWith(source, hitElement, false); setTimer(setElementCollidableWith, 1000, 1, source, hitElement, true); end end); Hold on, it may be because I have canceled the event onClientPedDamage could it? Yes indeed this was a misconception of onClientPedDamage thank you guys anyway! Link to comment
Moderators IIYAMA Posted May 1, 2020 Moderators Share Posted May 1, 2020 (edited) 1 hour ago, Tekken said: I don't see how this will work? I tried like this but that does nothing besides letting the ped pass through the vehicle for a fraction of a second. 1 second is a lot of frames. Too many to be honest, it loses it's purpose if you do that. The whole purpose is to slowly push those peds aside, instead of blocking. NOTE: This is still a concept, there are no guarantees that it will work. You can use my callNextFrame function if you want. source --[[ -- callNextFrame function ]] local tableRemove = table.remove local serverSide = triggerClientEvent and true or false do local nextFrameCalls = {} local serverSideTimer local processing = false local function process () --[[ Do an empty check at the beginning of the function, this will make sure to make an extra run in case of heavy work load. If the timer is killed or the addEventHandler is removed, then this has to be re-attached again every frame. This is not very healthy... ]] if #nextFrameCalls == 0 then if serverSide then if serverSideTimer then if isTimer(serverSideTimer) then killTimer(serverSideTimer) end serverSideTimer = nil end else removeEventHandler("onClientRender", root, process) end processing = false return end -- In case of calling the function callNextFrame within the process, the loop type `repeat until` is required. repeat local item = nextFrameCalls[1] item.callback(unpack(item.content)) tableRemove(nextFrameCalls, 1) until #nextFrameCalls == 0 end function callNextFrame (callback, ...) if type(callback) == "function" then local newIndex = #nextFrameCalls + 1 nextFrameCalls[newIndex] = {callback = callback, content = {...}} if not processing then if serverSide then serverSideTimer = setTimer(process, 50, 0) else addEventHandler("onClientRender", root, process) end processing = true end return true end return false end end Edited May 1, 2020 by IIYAMA 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