Jump to content

index for reload sound?


Bean666

Recommended Posts

Hello i disabled original weapons sound using setWorldSoundEnabled ( 5,  false ), all of them, but the reload seems to be affected, what is the index ID for the reload sound so I can enable it?, also the punching sound is gone

Edited by Bean666
Link to post

Hey,

I played a little bit with the world sounds and found some stuff.

Here is what I found:
IDs 55 and 51 of the group 5 (weapons) are the reloading sounds for the pistols.
But its different for the other types of weapons. For example the AK47 reload sound ID is 31.

It will take some time to find them all tho since there is no (or at least I didn't find one) list of the sound IDs from each group.
 

local allowedSoundIDs = { -- all the punching IDs are here, just find the reload sounds of all weapons and add them
	9,
	28,
	31,32,34,35,
	45,46,47,48,
	50,51,54,55,56,57,58,
	64,67,
	75,
	86,87,88
}

setWorldSoundEnabled ( 5,  false )
for i, sound in pairs(allowedSoundIDs) do
	setWorldSoundEnabled(5, sound, true)
end

 

Edited by SpecT
  • Like 1
Link to post
1 hour ago, SpecT said:

Hey,

I played a little bit with the world sounds and found some stuff.

Here is what I found:
IDs 55 and 51 of the group 5 (weapons) are the reloading sounds for the pistols.
But its different for the other types of weapons. For example the AK47 reload sound ID is 31.

It will take some time to find them all tho since there is no (or at least I didn't find one) list of the sound IDs from each group.
 



local allowedSoundIDs = { -- all the punching IDs are here, just find the reload sounds of all weapons and add them
	9,
	28,
	31,32,34,35,
	45,46,47,48,
	50,51,54,55,56,57,58,
	64,67,
	75,
	86,87,88
}

setWorldSoundEnabled ( 5,  false )
for i, sound in pairs(allowedSoundIDs) do
	setWorldSoundEnabled(5, sound, true)
end

 

Hello, thankyou! but can you help me once again here, So basically this shows that everytime the boss dies theres a loop that goes thru players and checks if they have the bossparticipated data to true, we killed the boss and a player got the exp and rewards despite not joining the fight, the data is turned to true by attacking the boss, which he wasnt present at the time, so why was this triggered? idk if its possible or he was joking but can u see if there are reasons why that happened or if its possible to happen?

 

C Side ( the damage and data set to true ) 

function bossdamaged ( attacker, weapon, bodypart )
	if getElementType ( source ) == "ped" then
		if (getElementData (source, "boss") == true) or (getElementData(source, "soldier") == true) or (getElementData(source, "scientist") == true) then
         if isTimer(bosshptimer) then killTimer(bosshptimer) end
		 triggerServerEvent ("bossdamaged", source, source, attacker, weapon, bodypart )
         cancelEvent()
	    end
        if getElementData(source, "boss") == true then
         if getElementData(attacker, "bossparticipated") == true then return end
          setElementData(attacker, "bossparticipated", true)
       end
    end
end
addEventHandler ( "onClientPedDamage", getRootElement(), bossdamaged)

 

S Side ( the reward and loop )

function bossdeath ( )
if source == bossz then
   if isTimer(refreshtimer) then
   killTimer(refreshtimer) 
end
   triggerClientEvent(root, "removehp", root)
   triggerClientEvent(root, "stopmusic", root)
   for i,v in ipairs(getElementsByType("player")) do
      toggleControl(v, "jump", true)
      if getElementData(v, "bossparticipated") == true then 
      local amount = math.random(30000, 50000)
      local expamount = math.random(8000, 10000)
      givePlayerMoney(v, amount)
      exports["amlevelsystem"]:addPlayerXp(v, expamount);
      outputChatBox("+"..tonumber(amount).."$ +"..tonumber(expamount).." EXP", v, 0, 255, 0, true)
      setTimer(function()
      setElementData(v, "bossparticipated", false)
      end, 1000, 1)
   end
end

 

Edited by Bean666
Link to post

I don't think it should be possible or at least I don't see anything wrong in the code.

You can put some debug outputChatBox messages in the client side function and stay away from the boss while someone else fights with it and see if it detects you to damage the boss somehow.

It's not cool if the guy you test it with is joking. 😐
Ask him for a screenshot of the reward message.

BTW some optimization you can do: in the server side you have 2 triggerClientEvent calls. You can easily merge them to a one. For example "onBossEventEnd" whidh will include all the stuff from the 2 functions "removehp" and "stopmusic" into 1 function.

  • Like 1
Link to post
10 hours ago, SpecT said:

I don't think it should be possible or at least I don't see anything wrong in the code.

You can put some debug outputChatBox messages in the client side function and stay away from the boss while someone else fights with it and see if it detects you to damage the boss somehow.

It's not cool if the guy you test it with is joking. 😐
Ask him for a screenshot of the reward message.

BTW some optimization you can do: in the server side you have 2 triggerClientEvent calls. You can easily merge them to a one. For example "onBossEventEnd" whidh will include all the stuff from the 2 functions "removehp" and "stopmusic" into 1 function.

Client:
function onBossEventEnd()
removehp()
stopmusic() 
end 
addEvent("onBossEventEnd", true)
addEventHandler("onBossEventEnd", getRootElement(), onBossEventEnd) 

Server: 
triggerClientEvent(root, "onBossEventEnd", root)

something like this? 

Link to post
3 hours ago, Bean666 said:

Client:
function onBossEventEnd()
removehp()
stopmusic() 
end 
addEvent("onBossEventEnd", true)
addEventHandler("onBossEventEnd", getRootElement(), onBossEventEnd) 

Server: 
triggerClientEvent(root, "onBossEventEnd", root)

something like this? 

Yes, and also replace the "getRootElement()" with "root" as it's faster.

  • Like 1
Link to post
21 minutes ago, SpecT said:

Yes, and also replace the "getRootElement()" with "root" as it's faster.

oh okay thanks but what about if I want to show a "GUI" or "DX" to a certain player, is using getLocalPlayer() or localPlayer fine on the addEventHandler?

function showgui()
guiSetVisible(wear, true)
guiSetVisible(cancel, true)
guiSetAlpha(wear, 0)
guiSetAlpha(cancel, 0)
showCursor(true)
addEventHandler("onClientPreRender", getRootElement(), drawpurifier)
end
addEvent("showgui", true)
addEventHandler("showgui", getLocalPlayer(), showgui)

 

addEventHandler("onMarkerHit", resourceRoot, function(hitElement)
  if source == rmarker3 then
    if getElementType( hitElement ) == "player" then
      if getElementData(hitElement, "purifier") == "true" then outputChatBox("You are already a purifier", hitElement, 255, 0, 0) return end 
      triggerClientEvent(hitElement, "showgui", hitElement)
      end
   end 
end)

 

Edited by Bean666
Link to post
6 hours ago, Bean666 said:

oh okay thanks but what about if I want to show a "GUI" or "DX" to a certain player, is using getLocalPlayer() or localPlayer fine on the addEventHandler?


function showgui()
guiSetVisible(wear, true)
guiSetVisible(cancel, true)
guiSetAlpha(wear, 0)
guiSetAlpha(cancel, 0)
showCursor(true)
addEventHandler("onClientPreRender", getRootElement(), drawpurifier)
end
addEvent("showgui", true)
addEventHandler("showgui", getLocalPlayer(), showgui)

 


addEventHandler("onMarkerHit", resourceRoot, function(hitElement)
  if source == rmarker3 then
    if getElementType( hitElement ) == "player" then
      if getElementData(hitElement, "purifier") == "true" then outputChatBox("You are already a purifier", hitElement, 255, 0, 0) return end 
      triggerClientEvent(hitElement, "showgui", hitElement)
      end
   end 
end)

 

function showgui()
guiSetVisible(wear, true)
guiSetVisible(cancel, true)
guiSetAlpha(wear, 0)
guiSetAlpha(cancel, 0)
showCursor(true)
addEventHandler("onClientPreRender", root, drawpurifier)
end
addEvent("showgui", true)
addEventHandler("showgui", root, showgui)
 

addEventHandler("onMarkerHit", resourceRoot, function(hitElement)
  if source == rmarker3 then
    if getElementType( hitElement ) == "player" then
      if getElementData(hitElement, "purifier") == "true" then outputChatBox("You are already a purifier", hitElement, 255, 0, 0) return end 
      triggerClientEvent(hitElement, "showgui", hitElement)
      end
   end 
end)

Use the predefined variables instead function calls to get them. Like this it should work fine as you are triggering the client event only for the specific "hitElement" player.

Link to post
1 hour ago, SpecT said:

function showgui()
guiSetVisible(wear, true)
guiSetVisible(cancel, true)
guiSetAlpha(wear, 0)
guiSetAlpha(cancel, 0)
showCursor(true)
addEventHandler("onClientPreRender", root, drawpurifier)
end
addEvent("showgui", true)
addEventHandler("showgui", root, showgui)
 

addEventHandler("onMarkerHit", resourceRoot, function(hitElement)
  if source == rmarker3 then
    if getElementType( hitElement ) == "player" then
      if getElementData(hitElement, "purifier") == "true" then outputChatBox("You are already a purifier", hitElement, 255, 0, 0) return end 
      triggerClientEvent(hitElement, "showgui", hitElement)
      end
   end 
end)

Use the predefined variables instead function calls to get them. Like this it should work fine as you are triggering the client event only for the specific "hitElement" player.

oh so it wouldn't matter if i put root instead of getLocalPlayer() on the addEventHandler? 

Link to post

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...