iDannz [Breno] Posted April 14, 2019 Share Posted April 14, 2019 Everyone knows that there is a bug that occurs when there is a dead ped, and if you are not around at the time of your death, the ped can bug and stand (even dead) The question is: is there any way to fix this? maybe creating some kind of loop? Pic: https://prnt.sc/nbs67g Link to comment
Scripting Moderators ds1-e Posted April 14, 2019 Scripting Moderators Share Posted April 14, 2019 27 minutes ago, said: Everyone knows that there is a bug that occurs when there is a dead ped, and if you are not around at the time of your death, the ped can bug and stand (even dead) The question is: is there any way to fix this? maybe creating some kind of loop? Pic: https://prnt.sc/nbs67g - Create 2 tables, client-side + server-side. - Save ped animation in both tables, server-side when creating a ped, and client-side using trigger(Latent)ClientEvent. - For client-side it will work only for players that are online so... You would need to send server-side table to latejoiner onPlayerLogin. - Use onClientElementStreamIn to apply this "fix". - Use onClientElementDestroy/onElementDestroy to clear data from tables. (in case of destroying peds) This is part of code which i've done sometime ago, of course it can be done better, and I used elementdata, which is probably don't needed because you can use "ped element" instead of it (userdata). -- client local deadPlayersCacheClient = { block = {}, animation = {}, } function OnElementClientStreamIn() if getElementType(source) == "ped" then local parent = getElementData(source, "core:parent") if parent then if deadPlayersCacheClient.block[parent] and deadPlayersCacheClient.animation[parent] then setPedAnimation(source, deadPlayersCacheClient.block[parent], deadPlayersCacheClient.animation[parent], -1, false, true, false, true) end end end end addEventHandler("onClientElementStreamIn", getRootElement(), OnElementClientStreamIn) 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