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 ) 

VISIT TSW RACING SERVER

http://tswracing.net/

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

VISIT TSW RACING SERVER

http://tswracing.net/

Posted

and did you set type="client" in meta.xml ?

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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

try this

logo_left.png
Posted

and did you add your wav to meta.xml?

aslo are you sure your file is named *.wav not *.WAV ?

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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.

VISIT TSW RACING SERVER

http://tswracing.net/

Posted

change:

getRootElement()

to

getLocalPlayer()

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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

VISIT TSW RACING SERVER

http://tswracing.net/

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.

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

Solid - i won't, this is just notice, because i dont like the look of first capital in this word.

Topic locked, because topic author created new one:

viewtopic.php?f=91&t=29273

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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

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