Convert to New Audio stream?
#1

Hello, I have tried converting to the new PlayAudioStreamForPlayer and StopAudioStreamForPlayer but I got this error:



pawn Код:
if(strcmp(cmd, "/play", true) == 0)
    {
        if(PlayerInfo[playerid][pAdmin] >= 99998)
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, WHITE, "[SYNTAX] /play [audioid] (or use -1 to turn it off)");
            new audioid = strval(tmp);
            if(audioid == -1)
            {
                for(new i = 0; i < MAX_PLAYERS; i++)
                {
                    StopAudioStreamForPlayer(i);
                }
                SendClientMessageToAll(WHITE, "Music stopped.");
                return 1;
            }
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(gPlayback[i])
                {
                    StopAudioStreamForPlayer(playerid);
                    audiohandle[i] = PlayAudioStreamForPlayer(i, audioid);//Line 56319
                }
            }
            format(string, sizeof(string), "AdmCmd: Now playing: %s", GetSongName(audioid));
            SendClientMessageToAll(LIGHTRED, string);
            format(string, sizeof(string), "AdmCmd: %s has started global play for song ID %d, to find out the song name, type /playlist.", PlayerName(playerid), audioid);
            SendClientMessageToAll(LIGHTRED, string);
            return 1;
        }
        return 1;
    }
    if(strcmp(cmd, "/splay", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, WHITE, "[SYNTAX] /splay [audioid] (or use -1 to turn it off)");
        new audioid = strval(tmp);
        if(audioid == -1)
        {
            StopAudioStreamForPlayer(playerid);
            SendClientMessage(playerid, WHITE, "Music stopped.");
            return 1;
        }
        StopAudioStreamForPlayer(playerid);
        audiohandle[playerid] = PlayAudioStreamForPlayer(playerid, audioid);//Line 56342
        format(string, sizeof(string), "AdmCmd: Now playing audio ID %d.", audioid);
        SendClientMessage(playerid, LIGHTRED, string);
        return 1;
    }
Код:
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\server\gamemodes\ESRP.pwn(56319) : error 035: argument type mismatch (argument 2)
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\server\gamemodes\ESRP.pwn(56342) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#2

Shouldnt fuck with the command. it worked fine.
Reply
#3

Quote:
Originally Posted by seanny
Посмотреть сообщение
Hello, I have tried converting to the new PlayAudioStreamForPlayer and StopAudioStreamForPlayer but I got this error:



pawn Код:
if(strcmp(cmd, "/play", true) == 0)
    {
        if(PlayerInfo[playerid][pAdmin] >= 99998)
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, WHITE, "[SYNTAX] /play [audioid] (or use -1 to turn it off)");
            new audioid = strval(tmp);
            if(audioid == -1)
            {
                for(new i = 0; i < MAX_PLAYERS; i++)
                {
                    StopAudioStreamForPlayer(i);
                }
                SendClientMessageToAll(WHITE, "Music stopped.");
                return 1;
            }
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(gPlayback[i])
                {
                    StopAudioStreamForPlayer(playerid);
                    audiohandle[i] = PlayAudioStreamForPlayer(i, audioid);//Line 56319
                }
            }
            format(string, sizeof(string), "AdmCmd: Now playing: %s", GetSongName(audioid));
            SendClientMessageToAll(LIGHTRED, string);
            format(string, sizeof(string), "AdmCmd: %s has started global play for song ID %d, to find out the song name, type /playlist.", PlayerName(playerid), audioid);
            SendClientMessageToAll(LIGHTRED, string);
            return 1;
        }
        return 1;
    }
    if(strcmp(cmd, "/splay", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, WHITE, "[SYNTAX] /splay [audioid] (or use -1 to turn it off)");
        new audioid = strval(tmp);
        if(audioid == -1)
        {
            StopAudioStreamForPlayer(playerid);
            SendClientMessage(playerid, WHITE, "Music stopped.");
            return 1;
        }
        StopAudioStreamForPlayer(playerid);
        audiohandle[playerid] = PlayAudioStreamForPlayer(playerid, audioid);//Line 56342
        format(string, sizeof(string), "AdmCmd: Now playing audio ID %d.", audioid);
        SendClientMessage(playerid, LIGHTRED, string);
        return 1;
    }
Код:
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\server\gamemodes\ESRP.pwn(56319) : error 035: argument type mismatch (argument 2)
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\server\gamemodes\ESRP.pwn(56342) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
My friend, the function you used is wrong that is why the PAWNO is giving you few errors like tag mismatch.

PlayAudioStreamForPlayer(playerid, audioid); is totally wrong as the audioid won't work.

checkout the following example:-

pawn Код:
if (strcmp("/play radio", cmdtext, true) == 0)
    {
        PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls"); // link can be mp3 and ogg/vorbis
        return 1;
    }
pawn Код:
(playerid, url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0)
These are the parameters, but if you want to put the AudioStream without all float positions you can just use the following parameters:-

(playerid, url[]); Remember the url must be mp3 and ogg/vorbis.

For more info, click the following link:-

https://sampwiki.blast.hk/wiki/PlayAudioStreamForPlayer

-FalconX
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)