Where should i put my code -
Jimbo01 - 19.04.2012
Код:
new Float:X, Float:Y, Float:Z, Float:Distance = 5.0;
GetPlayerPos(playerid, X, Y, Z);
PlayAudioStreamForPlayer(playerid, "http://.........", 816.2269,-1386.7910,13.6079, Distance, 1);
If player is in the range it just plays the sound... It works under Onplayerconnect... Is there other way to make it work
Re: Where should i put my code -
fordawinzz - 19.04.2012
mhm, you could set a timer to 1sec to check the players position and the use it.
Re: Where should i put my code -
Twisted_Insane - 19.04.2012
Create a stock function; then you can use the function at any place in your script!
Re: Where should i put my code -
Jimbo01 - 03.05.2012
I did it like this
Код:
stock DiscoMusic(playerid)
{
new Float:X, Float:Y, Float:Z, Float:Distance = 5.0;
GetPlayerPos(playerid, X, Y, Z);
PlayAudioStreamForPlayer(playerid, "http://*******", 816.2269,-1386.7910,13.6079, Distance, 1);
}
but it dont works.. Anyone can help ?
Re: Where should i put my code -
JaTochNietDan - 03.05.2012
What's the point in getting the X,Y,Z co-ordinates of the player? You're not using them as far as I can tell.
Also how are you trying to call that function?
AW: Where should i put my code -
Jimbo01 - 03.05.2012
I did this now
Код:
public PlayAudioStreamForPoint(playerid, url[], Float:range, Float:xx, Float:yy, Float:zz)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i, 5.0, 816.2269,-1386.7910,13.6079))
{
PlayAudioStreamForPlayer(i, "http://*****");
}
}
}
return 1;
}
dont works ^^
I want if a player gets near vinewood(example) he can listen to the song
AW: Where should i put my code -
Jimbo01 - 05.05.2012
anyone can help ?
Re: Where should i put my code -
Jonny5 - 05.05.2012
IsPlayerInRangeOfPoint has a set x,y,z
you should use the ones in your function xx, yy, zz
pawn Код:
forward PlayAudioStreamForPoint(url[], Float:range, Float:xx, Float:yy, Float:zz);
public PlayAudioStreamForPoint(url[], Float:range, Float:xx, Float:yy, Float:zz)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i, range, xx,yy,zz))
{
PlayAudioStreamForPlayer(i, url);
}
}
}
return 1;
}
//use it in a timer
SetTimerEx("PlayAudioStreamForPoint",1000,true,"sffff",url,xx,yy,zz);
I removed the playerid argument as your looping threw all the players,