Jump to content

Not Work This


#Whit3^

Recommended Posts

Posted

Hello

Basically I want that when the last person dies (race mode) sound is heard at random.

I used this to make sure that when you hear those sounds change map but that does not work .. sorry for this english .. :roll:

local sounds = { 
"modes/win.mp3", 
"modes/win2.mp3", 
"modes/win3.mp3", 
"modes/win4.mp3", 
"modes/win5.mp3"} 
  
function zaa() 
    playSound ( sounds [ math.random ( 1, #sounds ) ] ) 
end 
addEventHandler ( "onClientMapStarting", getRootElement(), zaa) 

Posted
local sounds = { 
[1] = {"modes/win.mp3"}, 
[2] = {"modes/win2.mp3"}, 
[3] = {"modes/win3.mp3"}, 
[4] = {"modes/win4.mp3"}, 
[5] = {"modes/win5.mp3"}, 
} 
  
function zaa() 
    local sound = unpack(sounds[math.random(1,5)]) 
    local sounda = playSound (sound) 
    setSoundVolume(sounda, 0.5) 
end 
addEventHandler ( "onClientMapStarting", getRootElement(), zaa) 

Omerta Roleplay

Posted
Hello

Basically I want that when the last person dies (race mode) sound is heard at random.

I used this to make sure that when you hear those sounds change map but that does not work .. sorry for this english .. :roll:

local sounds = { 
"modes/win.mp3", 
"modes/win2.mp3", 
"modes/win3.mp3", 
"modes/win4.mp3", 
"modes/win5.mp3"} 
  
function zaa() 
    playSound ( sounds [ math.random ( 1, #sounds ) ] ) 
end 
addEventHandler ( "onClientMapStarting", getRootElement(), zaa) 

I'm pretty sure you need to add that event, it isn't a global one.

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

Posted

You need to add the event "onClientMapStarting", it is an event from race gamemode, not a global one.

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

Posted

Post the meta.xml.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
i have already tryed

Show what you tried.

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

Posted

now it work with this

sry for all problem

local sounds = { 
[1] = {"modes/win.mp3"}, 
[2] = {"modes/win2.mp3"}, 
[3] = {"modes/win3.mp3"}, 
[4] = {"modes/win4.mp3"}, 
[5] = {"modes/win5.mp3"}, 
} 
  
function zaa() 
    local sound = unpack(sounds[math.random(1,5)]) 
    local sounda = playSound (sound) 
    setSoundVolume(sounda, 0.5) 
end 
addEventHandler ( 'onClientMapStarting', root, zaa) 

Posted

Your first script should work.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Your first script should work.

No.

You need to add:

addEvent ( "onClientMapStarting", true )

Above:

addEventHandler ( 'onClientMapStarting', root, zaa)

Every event that isn't a default MTA event must be added using addEvent.

"The total IQ of the world is a constant.

The more people, the more idiots."

- Anonymous.

Posted
now it work with this

sry for all problem

local sounds = { 
[1] = {"modes/win.mp3"}, 
[2] = {"modes/win2.mp3"}, 
[3] = {"modes/win3.mp3"}, 
[4] = {"modes/win4.mp3"}, 
[5] = {"modes/win5.mp3"}, 
} 
  
function zaa() 
    local sound = unpack(sounds[math.random(1,5)]) 
    local sounda = playSound (sound) 
    setSoundVolume(sounda, 0.5) 
end 
addEventHandler ( 'onClientMapStarting', root, zaa) 

You didn't add what I said, and it won't work with only that code.

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

Posted
Your first script should work.

No.

You need to add:

addEvent ( "onClientMapStarting", true )

Above:

addEventHandler ( 'onClientMapStarting', root, zaa)

Every event that isn't a default MTA event must be added using addEvent.

I used this same event handler WITHOUT addEvent for a map info script.

Topic locked.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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