![]() |
|
09-22-2012
|
1 |
|
Circus
Join Date: Sep 2011
Location: London
Posts: 2,090
|
A little script help...again
Hello I'm working on a little project which involves a lot of scripting and such based on two commands like "on" and "off" or "stop" and "talk". I recently needed help with a parrot script which I have now done completely thanks to 0PiX0, but now I need even more help from other coders. I am using a radio code to play music in a house, which is sorted, however I want to be able to turn the radio on and off by saying "on" or "off", which I do not know how to do. It will be much appreciated if someone can show the code to me and help me understand, here is what I tried doing based on the parrot "talk" and "stop" coding :function onCreated() { this.enabled = true; } function onPlayerChats() { if (player.chat == "on") { this.enabled = true; } elseif (player.chat == "off") { this.enabled = false; } elseif (this.enabled) { playlooped http://www.gaycove.com/downloads/i%2...0hd%20bep.mp3; } dont ask about the gaycove thing...my boss found it |
|
09-22-2012
|
2 |
|
Circus
Join Date: Sep 2011
Location: London
Posts: 2,090
|
bump
|
|
09-22-2012
|
3 |
|
The muffin man
Join Date: Sep 2011
Location: Burger Refuge
Posts: 2,262
|
Your problem is your conditional. PHP Code:
If (player.chat == "on") turn on else if (player.chat == "off") turn off else if (the script's on) play the music. So your script should be something like this. PHP Code:
|
|
09-22-2012
|
4 | |
|
Circus
Join Date: Sep 2011
Location: London
Posts: 2,090
|
|
|
|
09-22-2012
|
5 |
|
Registered User
Join Date: Sep 2011
Location: Germany
Posts: 6,122
|
creative corner please, thanks. this isnt related to iera at all
|
|
09-22-2012
|
6 |
|
Circus
Join Date: Sep 2011
Location: London
Posts: 2,090
|
|
|
09-22-2012
|
7 |
|
just a noob
Join Date: Apr 2012
Location: Everywhere
Posts: 1,513
|
|
|
09-22-2012
|
8 |
|
Circus
Join Date: Sep 2011
Location: London
Posts: 2,090
|
|
|
09-22-2012
|
9 | |
|
Registered User
Join Date: Aug 2011
Location: En La Caja
Posts: 1,679
|
PHP Code:
|
|
|
09-22-2012
|
10 |
|
299,792,458 m/s
Join Date: Mar 2012
Location: Lebanon
Posts: 3,581
|
I'm not sure about my version, but I like to keep reading it in a way : PHP Code:
|
|
09-22-2012
|
11 | |
|
Circus
Join Date: Sep 2011
Location: London
Posts: 2,090
|
everything works on here except for the "off" command :O
|
|
|
09-22-2012
|
12 |
|
Registered User
Join Date: Aug 2011
Location: En La Caja
Posts: 1,679
|
|
|
09-22-2012
|
13 |
|
Circus
Join Date: Sep 2011
Location: London
Posts: 2,090
|
|
|
09-22-2012
|
14 |
|
Circus
Join Date: Sep 2011
Location: London
Posts: 2,090
|
Bump....again
|
|
09-22-2012
|
15 |
|
299,792,458 m/s
Join Date: Mar 2012
Location: Lebanon
Posts: 3,581
|
I'm not sure it there is a way to stop the music, but let's try playlooped(""); PHP Code:
|