Bean666 Posted January 31, 2015 Posted January 31, 2015 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) Aftermath
manawydan Posted January 31, 2015 Posted January 31, 2015 (edited) 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 January 31, 2015 by Guest "Querer não é poder, mas tentar é avançar"!
Bean666 Posted January 31, 2015 Author Posted January 31, 2015 still doesnt work it doesnt play sound Aftermath
manawydan Posted January 31, 2015 Posted January 31, 2015 so sound inside xml? and try change setSoundVolume(sound, 3.2) to setSoundVolume(sound, 1) (because max is 1), idk if work but try and talk for us "Querer não é poder, mas tentar é avançar"!
Bean666 Posted January 31, 2015 Author Posted January 31, 2015 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> Aftermath
xeon17 Posted January 31, 2015 Posted January 31, 2015 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) A unique GangWar gamemode waiting for you!Click here for more information.
TAPL Posted February 1, 2015 Posted February 1, 2015 (edited) Wrong meta, dff and txd not script scr. "Boss" description="nemesis" type="script" version="2.2" /> Edit: copy again. Edited February 1, 2015 by Guest
Bean666 Posted February 1, 2015 Author Posted February 1, 2015 still doesnt work , i have 3 errors here u go : Aftermath
xeon17 Posted February 1, 2015 Posted February 1, 2015 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 ')' ? A unique GangWar gamemode waiting for you!Click here for more information.
xeon17 Posted February 1, 2015 Posted February 1, 2015 But here are only 9 lines...? addEvent("nsound2",true) addEventHandler("nsound2", getRootElement(), function () sound = playSound("sons/music.mp3", false) if isElement(sound) then setSoundVolume(sound, 1.0) end end ) A unique GangWar gamemode waiting for you!Click here for more information.
Bean666 Posted February 1, 2015 Author Posted February 1, 2015 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) Aftermath
xeon17 Posted February 1, 2015 Posted February 1, 2015 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 end) A unique GangWar gamemode waiting for you!Click here for more information.
Bean666 Posted February 1, 2015 Author Posted February 1, 2015 By the way when i execute the command . the sound doesnt play for all players. Aftermath
xeon17 Posted February 1, 2015 Posted February 1, 2015 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) A unique GangWar gamemode waiting for you!Click here for more information.
Bean666 Posted February 1, 2015 Author Posted February 1, 2015 (edited) ??? 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 February 1, 2015 by Guest Aftermath
xeon17 Posted February 1, 2015 Posted February 1, 2015 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) A unique GangWar gamemode waiting for you!Click here for more information.
xeon17 Posted February 1, 2015 Posted February 1, 2015 Anything more? and please read the following page , it will help you to fix such errors like end expected to close function, expected symbol etcetc. https://wiki.multitheftauto.com/wiki/Debugging A unique GangWar gamemode waiting for you!Click here for more information.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now