Hallo liebe Community,
Ich weiß ich stelle relativ viele Fragen & heute habe ich eine spezielle Frage.
Mein Kumpel hat ein Verfolgungsjagt Musik Script geschrieben indem es sich handelt,
wenn ein Spieler Wanteds hat & ein Polizist in der Nähe [Bestimmter Radius] ist eine
Melodie abspielt, aber dies scheint wohl nicht zu gelingen & bräuchten daher hilfe.
Es gibt keine Errors und möchte einfach nicht funktionieren.
[Das Script wurde auf Vio-Lite abgestimmt]
Hier ist die Server Datei
Code
addEventHandler("onPlayerJoin",root,function()
local col = createColSphere(0,0,0,100)
attachElements(col,source)
local player = source
addEventHandler("onColShapeHit",col,function(hitElement,dim)
if hitElement and dim then
if getElementType(hitElement) == "player" then
local hitPlayer = hitElement
end
if isStateFaction(hitPlayer) and getPlayerWantedLevel(player) >= 1 then
triggerClientEvent(player,"startMafiaSoundtrack",player)
end
end
end)
addEventHandler("onColShapeLeave",col,function(hitElement,dim)
if hitElement and dim then
if getElementType(hitElement) == "player" then
local hitPlayer = hitElement
end
if isStateFaction(hitPlayer) and getPlayerWantedLevel(player) >= 1 and getFactionMembersInColShape(col) == 0 then
triggerClientEvent(player,"stopMafiaSoundtrack",player)
end
end
end)
end)
function getFactionMembersInColShape(col)
local count = 0
for i,p in pairs(getElementsByType("player")) do
if isStateFaction(p) and isElementWithinColShape(p,col) then
count = count + 1
end
end
return count
end
Alles anzeigen
Hier ist die Client Datei
Code
local stopcommand = "stopvm"
local soundpath = "sounds/Verfolgungsjagt.mp3"
addEvent("startMafiaSoundtrack",true)
function startMafiaSoundtrack ()
if isElement(mafiasound) then
return
end
mafiasound = playSound(soundpath,true)
end
addEventHandler("startMafiaSoundtrack",root,startMafiaSoundtrack)
addEvent("stopMafiaSoundtrack",true)
function stopMafiaSoundtrack ()
if isElement(mafiasound) then
destroyElement(mafiasound)
end
end
addEventHandler("stopMafiaSoundtrack",root,stopMafiaSoundtrack)
Alles anzeigen
Ich hoffe ihr könnt mir weiter helfen.
Jedoch weiß ich jetzt schon dass einige Leute es für sich nutzen werden wahrscheinlich leider,
aber ich kann auf Hilfe nicht verzichten.
Mit Freundlichen Grüßen,
Max