lopezloo

MTASA bug #7951 fix

Dec 27th, 2013
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.37 KB | None | 0 0
  1. -- Fix for #7951 bug (client)
  2. -- https://bugs.multitheftauto.com/view.php?id=7951
  3. addEventHandler("onClientElementStreamIn", root,
  4.     function()
  5.         if getElementType(source) == "vehicle" then
  6.             fixMonster(source)
  7.         end
  8.     end
  9. )
  10.  
  11. function fixMonster(veh)
  12.     if getElementModel(veh) == 557 and getVehicleOccupant(veh) == false then
  13.         local x, y, z = getElementPosition(veh)
  14.        
  15.         --[[local hit, _, _, _, hitElement, _, _, _, _, lighting = processLineOfSight(x, y, z-1, x, y, z+5, true, true, false)
  16.         if hit and getElementType(hitElement) == "vehicle" then
  17.             outputChatBox("Monster light before fix: " .. tostring(lighting))
  18.             outputChatBox(tostring(getElementModel(hitElement)))
  19.         end
  20.        
  21.         addEventHandler("onClientRender", root,
  22.             function()
  23.                 dxDrawLine3D(x, y, z-1, x, y, z+5, tocolor(0, 255, 0), 2)
  24.             end
  25.         )--]]
  26.        
  27.         local ped = createPed(0, x, y, z+1)
  28.         setElementAlpha(ped, 0)            
  29.        
  30.         setTimer(
  31.             function()
  32.                 destroyElement(ped)
  33.                 --[[local hit, _, _, _, hitElement, _, _, _, _, lighting = processLineOfSight(x, y, z-1, x, y, z+5, true, true, false)
  34.                 if hit and getElementType(hitElement) == "vehicle" then
  35.                     outputChatBox("Monster light after fix: " .. tostring(lighting))
  36.                 end]]--
  37.             end, 50, 1)
  38.     end
  39. end
  40.  
  41. addCommandHandler("monster",
  42.     function()
  43.         for k, v in pairs(getElementsByType("vehicle")) do
  44.             fixMonster(v)
  45.         end
  46.     end
  47. )
Advertisement
Add Comment
Please, Sign In to add comment