SA-MP Forums Archive
looping music at onplayerconnect - 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)
+--- Thread: looping music at onplayerconnect (/showthread.php?tid=632433)



looping music at onplayerconnect - crukk11 - 14.04.2017

i have my code but the code is only for the car and how to change to onplayerconnect

PHP код:
forward SwitchNewSound();
public 
SwitchNewSound()
{
 for(new 
0MAX_PLAYERSi++)
        {
            if(
IsPlayerInAnyVehicle(i))
        {
            
StopAudioStreamForPlayer(i);
            
PlayAudioStreamForPlayer(iRandomSongs[random(sizeof(RandomSongs))]);
            
URLNumber++;
            if(
URLNumber == sizeof(RandomSongs)) URLNumber 0;
        }
    }
    return 
1;




Re: looping music at onplayerconnect - raydx - 14.04.2017

Just place this line under OnPlayerConnect:

Код:
PlayAudioStreamForPlayer(i, RandomSongs[random(sizeof(RandomSongs))]);



Re: looping music at onplayerconnect - crukk11 - 14.04.2017

Quote:

C:\Users\cyber\Desktop\gta server cc bukit\gamemodes\GL.pwn(331) : error 017: undefined symbol "i"
C:\Users\cyber\Desktop\gta server cc bukit\gamemodes\GL.pwn(4060) : error 017: undefined symbol "i"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

error code


Re: looping music at onplayerconnect - Sew_Sumi - 14.04.2017

Change i in the line under OnPlayerConnect to playerid.

Whichever line that isn't under OnPlayerConnect that is returning this error needs to be looked at next.


Re: looping music at onplayerconnect - Vin Diesel - 14.04.2017

Код:
forward SwitchNewSound();
public SwitchNewSound()
{
 for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerInAnyVehicle[i])
        {
            StopAudioStreamForPlayer[i];
            PlayAudioStreamForPlayer(i, RandomSongs[random(sizeof(RandomSongs))]);
            URLNumber++;
            if(URLNumber == sizeof(RandomSongs)) URLNumber = 0;
        }
    }
    return 1;
}



Re: looping music at onplayerconnect - GangstaSunny. - 14.04.2017

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Change i in the line under OnPlayerConnect to playerid.

Whichever line that isn't under OnPlayerConnect that is returning this error needs to be looked at next.
Hmmm. Which line could it be. Hmmm.
Maybe the line he just copy+paste from a random guy from the internet and he just press f5 "oh i have some errors let's post them".

Srsly. Don't just copy+paste. At least check the line.


Re: looping music at onplayerconnect - crukk11 - 14.04.2017

no. i dont't copy+paste


Re: looping music at onplayerconnect - crukk11 - 14.04.2017

not work

Quote:

forward SwitchNewSound();
public SwitchNewSound()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInAnyVehicle[i])
{
StopAudioStreamForPlayer[i];
PlayAudioStreamForPlayer(i, RandomSongs[random(sizeof(RandomSongs))]);
URLNumber++;
if(URLNumber == sizeof(RandomSongs)) URLNumber = 0;
}
}
return 1;
}




Re: looping music at onplayerconnect - Vin Diesel - 14.04.2017

This code is correct.
Код:
forward SwitchNewSound();
public SwitchNewSound()
{
 for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerInAnyVehicle(i))
        {
            StopAudioStreamForPlayer(i);
            PlayAudioStreamForPlayer(i, RandomSongs[random(sizeof(RandomSongs))]);
            URLNumber++;
            if(URLNumber == sizeof(RandomSongs)) URLNumber = 0;
        }
    }
    return 1;
}
Can you show me which line gives you the error?


Re: looping music at onplayerconnect - crukk11 - 14.04.2017

it work but i want to onplayerconnect