Hallo, ich wollte einen Carlock/ Motorsound hinzufügen. Ich schaffe es aber einfach nicht, dass der Sound abgespielt wird...
Hier das Script zum carlock:
Lua
local sound
function lock_func ( player, command, locknr )
if locknr == nil then
outputChatBox ( "Gebrauch: /lock [Fahrzeugnummer]", player, 255, 0, 0 )
else
if tonumber(vioGetElementData ( player, "carslot"..locknr )) >= 1 then
local pname = getPlayerName ( player )
local veh = _G[getPrivVehString ( pname, locknr )]
local x, y, z = getElementPosition( veh )
if isElement ( veh ) then
if vioGetElementData ( veh, "locked" ) then
vioSetElementData ( veh, "locked", false )
setVehicleLocked ( veh, false )
outputChatBox ( "Fahrzeug Aufgeschlossen!", player, 0, 0, 255 )
sound = playSound3D("sounds/carlock.mp3", 0, 0, 0, false)
attachElements(sound, veh)
setSoundMaxDistance(sound, 20)
setSoundMinDistance(sound, 1)
setSoundVolume(sound, 0.2)
elseif not vioGetElementData ( veh, "locked" ) then
vioSetElementData ( veh, "locked", true )
setVehicleLocked ( veh, true )
outputChatBox ( "Fahrzeug Abgeschlossen!", player, 0, 0, 255 )
end
else
outputChatBox ( "Bitte respawne dein Fahrzeug zuerst!", player, 255, 0, 0 )
end
else
outputChatBox ( "Du hast kein Fahrzeug mit diesem Namen!", player, 255, 0, 0 )
end
end
end
addEvent ( "lockPrivVehClick", true )
addEventHandler ( "lockPrivVehClick", getRootElement(), lock_func )
addCommandHandler ( "lock", lock_func )
Alles anzeigen
Ich erhalte immer diesen Error:
Lua
[2013-10-15 22:37:23] ERROR: [gamemodes]/[vio]/vio/carsys/carcommands.lua:356: attempt to call global 'playSound3D' (a nil value)
Kann mir jemand helfen?
MfG