Jump to content

Doesn't play sound?


Bean666

Recommended Posts

hi guys i need help. i added an event in the client that plays sound . and in server when zombie boss spawns , it triggers the clientevent so it will play the sound . is there any problem with this? sounds doesnt play...

client:

addEvent("nsound2",true) 
addEventHandler("nsound2", getRootElement(), 
function () 
sound = playSound("sons/music.mp3", false) 
setSoundVolume(sound, 3.2) 
end 
) 

server:

function Nemesisbymanawydan6 ( thePlayer)   
local AclNome6 = getAccountName ( getPlayerAccount ( thePlayer ) )  
     if isObjectInACLGroup ("user."..AclNome6, aclGetGroup ( "Admin" ) ) then  
       nemesi6 = exports [ "slothBot" ]:spawnBot ( 2598.2099609375, 1807.3173828125, 11.398876190186, 90,  math.random ( 300, 303 ), 0, 0, Nemesis6, 0,         "hunting", true ) 
      setElementModel ( nemesi6, 162 ) 
      outputChatBox ("ProjectZ has been spawned! Location: Pilgrim! One of the strongest Boss!",getRootElement(), 255, 0, 0, true ) 
BlipNemesis6 = createBlipAttachedTo ( nemesi6, 23 ) 
      attachElements ( baz, nemesi6, 0.2, 0.1, 0.5, 0, 90, 0 ) 
      setElementData(nemesi6, "nemesis6",true) 
      triggerClientEvent(source, "nsound2", source) 
if nemesi6 then 
 exports.extra_health:setElementExtraHealth ( nemesi6, 10000 ) 
         end 
      end 
end 
addCommandHandler("boss6",  Nemesisbymanawydan6)   
  

Link to comment

edit: thanks TAPL

try this:

function Nemesisbymanawydan6 ( thePlayer)   
local AclNome6 = getAccountName ( getPlayerAccount ( thePlayer ) ) 
     if isObjectInACLGroup ("user."..AclNome6, aclGetGroup ( "Admin" ) ) then 
       nemesi6 = exports [ "slothBot" ]:spawnBot ( 2598.2099609375, 1807.3173828125, 11.398876190186, 90,  math.random ( 300, 303 ), 0, 0, Nemesis6, 0,         "hunting", true ) 
      setElementModel ( nemesi6, 162 ) 
      outputChatBox ("ProjectZ has been spawned! Location: Pilgrim! One of the strongest Boss!",getRootElement(), 255, 0, 0, true ) 
BlipNemesis6 = createBlipAttachedTo ( nemesi6, 23 ) 
      attachElements ( baz, nemesi6, 0.2, 0.1, 0.5, 0, 90, 0 ) 
      setElementData(nemesi6, "nemesis6",true) 
      triggerClientEvent(root, "nsound2", thePlayer) 
if nemesi6 then 
 exports.extra_health:setElementExtraHealth ( nemesi6, 10000 ) 
         end 
      end 
end 
addCommandHandler("boss6",  Nemesisbymanawydan6)   

Edited by Guest
Link to comment

Here's my meta xml

i changed setvolume to 1 and stil ldoesnt work

<meta> 
                      <info author="Boss" description="nemesis" type="script" version="2.2" />  
                       <script src="nemesi1.lua" type="server" />   
                       <script src="client.lua" type="client" />      
                       <script src="data/nemesis.mp3" type="client" /> 
                       <file src="sons/music.mp3" />   
                       <script src="data/107.txd" type="client" />   
                       <script src="data/107.dff" type="client" />  
                       <include resource="extra_health" /> 
                       <include resource="slothbot" />  
</meta> 

Link to comment

Client;

addEvent("nsound2",true) 
addEventHandler("nsound2", getRootElement(), 
function () 
sound = playSound("sons/music.mp3", false) 
if isElement(sound) then 
setSoundVolume(sound, 1.0) 
end 
end 
) 

Server;

function Nemesisbymanawydan6 ( thePlayer)   
local AclNome6 = getAccountName ( getPlayerAccount ( thePlayer ) ) 
     if isObjectInACLGroup ("user."..AclNome6, aclGetGroup ( "Admin" ) ) then 
       nemesi6 = exports [ "slothBot" ]:spawnBot ( 2598.2099609375, 1807.3173828125, 11.398876190186, 90,  math.random ( 300, 303 ), 0, 0, Nemesis6, 0,         "hunting", true ) 
      setElementModel ( nemesi6, 162 ) 
      outputChatBox ("ProjectZ has been spawned! Location: Pilgrim! One of the strongest Boss!",getRootElement(), 255, 0, 0, true ) 
BlipNemesis6 = createBlipAttachedTo ( nemesi6, 23 ) 
      attachElements ( baz, nemesi6, 0.2, 0.1, 0.5, 0, 90, 0 ) 
      setElementData(nemesi6, "nemesis6",true) 
      triggerClientEvent(thePlayer, "nsound2", getRootElement()) 
if nemesi6 then 
 exports.extra_health:setElementExtraHealth ( nemesi6, 10000 ) 
         end 
      end 
end 
addCommandHandler("boss6",  Nemesisbymanawydan6)   
  

Link to comment

Try this,

    "Boss" description="nemesis" type="script" version="2.2" /> 
    "sons/music.mp3" />   
    

Server;

function Nemesisbymanawydan6 ( thePlayer)   
local AclNome6 = getAccountName ( getPlayerAccount ( thePlayer ) ) 
     if isObjectInACLGroup ("user."..AclNome6, aclGetGroup ( "Admin" ) ) then 
       nemesi6 = exports [ "slothBot" ]:spawnBot ( 2598.2099609375, 1807.3173828125, 11.398876190186, 90,  math.random ( 300, 303 ), 0, 0, Nemesis6, 0,         "hunting", true ) 
      setElementModel ( nemesi6, 162 ) 
      outputChatBox ("ProjectZ has been spawned! Location: Pilgrim! One of the strongest Boss!",getRootElement(), 255, 0, 0, true ) 
BlipNemesis6 = createBlipAttachedTo ( nemesi6, 23 ) 
      attachElements ( baz, nemesi6, 0.2, 0.1, 0.5, 0, 90, 0 ) 
      setElementData(nemesi6, "nemesis6",true) 
      triggerClientEvent(thePlayer, "nsound2", getRootElement()) 
if nemesi6 then 
 exports.extra_health:setElementExtraHealth ( nemesi6, 10000 ) 
         end 
      end 
end 
addCommandHandler("boss6",  Nemesisbymanawydan6)   
  

btw , which line is this error unxpected symbol near ')' ?

Link to comment

unexpected symbol near ')'

in line 31 , and is end)

addEventHandler("onClientPedDamage",root, 
function(ata,wea,bod,los) 
if (ata and getElementType(ata) == "player") then 
 if (getElementData(source,"nemesis") == true) then 
if (los >=5) then 
los = los-los+1 
end 
 end 
 end) 

Link to comment
function Nemesisbymanawydan6 ( thePlayer)   
local AclNome6 = getAccountName ( getPlayerAccount ( thePlayer ) ) 
     if isObjectInACLGroup ("user."..AclNome6, aclGetGroup ( "Admin" ) ) then 
       nemesi6 = exports [ "slothBot" ]:spawnBot ( 2598.2099609375, 1807.3173828125, 11.398876190186, 90,  math.random ( 300, 303 ), 0, 0, Nemesis6, 0,         "hunting", true ) 
      setElementModel ( nemesi6, 162 ) 
      outputChatBox ("ProjectZ has been spawned! Location: Pilgrim! One of the strongest Boss!",getRootElement(), 255, 0, 0, true ) 
BlipNemesis6 = createBlipAttachedTo ( nemesi6, 23 ) 
      attachElements ( baz, nemesi6, 0.2, 0.1, 0.5, 0, 90, 0 ) 
      setElementData(nemesi6, "nemesis6",true) 
if nemesi6 then 
 exports.extra_health:setElementExtraHealth ( nemesi6, 10000 ) 
        for _, player in ipairs(getElementsByType("player")) do 
      triggerClientEvent(player, "nsound2", player) 
         end 
      end 
end 
addCommandHandler("boss6",  Nemesisbymanawydan6)   
  

Link to comment

jFkXnak.png

???

Line 140 is the function

Line 168 is the last

function Nemesisbymanawydan6 ( thePlayer)   
local AclNome6 = getAccountName ( getPlayerAccount ( thePlayer ) ) 
     if isObjectInACLGroup ("user."..AclNome6, aclGetGroup ( "Admin" ) ) then 
       nemesi6 = exports [ "slothBot" ]:spawnBot ( 2598.2099609375, 1807.3173828125, 11.398876190186, 90,  math.random ( 300, 303 ), 0, 0, Nemesis6, 0,         "hunting", true ) 
      setElementModel ( nemesi6, 162 ) 
      outputChatBox ("ProjectZ has been spawned! Location: Pilgrim! One of the strongest Boss!",getRootElement(), 255, 0, 0, true ) 
BlipNemesis6 = createBlipAttachedTo ( nemesi6, 23 ) 
      attachElements ( baz, nemesi6, 0.2, 0.1, 0.5, 0, 90, 0 ) 
      setElementData(nemesi6, "nemesis6",true) 
      triggerClientEvent(thePlayer, "nsound2", getRootElement()) 
if nemesi6 then 
 exports.extra_health:setElementExtraHealth ( nemesi6, 10000 ) 
         end 
      end 
end 
addCommandHandler("boss6",  Nemesisbymanawydan6)     
  
addEvent("onBotWasted",true) 
addEventHandler("onBotWasted",getRootElement(), 
function (killer) 
if (source == nemesi6) then 
givePlayerMoney(killer,1000000)  
outputChatBox ( getPlayerName ( killer ) .. " #ff0000killed Project Z and gained 1000000$",getRootElement(), 0, 255, 0, true ) 
 exports.exp_system:addPlayerEXP ( killer, 600 )  
destroyElement(BlipNemesis6) 
end 
end) 
  

Edited by Guest
Link to comment
function Nemesisbymanawydan6 ( thePlayer)   
local AclNome6 = getAccountName ( getPlayerAccount ( thePlayer ) ) 
     if isObjectInACLGroup ("user."..AclNome6, aclGetGroup ( "Admin" ) ) then 
       nemesi6 = exports [ "slothBot" ]:spawnBot ( 2598.2099609375, 1807.3173828125, 11.398876190186, 90,  math.random ( 300, 303 ), 0, 0, Nemesis6, 0,         "hunting", true ) 
      setElementModel ( nemesi6, 162 ) 
      outputChatBox ("ProjectZ has been spawned! Location: Pilgrim! One of the strongest Boss!",getRootElement(), 255, 0, 0, true ) 
BlipNemesis6 = createBlipAttachedTo ( nemesi6, 23 ) 
      attachElements ( baz, nemesi6, 0.2, 0.1, 0.5, 0, 90, 0 ) 
      setElementData(nemesi6, "nemesis6",true) 
if nemesi6 then 
 exports.extra_health:setElementExtraHealth ( nemesi6, 10000 ) 
        for _, player in ipairs(getElementsByType("player")) do 
      triggerClientEvent(player, "nsound2", player) 
         end 
      end 
  end 
end 
addCommandHandler("boss6",  Nemesisbymanawydan6)   
  

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