[Ayuda] PlayAudioStreamForPlayer
#9

Quote:
Originally Posted by Enrique_Henriquez
Посмотреть сообщение
encontre esto en un tutorial de PlayAudioStreamForPlayer:
PHP код:
public OnPlayerUpdate(playerid)
{
    if(
IsPlayerInRadioArea(playerid)) // or you can use If(IsPlayerInRangeOfPoint(playerid,range,X,Y,Z)
    
{
            if(!
GetPVarInt(playerid,"spawn")) // we are looking if there as variable with the name 'spawn' present , which we havent created yet
            
{
                
SetPVarInt(playerid,"spawn",1); // since there wasnt , we now create it so that the loop doesnt enter this again n again and create 'lag'
                
PlayAudioStreamForPlayer(playerid,"URL GOES HERE",X,Y,Z,range,1);
                
            }
    }
    else 
// player is not in point range
    
{
        if(
GetPVarInt(playerid,"spawn")) // since we create it before and played the stream , it will be there
        
{
            
DeletePVar(playerid,"spawn");// delete the variable so that next time player goes in range the radio can be started again
            
StopAudioStreamForPlayer(playerid); and stop stream
        
}
    }
    
    return 
1;

segun entiendo la variable spawn es para que no haga el flood que dice bytytus

PHP код:
stock IsPlayerInRadioArea(playerid)
{
    new 
Float:X,Float:Y,Float:Z;
    
GetPlayerPos(playerid,X,Y,Z);
    if(
MINX && MAXX && MINY && MAXY)
    {
        return 
1// if player is in that area , the stock will return 1 or true
    
}
    return 
0// if not then 0 or false

pero no he podido adaptarlo al FS donde tengo la radio, y en OnPlayerUpdate solo hay oportunidad para escuchar una sola emizora, a ver si me ayudan a adaptarlo para que pueda elegir una emisora y que actuen estos codigos.
aqui esta el link del tutorial: https://sampforum.blast.hk/showthread.php?tid=332729
en vez de OnPlayerUpdate colocarlo en un timer y haz un bucle con GetMaxPlayers
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)