Author Topic: Music Mod (Help Needed)  (Read 1404 times)

So I've decided to make a mod that when an admin says "/music", the WrenchSoundDlg Gui appears to change music.
I am a very new scripter and would like help to finish this
Code: [Select]
function serverCMDMusic(%client)
{
if(%client.isAdmin)
{
%client.wrenchBrick =$Music;

commandToClient(%client.'OpenWrenchSoundDlg'."Set Music");

announce(%client.name@"/c6 is changing the music.");
}
}
If somone could give me some pointers or help on this I would appreciate it  :cookieMonster:
« Last Edit: July 23, 2012, 12:01:29 AM by TrollBoat »

so that will open the gui on the client side that sets music, next you need to find the servercmd that is called when the client clicks send after selecting the music so you can package it to intercept the data you need.

I also suggest adding a timeout in case the client cancels, then like twenty minutes later sets music normally on a music brick, so that doesn't also trigger the server wide music
additionally, if you are simply forcing the wrench sound thing open, there will be no wrenchbrick, so line 5 is not needed I believe
« Last Edit: July 23, 2012, 12:45:04 AM by Nexus »

I also suggest adding a timeout in case the client cancels, then like twenty minutes later sets music normally on a music brick, so that doesn't also trigger the server wide music
additionally, if you are simply forcing the wrench sound thing open, there will be no wrenchbrick, so line 5 is not needed I believe

Line 5 is the reason you don't need a timeout. If your intercept function checks to make sure their wrenchBrick is set to the music variable then if they set the music on a different brick their wrenchBrick variable will change and it will no longer set music server wide.

Code: [Select]
function serverCMDMusic(%client)
{
if(%client.isAdmin)
{
%client.wrenchBrick =$Music;
commandToClient(%client.'OpenWrenchSoundDlg'."Set Music");
announce(%client.name@"/c6 is changing the music.");
}
}
If you noticed, you used .
You need to replace the . to ,

Result:

Code: [Select]
commandToClient(%client,'OpenWrenchSoundDlg',"Set Music");
Make sure to set the variable with the music brick ID (look at the brick and do /getID to get the brick ID)

I feel like I missed something...

Edit: You can set the Music variable ANY way you want.
« Last Edit: July 24, 2012, 09:59:02 AM by Cat123 »


Is this good?
Code: [Select]
function serverCMDMusic(%client)
{
if(%client.isAdmin)
{
%client.wrenchBrick =$Music;
commandToClient(%client,'OpenWrenchSoundDlg'[b].[/b]"Set Music");
announce(%client.name@"/c6 is changing the music.");
}
}
  $Music = BrickIDHERE

Is this good?
Code: [Select]
function serverCMDMusic(%client)
{
if(%client.isAdmin)
{
%client.wrenchBrick = $Music;
commandToClient(%client,'OpenWrenchSoundDlg',"Set Music");
announce(%client.name@"/c6 is changing the music.");
}
}

and, you need to set the $Music variable.
Look to the music brick, do /getID
then put that id in the $Music
$Music = Brick ID Here;

After that, you can just do /music and have fun

Yes, also fixed one line, take the script, test and tell me if it works.

Code: [Select]
function serverCMDMusic(%client)
{
if(%client.isAdmin)
{
%client.wrenchBrick = $Music;
commandToClient(%client,'OpenWrenchSoundDlg',"Set Music");
announce(%client.name@"/c6 is changing the music.");
}
}

and, you need to set the $Music variable.
Look to the music brick, do /getID
then put that id in the $Music
$Music = Brick ID Here;

After that, you can just do /music and have fun

Yes, also fixed one line, take the script, test and tell me if it works.
Why not just do it by the brick's name?

Hey smarts, you can't use bbcode in [code] tags

Hey smarts, you can't use bbcode in [code] tags
We know that, he didn't fixed another .


Code: [Select]
function serverCMDMusic(%client)
{
if(%client.isAdmin)
{
%client.wrenchBrick = $Music;
commandToClient(%client,'OpenWrenchSoundDlg',"Set Music");
announce(%client.name@"/c6 is changing the music.");
}
}
Wont the brick ID change every time you load it? Say if you had a grapple knife, and you loaded it. The brick ID would change, wouldn't it?

and, you need to set the $Music variable.
Look to the music brick, do /getID
then put that id in the $Music
$Music = Brick ID Here;

After that, you can just do /music and have fun

Yes, also fixed one line, take the script, test and tell me if it works.
Here's what i meant to put: Won't the brick ID change every time you load it? say if you load a grapple knife tdm, then you have to set the BrickID in the thing again
« Last Edit: August 07, 2012, 02:08:52 PM by NAT3 »


Yes? Is there a reason bumped this topic to quote someone who's already posted in this topic?

Yes? Is there a reason bumped this topic to quote someone who's already posted in this topic?
Ehh wtf i didnt want to do that at all

Oh, there's your question. Yes, the BrickID will change each time it is remade unless a sequence of events identical to each load happens prior, no extra players can join, no people can die, no f8s can be used, etc. Each event that creates a new object will increase it's ID by 1.

Oh, there's your question. Yes, the BrickID will change each time it is remade unless a sequence of events identical to each load happens prior, no extra players can join, no people can die, no f8s can be used, etc. Each event that creates a new object will increase it's ID by 1.
That's horse stuff.
You cannot prevent the bricks iD from changing on replant.






Atleast not so easily