create fire position fX fY fZ
function startTheFire (fX,fY,fZ)
setElementData(fire, "x", fX)
setElementData(fire, "y", fY)
setElementData(fire, "z", fZ)
setTimer ( function()
createFire(fX,fY,fZ,60)
end, 420000, 1)
local Soundone = playSound3D( "files/firealarm.mp3",fX,fY,fZ, false )
setSoundMinDistance(Soundone, 25)
setSoundMaxDistance(Soundone, 70)
local Soundtwo = playSound3D( "files/firealarmsecond.mp3",-2039.7060546875 ,78.998046875 ,28.397680282593, false )
setSoundMinDistance(Soundtwo, 25)
setSoundMaxDistance(Soundtwo, 70)
--setSoundVolume( Sound, 1 )
local fire = engineLoadDFF("fire.dff",1)
engineReplaceModel(fire,fireModel)
end
addEvent("startTheFire",true)
addEventHandler( "startTheFire", getRootElement(), startTheFire)
Problem:
function firelost(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement)
if (weapon==42) then
local team = getPlayerTeam(getLocalPlayer())
local ftype = getElementData(getLocalPlayer(), "faction")
if (ftype==4) then
if not (hitElement) or (getElementType(hitElement)~="player") then
if not cooldown then
if (ammoInClip>10) and (weapon==42) then
local x, y, z = hitX, hitY, hitZ
local x2 = getElementData(fire, "x")
local y2 = getElementData(fire, "y")
local z2 = getElementData(fire, "z")
if getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) > 10 then
outputChatBox("Are not fire.", 255, 0, 0)
count = 0
cooldown = setTimer(resetCooldown, 5000, 1, false)
else
count = count + 1
if (count==20) then
count = 0
cooldown = setTimer(resetCooldown, 30000, 1, false)
triggerServerEvent("cancelrandomfires", localPlayer)
end
end
end
end
end
end
end
end
addEventHandler("onClientPlayerWeaponFire", getLocalPlayer(),firelost)
error:
Bad argument @ 'getDistanceBetweenPoints3D' [Expected vector3 at argument 4, got boolean]
Thank You