if (dialogid == SomAutomotivo) { if (response) { if(!strlen(inputtext)){ SendClientMessage(playerid, Vermelho, "Nenhum url foi digitado na Box!"); return 0; } new Float:Pos[3]; GetPlayerPos(playerid, Pos[0],Pos[1], Pos[2]); for(new i = 0; i <MAX_PLAYERS; i++){ if(IsPlayerInRangeOfPoint(i, 10.0, Pos[0], Pos[1], Pos[2])){ PlayAudioStreamForPlayer(i, inputtext); } } }else{ } }
// Som Automotivo CMD:tocarsom(playerid,params[]) { if(pAusente[playerid] == true) return pMensagem(playerid, Vermelho, "-ERRO- Vocк estб ausente."); if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, Vermelho, "Vocк nгo estб em um veнculo!"); ShowPlayerDialog(playerid, SomAutomotivo, DIALOG_STYLE_INPUT, "SomAutomotivo", "Cole aqui o endereзo do audio.", "Tocar", "Cancelar"); return 1; } CMD:pararaudio(playerid) { if(pAusente[playerid] == true) return pMensagem(playerid, Vermelho, "-ERRO- Vocк estб ausente."); new Float:Pos[3]; GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]); for(new i = 0; i < MAX_PLAYERS; i++){ if(IsPlayerInRangeOfPoint(i, 10.0,Pos[0],Pos[1],Pos[2])){ StopAudioStreamForPlayer(playerid); } } return 1; }
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);
https://sampwiki.blast.hk/wiki/PlayAudioStreamForPlayer
PHP код:
|
stock GetDistanceBetweenPlayers(playerid,playerid2)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
new Float:tmpdis;
GetPlayerPos(playerid,x1,y1,z1);
GetPlayerPos(playerid2,x2,y2,z2);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
return floatround(tmpdis);
}
if(dialogid == SomAutomotivo)
{
if(response)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid, Vermelho, "Nenhum url foi digitado na Box!");
return 0;
}
new Float:Pos[3];
GetPlayerPos(playerid, Pos[0],Pos[1], Pos[2]);
for(new i = 0; i <MAX_PLAYERS; i++)
{
if(GetDistanceBetweenPlayers(playerid, i) <= 10)
{
PlayAudioStreamForPlayer(i, inputtext);
}
}
}else{
}