SA-MP Forums Archive
About sound playing - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: About sound playing (/showthread.php?tid=254351)



About sound playing - sim_sima - 10.05.2011

Hello guys.
How do i make random music playing on my server?
I did the following:
At the top of script:
pawn Код:
new RandomSound[][4] =
{
    {1097}, // Those are sound IDs
    {1183},
    {1185},
    {1187}
};
In "OnPlayerConnect":
pawn Код:
new rand = random(sizeof(RandomSound));
PlayerPlaySound(playerid, RandomSound[rand][3], 0.0, 0.0, 0.0);
But it doesn't work.

And by the way; How do i stop a playing sound?

Hope someone can help me. Thank you.


Re: About sound playing - Seven_of_Nine - 10.05.2011

pawn Код:
new RandomSound[] = {
    {1097},
    {1183},
    {1185},
    {1187} // You can contiune till the end of the world. xD
};
//OnPlayerConnect
new random = random(sizeof(RandomSound));
PlayerPlaySound(playerid, RandomSound[random], 0, 0 , 0);
Untested.


Re: About sound playing - sim_sima - 10.05.2011

Quote:
Originally Posted by Seven_of_Nine
Посмотреть сообщение
pawn Код:
new RandomSound[] = {
    {1097},
    {1183},
    {1185},
    {1187} // You can contiune till the end of the world. xD
};
//OnPlayerConnect
new random = random(sizeof(RandomSound));
PlayerPlaySound(playerid, RandomSound[random], 0, 0 , 0);
Untested.
Код:
C:\Users\Simon\Desktop\samp server rpg\gamemodes\rpg-gm.pwn(265) : warning 219: local variable "random" shadows a variable at a preceding level
C:\Users\Simon\Desktop\samp server rpg\gamemodes\rpg-gm.pwn(265) : error 012: invalid function call, not a valid address
C:\Users\Simon\Desktop\samp server rpg\gamemodes\rpg-gm.pwn(265) : error 001: expected token: ";", but found "sizeof"
C:\Users\Simon\Desktop\samp server rpg\gamemodes\rpg-gm.pwn(265) : warning 215: expression has no effect
C:\Users\Simon\Desktop\samp server rpg\gamemodes\rpg-gm.pwn(265) : error 001: expected token: ";", but found ")"
C:\Users\Simon\Desktop\samp server rpg\gamemodes\rpg-gm.pwn(265) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: About sound playing - sim_sima - 10.05.2011

Other ideas?


Re: About sound playing - Seven_of_Nine - 10.05.2011

pawn Код:
new RandomSound[] = {
    1097,
    1183,
    1185,
    1187 // You can contiune till the end of the world. xD
};
//OnPlayerConnect
new rand = random(sizeof(RandomSound));
PlayerPlaySound(playerid, RandomSound[rand], 0, 0 , 0);
Fixed teh integers, and random = random? that is so trolled!


Re: About sound playing - sim_sima - 10.05.2011

Quote:
Originally Posted by Seven_of_Nine
Посмотреть сообщение
pawn Код:
new RandomSound[] = {
    1097,
    1183,
    1185,
    1187 // You can contiune till the end of the world. xD
};
//OnPlayerConnect
new rand = random(sizeof(RandomSound));
PlayerPlaySound(playerid, RandomSound[rand], 0, 0 , 0);
Fixed teh integers, and random = random? that is so trolled!
Код:
C:\Users\Simon\Desktop\samp server rpg\gamemodes\rpg-gm.pwn(266) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: About sound playing - sim_sima - 10.05.2011

Other ideas?


Re: About sound playing - sim_sima - 10.05.2011

Come on, someone gotta know :S


Re: About sound playing - sim_sima - 10.05.2011

Forget, i fixed it. Thank you so much, Seven_of_nine