errors
#1

How to fix this errors ?
Help


pawn Код:
F:\Users\Daniel\Desktop\GamingClub RP\gamemodes\DreamWorld.pwn(38558) : error 017: undefined symbol "x"
F:\Users\Daniel\Desktop\GamingClub RP\gamemodes\DreamWorld.pwn(38589) : error 001: expected token: ",", but found ";"
F:\Users\Daniel\Desktop\GamingClub RP\gamemodes\DreamWorld.pwn(38611) : error 001: expected token: ",", but found ";"
pawn Код:
stock PlayAudioStreamForAll(url[])
{
    for(new i; i<GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected( i ))
        {
            PlayAudioStreamForPlayer(i, url, x, y, z, distance); //line 38558
        } // line 38559
    }
    return 1;

}
pawn Код:
YCMD:music(playerid, params[], help)
{
    if (help)
    {
        SendClientMessage(playerid, 0xFF0000AA, "Pustite pesna.");
    }
    else
    {
        new
            str[32];
        if (isnull(params))
        {
            format(str, sizeof (str), "Koristi: \"/music [link]\""; // line 38611
            SendClientMessage(playerid, 0xFF0000AA, str);
        }
        else
        {
            PlayAudioStreamForAll(params);
        }
    }
    return 1;
}
HELP ME PLEASEE
Reply
#2

On this code: You had "x, y, z" in there.. these are the coordinates. But you haven't taken the player's coordinates! You cant just put XYZ, you have to get them also. And also you have to write the distance (the last parameter on PlayerAudioStreamForPlayer). I suggest looking the wiki example also.

pawn Код:
stock PlayAudioStreamForAll(url[])
{
    for(new i; i<GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected(i))
        {
            new Float:Pos[3];
            GetPlayerPos(i, Pos[0], Pos[1], Pos[2]);
            PlayAudioStreamForPlayer(i, url, x, y, z, 1);
        }
    }
    return 1;

}
And on this: Clearly, a missing ")" on the format line.

pawn Код:
YCMD:music(playerid, params[], help)
{
    if (help)
    {
        SendClientMessage(playerid, 0xFF0000AA, "Pustite pesna.");
    }
    else
    {
        new
            str[32];
        if (isnull(params))
        {
            format(str, sizeof (str), "Koristi: \"/music [link]\"");
            SendClientMessage(playerid, 0xFF0000AA, str);
        }
        else
        {
            PlayAudioStreamForAll(params);
        }
    }
    return 1;
}
Reply
#3

The stock should be like this, the rest of the parameters are optional.
pawn Код:
stock PlayAudioStreamForAll(url[])
{
    for(new i,l = GetMaxPlayers(); i != l; ++i)
    {
        if(IsPlayerConnected(i))
        {
            PlayAudioStreamForPlayer(i, url);
        }
    }
    return 1;
}
Reply
#4

oohh i dont see taht
thanks fixed
Reply
#5

Oh sorry, change the lines to this, because the x y z are stored in these arrays:
pawn Код:
PlayAudioStreamForPlayer(i, url, Pos[0], Pos[1], Pos[2], 1);
Or yes, rest the of the parameters are optional, you can just do:
pawn Код:
PlayAudioStreamForPlayer(i, url);
And in that case also remove the new Pos[3].

E:// Leonardo, btw that loop isn't the most efficient one. Because you have to call the function GetMaxPlayers() alot, when a lot of people in the server. It's faster to use just MAX_PLAYERS, or better, use foreach include.
Reply
#6

Nope, he's pre declared instead of what Vizi did.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)