SoManyTears Posted December 31, 2020 Share Posted December 31, 2020 these codes I wrote do drop fps every 10 seconds.How can I use the setlementCollidableWith function properly? please help friends. setTimer (function() for i,peds in ipairs (getElementsByType ("ped")) do for i,players in ipairs (getElementsByType ("player")) do setElementCollidableWith (peds,players,false) end for i,vehicles in ipairs (getElementsByType ("vehicle")) do setElementCollidableWith (peds,vehicles,false) end for i,objects in ipairs (getElementsByType ("object")) do setElementCollidableWith (peds,objects,false) end end end,10000,0) Link to comment
Tekken Posted December 31, 2020 Share Posted December 31, 2020 Well when you spawn a object you do serElementColidableWith Link to comment
Moderators IIYAMA Posted December 31, 2020 Moderators Share Posted December 31, 2020 (edited) 3 hours ago, SoManyTears said: these codes I wrote do drop fps every 10 seconds.How can I use the setlementCollidableWith function properly? please help friends. You could apply the effect only when the elements are streamed in, that would be an enormous improved in terms of performance. -- already streamed in elements for i,peds in ipairs (getElementsByType ("ped", root, true)) do for i,players in ipairs (getElementsByType ("player", root, true)) do setElementCollidableWith (peds,players,false) end for i,vehicles in ipairs (getElementsByType ("vehicle", root, true)) do setElementCollidableWith (peds,vehicles,false) end for i,objects in ipairs (getElementsByType ("object", root, true)) do setElementCollidableWith (peds,objects,false) end end -- -- new streamed in elements local acceptedElementTypes = {player = true, vehicle = true, object = true} addEventHandler( "onClientElementStreamIn", root, function ( ) local elementType = getElementType( source ) if acceptedElementTypes[elementType] then local peds = getElementsByType ("ped", root, true) for i=1, #peds do local ped = peds[i] setElementCollidableWith (ped,source,false) end elseif elementType == "ped" then -- what if it is a new ped? You can program this step yourself. end end ) Edited December 31, 2020 by IIYAMA 1 Link to comment
Moderators IIYAMA Posted January 2, 2021 Moderators Share Posted January 2, 2021 @SoManyTears Is your problem resolved? Link to comment
SoManyTears Posted January 3, 2021 Author Share Posted January 3, 2021 On 02/01/2021 at 16:22, IIYAMA said: @SoManyTears Is your problem resolved? thank you for your help IIYAMA. i was away from the computer.I tried this but failed.still peds cannot pass through objects. Link to comment
Moderators IIYAMA Posted January 3, 2021 Moderators Share Posted January 3, 2021 37 minutes ago, SoManyTears said: thank you for your help IIYAMA. i was away from the computer.I tried this but failed.still peds cannot pass through objects. I assume you filled in the last part? (where my comment is) Please show me what you cooked from it. Link to comment
SoManyTears Posted January 13, 2021 Author Share Posted January 13, 2021 hey ı was far away from my pc.ı did this man ! thank you 1 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