18.11.2012, 15:06
Ok so I have a boombox script in my GM, it works awesome... except for one thing... If It's on and a player later connects they don't hear it. They only hear it if its truned on WHILE they are connected. How do I fix this so it plays when a player connects if it's on?
Here is the code (the song part isn't included. Ask if I need to give that too):
Thanks: jakejohnsonusa
Here is the code (the song part isn't included. Ask if I need to give that too):
pawn Код:
if(strcmp(cmd, "/playradio", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
}
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "{FF0000}[USAGE]:{FFFFFF} /playradio {009900}(on/off){FFFFFF}");
return 1;
}
if(strcmp(tmp,"on",true) == 0)
{
if(PlayerInfo[playerid][pAdmin] == 1337)
{
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
playerBoombox[playerid] = CreateObject(2103, X, Y+1, Z, 1.5, 0.0, 0.0, 0.0);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Los Santos Radio","Top Teen Radio\nTop Radio\nClassic Hits Radio\nRock Radio\nTop Teen Radio (ALL)\nTop Radio (ALL)\nChristmas Songs\nChristmas Songs (ALL)","Select","Cancel"); }
}
if(strcmp(tmp,"off",true) == 0)
{
if(PlayerInfo[playerid][pAdmin] == 1337)
{
DestroyObject(playerBoombox[playerid]);
for(new i = 0; i < MAX_PLAYERS; i++)
StopAudioStreamForPlayer(i);
}
}
return 1;
}