Jump to content

need some help in basemode sounds player headshot multikill


Recommended Posts

need a help plz

i download the script sounds on resource mta sa

the name of the script is utsounds.biz

i know how to install scripts on my server

and when i install utsounds.zip

for sounds player like headshot multikill and other sounds

when i running the utsounds and when i kill someone with sniper it says headshot and multikill all is ok on sniper

but when i kill someone with m4 i cant hear anything only i hear the sounds with sniper

i mean when i kill someone on sniper

but on the m4 or other weapons i cant hear the sounds

plz help me i want all sounds work without any problem

i want hear sounds with all weapons i mean when the kill player

and this is script lua

utsounds_client.lua

  
setElementData(getLocalPlayer(),"utToggle",true) 
local utvolume = 1 
  
function killCheck(angreifer,waffe,stelle) 
    if angreifer then 
        if angreifer ~= source then 
        local sourceteam,angreiferteam = getPlayerTeam(source),getPlayerTeam(angreifer) 
            if angreifer == getLocalPlayer() then 
                if sourceteam and angreiferteam and sourceteam == angreiferteam then 
                    playClientAudio("teamkiller.mp3") 
                else 
                    if waffe >= 22 and waffe <= 34 then 
                        local killerkills = getElementData(angreifer,"killnumber") 
                        if not special and stelle == 9 then 
                            playClientAudio("headshot.mp3") 
                        elseif not killerkills or killerkills % 2 == 1 or killerkills <= 1 or killerkills >= 18 then 
                            local ammocount = getElementData(source,"ammocount"..tostring(angreifer)) 
                            local accuracy = getElementData(angreifer,"accuracy") 
                            if ammocount and accuracy then 
                                if ammocount <= ludicrousB and accuracy >= ludicrousA then 
                                    playClientAudio("ludicrouskill.mp3") 
                                elseif ammocount <= monsterB and accuracy >= monsterA then 
                                    playClientAudio("monsterkill.mp3") 
                                elseif ammocount <= ultraB and accuracy >= ultraA then 
                                    playClientAudio("ultrakill.mp3") 
                                elseif stelle == 9 then 
                                    playClientAudio("headshot.mp3") 
                                end 
                            end 
                        end 
                    end 
                end 
            elseif source == getLocalPlayer() and stelle == 9 and waffe >= 22 and waffe <= 34 then 
                if not sourceteam or not angreiferteam or sourceteam ~= angreiferteam then 
                    --playClientAudio("blamiert.mp3") 
                end 
            end 
        end 
        setTimer(resetStat,50,1,source,"ammocount"..tostring(angreifer)) 
        if killreset then 
            setTimer(resetStat,50,1,angreifer,"allhits") 
            setTimer(resetStat,50,1,angreifer,"allbullets") 
        end 
    end 
    resetStat(source,"killnumber") 
    if spawnreset then 
        setTimer(resetStat,50,1,angreifer,"allhits") 
        setTimer(resetStat,50,1,angreifer,"allbullets") 
    end 
end 
  
function bulletCounting(waffe,ammo,magazinammo,,yd,zd,element) 
    local allbullets = getElementData(source,"allbullets") 
    if waffe >= 22 and waffe <= 34 then 
        if not allbullets then 
            allbullets = 1 
        else 
            allbullets = allbullets + 1 
        end 
    end 
    local allhits = getElementData(source,"allhits") 
    if not allhits then 
        allhits = 0 
    end 
    if element then 
        if waffe >= 22 and waffe <= 34 then 
            if getElementType(element) == "vehicle" or getElementType(element) == "ped" then 
                allhits = allhits + 1 
            elseif getElementType(element) == "player" then 
                allhits = allhits + 1 
                local bullets = getElementData(element,"ammocount"..tostring(source)) 
                if not bullets or bullets == 0 then 
                    setElementData(element,"ammocount"..tostring(source),1,false) 
                else 
                    bullets = bullets + 1 
                    setElementData(element,"ammocount"..tostring(source),bullets,false) 
                end 
            end 
        end 
    end 
    if not allhits or allhits == 0 then 
        setElementData(source,"accuracy",0) 
    else 
        setElementData(source,"accuracy",allhits / allbullets,true) 
    end 
    setElementData(source,"allbullets",allbullets) 
    setElementData(source,"allhits",allhits) 
end 
  
function playClientAudio(sound) 
    if getElementData(getLocalPlayer(),"utToggle") then 
        local sound = playSound("sounds/"..sound, false) 
        setSoundVolume(sound,utvolume) 
    end 
end 
  
function resetStat(player,stat) 
    setElementData(player,stat,0,true) 
end 
  
function toggleSounds() 
    if client then 
        local state = getElementData(getLocalPlayer(),"utToggle") 
        if state == true then state = "#00FF00On" else state = "#FF0000Off" end 
        outputChatBox("UT sounds are now: "..state,255,255,255,true) 
        setElementData(getLocalPlayer(),"utToggle",not getElementData(getLocalPlayer(),"utToggle")) 
    else 
        outputChatBox("It's not allowed to toggle the sounds on this server.") 
    end 
end 
  
function soundVolume(command,volume) 
    if client then 
        volume = tonumber(volume) 
        if volume >= 1 then volume = 1 end 
        if volume <= 0 then volume = 0 end 
        utvolume = volume 
    else 
        outputChatBox("Setting the sound volume is not allowed on this server.") 
    end 
end 
  
function getServerSettings() 
    triggerServerEvent("onAskForServerSettings",getLocalPlayer()) 
end 
  
function saveSettings(settings) 
    client     = settings[1] 
    special    = settings[2] 
    ludicrousA = settings[3] 
    monsterA   = settings[4] 
    ultraA     = settings[5] 
    killreset  = settings[6] 
    spawnreset = settings[7] 
    ludicrousB = settings[8] 
    monsterB   = settings[9] 
    ultraB     = settings[10] 
end 
  
addEvent("onSendSoundToClient",true) 
addEvent("onSettingsReturn",true) 
addEventHandler("onClientPlayerWasted",getRootElement(),killCheck) 
addEventHandler("onClientPlayerWeaponFire",getLocalPlayer(),bulletCounting) 
addEventHandler("onSendSoundToClient",getRootElement(),playClientAudio) 
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),getServerSettings) 
addEventHandler("onSettingsReturn",getRootElement(),saveSettings) 
addCommandHandler("utsounds",toggleSounds) 
addCommandHandler("utvolume",soundVolume) 
  
  
  
  

and

utsounds_server.lua

  
  
  
local headshot   = get("utsounds.EnableHeadshot") 
local sniper     = get("utsounds.EnableSniper1Hit") 
local client     = get("utsounds.AllowClientTurnOff") 
local special    = get("utsounds.EnableSpecialKills") 
local ludicrousA = tonumber(get("utsounds.LudicrousAccuracy")) 
local monsterA   = tonumber(get("utsounds.MonsterAccuracy")) 
local ultraA     = tonumber(get("utsounds.UltraAccuracy")) 
local killreset  = get("utsounds.ResetOnKill") 
local spawnreset = get("utsounds.ResetOnSpawn") 
local ludicrousB = tonumber(get("utsounds.LudicrousBullets")) 
local monsterB   = tonumber(get("utsounds.MonsterBullets")) 
local ultraB     = tonumber(get("utsounds.UltraBullets")) 
  
if headshot   == "true" then headshot   = true else headshot   = false end 
if sniper     == "true" then sniper     = true else sniper     = false end 
if client     == "true" then client     = true else client     = false end 
if special    == "true" then special    = true else special    = false end 
if killreset  == "true" then killreset  = true else killreset  = false end 
if spawnreset == "true" then spawnreset = true else spawnreset = false end 
  
function resetAll() 
    local players = getElementsByType("player") 
    for i,player in ipairs (players) do 
        setElementData(player,"killnumber",0) 
        setElementData(player,"allbullets",0) 
        setElementData(player,"allhits",0) 
        setElementData(player,"accuracy",0) 
    end 
end 
  
function resetStat(player,stat) 
    setElementData(player,stat,0) 
end 
  
function checkBoth(angreifer,waffe,stelle) 
    if headshot and stelle == 9 and waffe >= 22 then 
        killPed(source,angreifer,waffe,stelle) 
    elseif sniper and (stelle == 3 or stelle == 4 or stelle == 9) and waffe == 34 then 
        killPed(source,angreifer,waffe,stelle) 
    end 
end 
  
function headshotKillmessage(killer,waffe,stelle) 
    if stelle == 9 then 
        cancelEvent() 
        local sourceTeam,killerTeam = getPlayerTeam(source),getPlayerTeam(killer) 
        local rK,gK,bK = getPlayerNametagColor(killer) 
        local rS,gS,bS = getPlayerNametagColor(source) 
        exports.killmessages:outputMessage( 
            {getPlayerName(killer),{"padding",width=3},{"icon",id=waffe},{"padding",width=3}, 
            {"icon",id=256},{"padding",width=3},{"color",r=rS,g=gS,b=bS},getPlayerName(source)}, 
            getRootElement(),rK,gK,bK) 
    end 
end 
  
function checkKills(ammo,killer,weapon) 
    if killer then 
        if killer ~= source then 
            local killerkills = getElementData(killer,"killnumber") 
            if (not getPlayerTeam(source) or not getPlayerTeam(killer)) or getPlayerTeam(source) ~= getPlayerTeam(killer) then 
                if killerkills == false then 
                    killerkills = 0 
                elseif killerkills == 2 then 
                    local sound = "multikill.mp3" 
                    triggerClientEvent(killer,"onSendSoundToClient",getRootElement(),sound) 
                elseif killerkills == 4 then 
                    local sound = "killingspree.mp3" 
                    triggerClientEvent(killer,"onSendSoundToClient",getRootElement(),sound) 
                elseif killerkills == 6 then 
                    local sound = "dominating.mp3" 
                    triggerClientEvent(killer,"onSendSoundToClient",getRootElement(),sound) 
                elseif killerkills == 8 then 
                    local sound = "rampage.mp3" 
                    triggerClientEvent(killer,"onSendSoundToClient",getRootElement(),sound) 
                elseif killerkills == 10 then 
                    local sound = "unstoppable.mp3" 
                    triggerClientEvent(killer,"onSendSoundToClient",getRootElement(),sound) 
                elseif killerkills == 12 then 
                    local sound = "holyshit.mp3" 
                    triggerClientEvent(killer,"onSendSoundToClient",getRootElement(),sound) 
                elseif killerkills == 14 then 
                    local sound = "wickedsick.mp3" 
                    triggerClientEvent(killer,"onSendSoundToClient",getRootElement(),sound) 
                elseif killerkills == 16 then 
                    local sound = "godlike.mp3" 
                    triggerClientEvent(killer,"onSendSoundToClient",getRootElement(),sound) 
                end 
            killerkills = killerkills + 1 
            setElementData(killer,"killnumber",killerkills) 
            end 
        end 
    end 
end 
  
function returnTheSettings() 
    local settings = 
    { 
    client, 
    special, 
    ludicrousA, 
    monsterA, 
    ultraA, 
    killreset, 
    spawnreset, 
    ludicrousB, 
    monsterB, 
    ultraB 
    } 
    triggerClientEvent(source,"onSettingsReturn",getRootElement(),settings) 
end 
  
addEvent("onAskForServerSettings",true) 
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),resetAll) 
addEventHandler("onPlayerDamage",getRootElement(),checkBoth) 
addEventHandler("onPlayerKillMessage",getRootElement(),headshotKillmessage) 
addEventHandler("onPlayerWasted",getRootElement(),checkKills) 
addEventHandler("onAskForServerSettings",getRootElement(),returnTheSettings) 
  

so what is my problem why i cant hear all sounds on all weapons why only i hear headshot on sniper

plz healp me and if anyone have scripts sounds working plz give it to me.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...