xTravax Posted August 3, 2013 Share Posted August 3, 2013 Hi I've made some script for fun by just copying the examples from wiki and text command script and this is how it looks like function startMySound() sound = playSound( "snw.mp3", true ) end addCommandHandler ( "snw", startMySound ) function makeTrain(commandname) outputChatBox ( "ALERT!", 255, 0, 0) outputChatBox ( "ALERT!", 255, 0, 0) outputChatBox ( "ALERT!", 255, 0, 0) outputChatBox ( "ALERT!", 255, 0, 0) outputChatBox ( "System has occurred an error", 255, 0, 0) outputChatBox ( "Starting Protocol 1541-56-a", 255, 100, 250) outputChatBox ( "Recovery in 30 secs...", 0, 255, 0) outputChatBox ( "Emergency Shut Down...", 255, 255, 255) outputChatBox ( "SERVER REBOOT IN in 30 secs...", 0, 255, 0) outputChatBox ( "HOLD OOOOOOOOOOON!", 0, 255, 0) end addCommandHandler("snw", makeTrain) the problem is if i use that /snw command only me will be able to hear that but i want that every player in server hears that sound i need that incase im rebooting the server to uinform people to come back when it removes because some people don't speak english but i believe that alarm sound would meant something to non english people. Link to comment
xXMADEXx Posted August 3, 2013 Share Posted August 3, 2013 You need to make it on the server side, then trigger to the client side to play the sound. Link to comment
xTravax Posted August 3, 2013 Author Share Posted August 3, 2013 and how to make that? i don't know to script i just copy and paste things from wiki Link to comment
EstrategiaGTA Posted August 3, 2013 Share Posted August 3, 2013 With: triggerServerEvent --or triggerClientEvent Link to comment
denny199 Posted August 3, 2013 Share Posted August 3, 2013 With: triggerServerEvent --or triggerClientEvent "triggerServerEvent" doesn't make any sence, he wants to play a sound for everyone, so triggerClientEvent is only needed. Link to comment
xTravax Posted August 3, 2013 Author Share Posted August 3, 2013 (edited) ummm i don't know to do this i tried visiting wiki to see more about that but i don't understand scripting so well and i made a big mistake because i simply don't know how should i make this work because i don't know to script and when i try to learn to script atleast for a bit i have to learn 6 lines on my mind and i dont know where does it teach me when can i use each event function or whatever so i can't learn it so here is my big mistake can someone please correct it for me because it's hard for me to learn scripting function startMySound() triggerClientEvent ( "onSound", getRootElement(), "playSound" ) sound = playSound( "snw.mp3", true ) end addCommandHandler ( "snw", startMySound ) function makeTrain(commandname) outputChatBox ( "ALERT!", 255, 0, 0) outputChatBox ( "ALERT!", 255, 0, 0) outputChatBox ( "ALERT!", 255, 0, 0) outputChatBox ( "ALERT!", 255, 0, 0) outputChatBox ( "System has occurred an error", 255, 0, 0) outputChatBox ( "Starting Protocol 1541-56-a", 255, 100, 250) outputChatBox ( "Recovery in 30 secs...", 0, 255, 0) outputChatBox ( "Emergency Shut Down...", 255, 255, 255) outputChatBox ( "SERVER REBOOT IN in 30 secs...", 0, 255, 0) outputChatBox ( "HOLD OOOOOOOOOOON!", 0, 255, 0) end addCommandHandler("snw", makeTrain) Edited August 3, 2013 by Guest Link to comment
denny199 Posted August 3, 2013 Share Posted August 3, 2013 Server side: addCommandHandler ( "snw", function() -- adding a command handler on the server side triggerClientEvent ( "onSound", root) -- triggering to client side for all players (root) with the eventname "onSound" end)-- and end ofc, with ) [for closing the function] Client side: addEvent ( "onSound", true ) -- adding the event addEventHandler ( "onSound", root, -- making the event handler function() -- the fuction sound = playSound( "snw.mp3", true ) -- the sound makeTrain() -- this will execute the makeTrain() function end) -- the end function makeTrain() -- your stuff outputChatBox ( "ALERT!", 255, 0, 0) outputChatBox ( "ALERT!", 255, 0, 0) outputChatBox ( "ALERT!", 255, 0, 0) outputChatBox ( "ALERT!", 255, 0, 0) outputChatBox ( "System is under Attack!", 255, 0, 0) outputChatBox ( "Starting Protocol 1541-56-a", 255, 100, 250) outputChatBox ( "Recovery in 30 secs...", 0, 255, 0) outputChatBox ( "Emergency Shut Down...", 255, 255, 255) outputChatBox ( "SERVER REBOOT IN in 30 secs...", 0, 255, 0) outputChatBox ( "HOLD OOOOOOOOOOON!", 0, 255, 0) end Link to comment
xTravax Posted August 3, 2013 Author Share Posted August 3, 2013 Thank you! Now it works Link to comment
denny199 Posted August 3, 2013 Share Posted August 3, 2013 No problem, feel free to ask more if you don't get out of your script codes. Link to comment
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