if(listitem == 0)
{
StopAudioStreamForPlayer(playerid);
PlayerPlaySound(playerid,1056,0.0,0.0,0.0);
new Float:X, Float:Y, Float:Z, Float:Distance = 13.0;
GetPlayerPos(playerid, X, Y, Z);
PlayAudioStreamForPlayer(playerid, "http://188.165.229.150:10500/listen.pls", X, Y, Z, Distance, 1);
}
if(listitem == 0)
{
StopAudioStreamForPlayer(playerid);
PlayerPlaySound(playerid,1056,0.0,0.0,0.0);
PlayAudioStreamForPlayer(playerid, "http://188.165.229.150:10500/listen.pls");
}
ok gracias voy a probarlo
![]() |
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;
}
stock IsPlayerInRadioArea(playerid)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
if(X > MINX && X < MAXX && Y > MINY && Y < MAXY)
{
return 1; // if player is in that area , the stock will return 1 or true
}
return 0; // if not then 0 or false
}
encontre esto en un tutorial de PlayAudioStreamForPlayer:
PHP код:
PHP код:
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
|
stock IsPlayerInRadioArea(playerid)//Float:minx, Float:maxx, Float:miny, Float:maxy
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
if(X > minx && X < maxx && Y > miny && Y < maxy)
{
return 1; // if player is in that area , the stock will return 1 or true
}
return 0; // if not then 0 or false
}
//============================================
//========================================
forward Radio(playerid);
public Radio(playerid)
{
//new Float:X, Float:Y, Float:Z, Float:Distance = 20.0;
//GetPlayerPos(playerid, X, Y, Z);
for(new i; i <GetMaxPlayers(); i++)
if(IsPlayerInRadioArea(playerid)) // or you can use If(IsPlayerInRangeOfPoint(playerid,range,X,Y,Z) Float:minx, Float:maxx, Float:miny, Float:maxy
{
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,"http://5133.live.streamtheworld.com/LOS40_COLUMBIA_SC",X,Y,Z,20,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);
}
}
return 1;
}
C:\Users\user\Desktop\gta\filterscripts\xD.pwn(611) : error 017: undefined symbol "minx"
stock IsPlayerInRadioArea(playerid)//Float:minx, Float:maxx, Float:miny, Float:maxy
stock IsPlayerInRadioArea(playerid,Float:minx, Float:maxx, Float:miny, Float:maxy)
C:\Users\user\Desktop\gta\filterscripts\xD.pwn(625) : error 017: undefined symbol "minx"
if(IsPlayerInRadioArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy))