PlayAudioStreamForPlayer 0.3x
#1

Can someone help me with making a script for audio streaming? And what plugin do I need?
I want the audio to start on OnPlayerConnect and to end on OnPlayerSpawn
Have been looking for solutions on web for hours, so don't judge me...
Reply
#2

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

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

It's simple, mate.

When using that function, though, make sure your GTA radio volume is turned up because otherwise it won't play anything for you!
Reply
#3

I tryed this one, but I got errors about undefined symbols cmdtext and PlayAudioStreamForPlayer
Reply
#4

Post your code, then! This is a help forum after all...
Reply
#5

I just used the example from samp wiki
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/play radio", cmdtext, true) == 0) 
    {
        PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls");
        return 1;
    }
    if (strcmp("/radio in my pos", cmdtext, true) == 0)
    {
        new Float:X, Float:Y, Float:Z, Float:Distance = 5.0;
        GetPlayerPos(playerid, X, Y, Z);
	PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls", X, Y, Z, Distance, 1);
	return 1;
    }
    return 0;
}
Reply
#6

Add
pawn Код:
#include <a_samp>
...

Look in other scripts.
Reply
#7

Make sure you have this at the top of your script:

pawn Код:
#include <a_samp>
It should be at the very top, otherwise, put it there!
Reply
#8

It is there!
Reply
#9

PM me your full code then, I'll take a look.
Reply
#10

pawn Код:
public OnPlayerConnect(playerid) {
    PlayAudioStreamForPlayer(playerid, "your url here");
    return 1;
}

public OnPlayerSpawn(playerid) {
    StopAudioStreamForPlayer(playerid);
    return 1;
}
was that so hard lol?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)