public OnPlayerConnect(playerid)
{
for (new i = 0; i < 4; i ++)
{
DriveThruItems[playerid][i] = 0;
}
if(Security != 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "Host has broken one of the Agreement rules, action has been taken.");
Kick(playerid);
return 1;
}
gPlayerLoggin{playerid} = 1;
TextDrawShowForPlayer(playerid, Website);
gPlayerAnimLibsPreloaded[playerid] = 0;
gActivePlayers[playerid]++;
ShowArea(playerid);
numplayers++;
Spawned[playerid] = 0;
BusID[playerid] = 0;
BusCost[playerid] = 0;
PlayerSitting[playerid] = 0;
PlayAudioStreamForPlayer(playerid,"not necessary atm for you guys ;p");
cheers
|
u can do something like using a random number.
it cant ensure u listen to a different song every time, but most of the times the user will hear a different song. make a switch case. with numbers from 1 to x (x is the total number of songs u have) so assuming its 1 to 10 make a random number chooser like rand(1,x+1) [remember to put x+1 cause then it will choose a random number from 1 to x] after that, make switch cases from 1 to x like i said and have this random number chooser right above that. so every time the user logs in, it chooses like a random number from 1 to x. and then based on that a song is selected and played. hope i helped u. cheers |
new
a = 5;
switch (a)
{
case 1:
{
song
}
case 2:
{
song
}
case 5:
{
song
}
default:
{
song
}
}
|
Alright, but where should I put the ehhh rand[1,x+1). My code for example:
Код:
new
a = 5;
switch (a)
{
case 1:
{
song
}
case 2:
{
song
}
case 5:
{
song
}
default:
{
song
}
}
|
static const music_arr[][] =
{
"Link 1st",
"Link 2nd",
"Link 3rd",
// ...
"Link nth"
}; // An array
public OnPlayerConnect(playerid)
{
// Your code...
PlayAudioStreamForPlayer(playerid, music_arr[random(sizeof music_arr)]);
return 1;
}