looping music at onplayerconnect
#1

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;

Reply
#2

Just place this line under OnPlayerConnect:

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

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

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

Код:
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;
}
Reply
#6

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

no. i dont't copy+paste
Reply
#8

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;
}

Reply
#9

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?
Reply
#10

it work but i want to onplayerconnect
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)