07.01.2014, 14:25
try this
its not tested.
EDIT: To late
pawn Код:
#include <a_samp>
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
forward PlayMuzic(playerid);
public OnGameModeInit()
{
SetTimer("PlayMuzic", 999, true);
return 1;
}
public PlayMuzic(playerid)
{
if(PlayerToPoint(1, playerid, x, y, z)
{
PlayAudioStreamForPlayer(playerid,"MUSIC HERE");
}
return 1;
}
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}
EDIT: To late