About sound playing
#1

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.
Reply
#2

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.
Reply
#3

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.
Reply
#4

Other ideas?
Reply
#5

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!
Reply
#6

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.
Reply
#7

Other ideas?
Reply
#8

Come on, someone gotta know :S
Reply
#9

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


Forum Jump:


Users browsing this thread: 1 Guest(s)