Jump to content

What i did Wrong?


SnoopCat

Recommended Posts

Posted

hey hello i need a script to race when a player its ready to race play a sound to advice i need to know what i did wrong here plz if any 1 can help me..

function player_Spawn ( posX, posY, posZ, spawnRotation, theTeam, theSkin, theInterior, theDimension ) 
  
    local sound = playSound("1.wav") 
    setSoundVolume(sound, 0.5) 
end 
  
addEventHandler ( "onPlayerSpawn", getRootElement(), player_Spawn ) 

Posted
function player_Spawn ( hisTeam )-- Other event, other parameters... 
     local sound = playSound("1.wav",false) -- I suggest add "false", for prevent a loop. 
     setSoundVolume(sound, 0.5) 
end 
   
addEventHandler ( "onClientPlayerSpawn", getRootElement(), player_Spawn ) --"onClientPlayerSpawn", not "onPlayerSpawn". 
  

Well, easy. playSound is only-client-side function, so you can't use "onPlayerSpawn" event, you must use the client event.

Posted
function player_Spawn ( hisTeam )-- Other event, other parameters... 
     local sound = playSound("1.wav",false) -- I suggest add "false", for prevent a loop. 
     setSoundVolume(sound, 0.5) 
end 
   
addEventHandler ( "onClientPlayerSpawn", getRootElement(), player_Spawn ) --"onClientPlayerSpawn", not "onPlayerSpawn". 
  

Well, easy. playSound is only-client-side function, so you can't use "onPlayerSpawn" event, you must use the client event.

well isnt working :?:?:?

i mean how to do it sound when a player its ready to race ORR when a player join server i tried to do it but isnt working

Posted
function player_Spawn ( ) 
     local sound = playSound("1.wav",false)  
     setSoundVolume(sound, 2.0) 
end 
  
addEventHandler ( "onClientPlayerSpawn", getRootElement(), player_Spawn ) 
  

try this

Posted

its ok i do they work BUTTT i have a new problem.... if 2 players on server the sound plays 2 time if 3 then 3 times at same time when a player do spawn at map :S

and the thing i want its play them separately and u can only hear the sound when ur ready and NOT when others are ready too.

Posted (edited)
change:

getRootElement()

to

getLocalPlayer()

srry for Repost but i have to say thx to all ppl who help me make this possible since its my first script

thx To:

varez (i edited it cuz isnt Vares xD)

SolidSnake14

[DMC]

Edited by Guest
Posted
change:

getRootElement()

to

getLocalPlayer()

srry for Repost but i have to say thx to all ppl who help me make this possible since its my first script

thx To:

Vares

SolidSnake14

[DMC]

write varez nick as "varez" else he will get angry.

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

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