PDA

View Full Version : Sound when the player connect and log in to server script.



klendi11
13th August 2016, 01:14
Hi guys

Can anyone tell me the way or the script that play a sound when the player log in.
like : "Welcome to X mod" when the player log in.
If anyone help or give his thoughts that would be great !!!

thOuMta
13th August 2016, 09:57
Callback_PlayerConnect()
{
level notify("connected", self);

if(!level.splitscreen)
iprintln(&"MP_CONNECTED", self.name);

self iprintlnbold("Welcome to X mod"); //put your message here
wait(0.5);
self playlocalsound("YOUR_WELCOME_SOUND"); //put your sound here
}


I just remember this thing but i didnt tested it, so i dont know if is working :)

IzNoGoD
13th August 2016, 13:21
dont put waits in there. Make it a thread instead.

Wesleyw3zep
27th November 2016, 01:01
Callback_PlayerConnect()
{
level notify("connected", self);

if(!level.splitscreen)
iprintln(&"MP_CONNECTED", self.name);

self iprintlnbold("Welcome to X mod"); //put your message here
wait(0.5);
self playlocalsound("YOUR_WELCOME_SOUND"); //put your sound here
}


I just remember this thing but i didnt tested it, so i dont know if is working :)



Callback_PlayerConnect()
{
thread dummy();

self.statusicon = "hud_status_connecting";
self waittill("begin");
self.statusicon = "";

level notify("connected", self);

if(!level.splitscreen)
iprintln(&"MP_CONNECTED", self.name);

self iprintlnbold("^3Welcome to unionsqd-gaming "); //put your message here
self playlocalsound("us_welcome.mp3"); //put your sound here

//PAM TEMP!
self.pers["dvarenforcement"] = 1;

//self setclientcvar("hud_enable", 1);

Wesleyw3zep
18th March 2017, 06:14
well i did this,

Callback_PlayerConnect()
{
thread dummy();

self.statusicon = "hud_status_connecting";
self waittill("begin");
self.statusicon = "";

level notify("connected", self);
if(!level.splitscreen)
iprintln(&"MP_CONNECTED", self.name);

self iprintlnbold("^5w^6w^7w^3.^1unionsqd-gaming^3.^7c^6o^5m"); //put your message here
self playlocalsound("us_welcome.mp3"); //put your sound here
//self setclientcvar("hud_enable", 1);

if(!isdefined(self.pers["team"]) && !level.splitscreen)
iprintln(&"MP_CONNECTED", self.name);

lpselfnum = self getEntityNumber();
lpselfguid = self getGuid();
logPrint("J;" + lpselfguid + ";" + lpselfnum + ";" + self.name + "\n");


but i hear no sound only see the text

Lonsofore
18th March 2017, 07:36
self playlocalsound("us_welcome.mp3"); //put your sound here
Here is your mistake - you should use soundaliases (.csv) files for sounds. You can find an example in iw_06.iwd. So, make your own .csv file in "soundaliases" folder, add there your sounds and then use them in your code with given name.

Wesleyw3zep
19th March 2017, 00:47
Here is your mistake - you should use soundaliases (.csv) files for sounds. You can find an example in iw_06.iwd. So, make your own .csv file in "soundaliases" folder, add there your sounds and then use them in your code with given name.

ok so in the map sound i made a map called ''Gomsound'' inside that map are the 2 mp3's called ''playercon & playerdiscon.mp3

#Gomannouncer,,,,,,,,,,,,
gomplayersleft,,,gomsound/playerdiscon.mp3,1,1,,,,1000000,,auto,streamed
gomplayersjoined,,,gomsound/playercon.mp3,1,1,,,,1000000,,auto,streamed

does not work :(

voron00
19th March 2017, 05:02
auto is a 3d channel, it cannot be used to play a local sound, use something like (but make sure it matches your soundalias columns):

gomplayersleft,,gomsound/playerdiscon.mp3,,,,,,,,local,streamed,,,,all_mp,, ,,,,local

Wesleyw3zep
19th March 2017, 08:04
auto is a 3d channel, it cannot be used to play a local sound, use something like (but make sure it matches your soundalias columns):

gomplayersleft,,gomsound/playerdiscon.mp3,,,,,,,,local,streamed,,,,all_mp,, ,,,,local

so like this ??
name,sequence,probability,file,vol_min,vol_max,vol _mod,pitch_min,pitch_max,dist_min,dist_max,channel ,type,loop,masterslave,loadspec,subtitle,compressi on,secondaryaliasname,volumefalloffcurve,startdela y,speakermap,reverb,lfe percentage

hill400_assault_gr5_letsgoget,,,Voiceovers/US/400Assault/hill400assault_gr5_sc03_01_t1.wav,1,1,,,,1000000,, auto,streamed
soviet_victory_light01,,,music/downtownsniper_victory_GRFINAL.mp3,1,1,,,,1000000, ,auto,streamed
ridge88_main_music,,,music/88ridge_approaching_ridge2_GRFINAL.mp3,1,1,,,,1000 000,,auto,streamed
gomplayersleft,,gomsound/playerdiscon.mp3,,,,,,,,local,streamed,,,,all_mp,, ,,,,local

voron00
19th March 2017, 08:53
Your colums is different than in stock iw_multiplayer.csv so adding that just like that won't work.

Stock colums are:
name,sequence,file,vol_min,vol_max,vol_mod,pitch_m in,pitch_max,dist_min,dist_max,channel,type,probab ility,loop,masterslave,loadspec,subtitle,compressi on,secondaryaliasname,volumefalloffcurve,startdela y,speakermap,reverb,lfe percentage

And your colums are:
name,sequence,probability,file,vol_min,vol_max,vol _mod,pitch_min,pitch_max,dist_min,dist_max,channel ,type,loop,masterslave,loadspec,subtitle,compressi on,secondaryaliasname,volumefalloffcurve,startdela y,speakermap,reverb,lfe percentage

So, the alias for your colums should be:
gomplayersleft,,,gomsound/playerdiscon.mp3,,,,,,,local,streamed,,,,all_mp,,, ,,,local

Wesleyw3zep
20th March 2017, 04:20
oke i understand so if i paste this code


gomplayersleft,,,gomsound/playerdiscon.mp3,,,,,,,local,streamed,,,,all_mp,,, ,,,local

in iw_multiplayer.csv it will be ok?

and where can i paste that @ the begin of the csv o

voron00
20th March 2017, 07:49
No, if you want to use iw_multiplayer.csv, you should use:

gomplayersleft,,gomsound/playerdiscon.mp3,,,,,,,,local,streamed,,,,all_mp,, ,,,,local

And if you want to use it with your soundalias file with the columns you posted (https://killtube.org/showthread.php?2705-Sound-when-the-player-connect-and-log-in-to-server-script&p=15989&viewfull=1#post15991)you should use:

gomplayersleft,,,gomsound/playerdiscon.mp3,,,,,,,local,streamed,,,,all_mp,,, ,,,local

Wesleyw3zep
26th March 2017, 22:58
ok ok Thank you!

i will try this now. ( just to get you a idea do u know the extreme mod @ cod2) ? thats the thing what i want when someone joins and leaves the server you will hear that sound everybody will hear that sound. you know what i mean?

guiismiti
26th March 2017, 23:08
In the game type script (tdm.gsc, dm.gsc, sd.gsc, ...), use playSoundOnPlayers(sound, team) on Callback_PlayerConnect() and Callback_PlayerDisconnect()

Wesleyw3zep
26th March 2017, 23:23
In the game type script (tdm.gsc, dm.gsc, sd.gsc, ...), use playSoundOnPlayers(sound, team) on Callback_PlayerConnect() and Callback_PlayerDisconnect()

well this is my player_connect


Callback_PlayerConnect()
{
thread dummy();

self.statusicon = "hud_status_connecting";
self waittill("begin");
self.statusicon = "";

level notify("connected", self);
self iprintlnbold("You are connected to unionsqd-gaming public SD"); //put your message here
self playlocalsound("playercon.mp3"); //put your sound here
if(!isdefined(self.pers["team"]) && !level.splitscreen)
iprintln(&"MP_CONNECTED", self.name);
self playlocalsound("playercon.mp3"); //put your sound here
lpselfnum = self getEntityNumber();
lpselfguid = self getGuid();
logPrint("J;" + lpselfguid + ";" + lpselfnum + ";" + self.name + "\n");

if(game["state"] == "intermission")
{
spawnIntermission();
return;
}

level endon("intermission");

// WORM
self thread maps\mp\gametypes\_wormsmod::Worms_Mod_PlayerConne ct_Init();

and this is my callback_playerdisconnect


Callback_PlayerDisconnect()
{
if(!level.splitscreen)
iprintln(&"MP_DISCONNECTED", self);
self playlocalsound("playerdiscon.mp3"); //put your sound here
if(isdefined(self.pers["team"]))
{
if(self.pers["team"] == "allies")
setplayerteamrank(self, 0, 0);
else if(self.pers["team"] == "axis")
setplayerteamrank(self, 1, 0);
else if(self.pers["team"] == "spectator")
setplayerteamrank(self, 2, 0);
}

lpselfnum = self getEntityNumber();
lpselfguid = self getGuid();
logPrint("Q;" + lpselfguid + ";" + lpselfnum + ";" + self.name + "\n");

if(game["matchstarted"])
level thread updateTeamStatus();

guiismiti
27th March 2017, 03:58
read what I posted and try doing it as I said

Wesleyw3zep
30th March 2017, 00:48
Like this?


Callback_PlayerConnect()
{
thread dummy();

self.statusicon = "hud_status_connecting";
self waittill("begin");
self.statusicon = "";

level notify("connected", self);
self iprintlnbold("You are connected to unionsqd-gaming public SD"); //put your message here
playSoundOnPlayers(sound, team)("playercon.mp3"); //put your sound here
if(!isdefined(self.pers["team"]) && !level.splitscreen)
iprintln(&"MP_CONNECTED", self.name);
self playlocalsound("playercon.mp3"); //put your sound here
lpselfnum = self getEntityNumber();
lpselfguid = self getGuid();
logPrint("J;" + lpselfguid + ";" + lpselfnum + ";" + self.name + "\n");

if(game["state"] == "intermission")
{
spawnIntermission();
return;
}

level endon("intermission");

// WORM
self thread maps\mp\gametypes\_wormsmod::Worms_Mod_PlayerConne ct_Init();


Callback_PlayerDisconnect()
{
if(!level.splitscreen)
iprintln(&"MP_DISCONNECTED", self);
self playlocalsound("playerdiscon.mp3"); //put your sound here
if(isdefined(self.pers["team"]))
{
if(self.pers["team"] == "allies")
setplayerteamrank(self, 0, 0);
else if(self.pers["team"] == "axis")
setplayerteamrank(self, 1, 0);
else if(self.pers["team"] == "spectator")
setplayerteamrank(self, 2, 0);
}

lpselfnum = self getEntityNumber();
lpselfguid = self getGuid();
logPrint("Q;" + lpselfguid + ";" + lpselfnum + ";" + self.name + "\n");

if(game["matchstarted"])
level thread updateTeamStatus();

guiismiti
30th March 2017, 01:00
Instead of


playSoundOnPlayers(sound, team)("playercon.mp3");

use


playSoundOnPlayers("playercon.mp3", team);

and delete this:


self playlocalsound("playercon.mp3");


But also, you need to add your sound to a soundaliases table and use the alias instead of the file name.

It will help you if you get a mod and check how it is done.

Wesleyw3zep
2nd April 2017, 20:13
So what you say to me is that i cant use the.multiplayer soundaliases? Pff this is harder than i thought

Ni3ls
2nd April 2017, 21:28
Ofcourse you can use that one. But you need to use that syntax. Just copy a line that plays a sound to all players and edit it

Wesleyw3zep
2nd April 2017, 23:04
Ofcourse you can use that one. But you need to use that syntax. Just copy a line that plays a sound to all players and edit it

well i have this


#Misc,,,,,,,,,,,,,,,,,,,,,
beep,1,misc/beep.wav,,,,,,,,,,,,,all_mp,,,,,,
gomplayersleft,,gomsound/playerdiscon.mp3,,,,,,,,local,streamed,,,,all_mp,, ,,,,local
gomplayersjoined,,gomsound/playercon.mp3,,,,,,,,local,streamed,,,,all_mp,,,,, ,local playercon.mp3 in my ''iw_multiplayer2_csv

IzNoGoD
2nd April 2017, 23:13
That does not show anything. That's like saying your car has 2 doors and 4 tires, but not telling where they're connected to the car.