Hello,
I've been trying to attach an effect to a vehicle, which in my understanding should work.
I'm getting this error:
ERROR: attempt to call global 'attachEffect' (a nil value)
function rustlerEngine()
local vehicle = getPedOccupiedVehicle(localPlayer)
local x, y, z = getElementPosition(vehicle)
local rx, ry, rz = getElementRotation(vehicle)
local engineSmoke = createEffect ( "smoke30m", x-3, y, z, rx, ry, rz )
if(vehicle)then
if getElementModel(vehicle) == 476 then
toggleControl ( "accelerate", false )
toggleControl ( "brake_reverse", false )
attachEffect(engineSmoke, vehicle)
setEffectSpeed(engineSmoke, 10)
outputChatBox ("simulating loss of engine", 0, 190, 255)
end
end
end
bindKey("0", "down", rustlerEngine)
What am I missing?