CMD:musicforall(playerid, params[])
{
new Float:X, Float:Y, Float:Z, Float:Distance = 45.0;
new url[200];
if(sscanf(params,"s[200]", url)) return SendClientMessage(playerid, 0x9C9C9CAA,"Syntax: /asdj[url]");
foreach(new i: Player)
GetPlayerPos(playerid, X, Y, Z);
PlayAudioStreamForPlayer(playerid, url, 1209.9148,762.6340,13.3429, Distance, 1);
return 1;
}
CMD:musicforall(playerid, params[]) { if(sscanf(params,"s[128]", params[0])) return SendClientMessage(playerid, -1, "Syntax: /musicforall [url]"); new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); foreach(new i: Player) { if(IsPlayerInRangeOfPoint(playerid, 7.0, X, Y, Z)) //Change "7.0" obviously, depending of the range that you want { PlayAudioStreamForPlayer(i, params[0]); } } return 1; }
CMD:musicforall(playerid, params[]) { new Float: Pos[3]; if(isnull(params)) return SendClientMessage(playerid, -1, "/musicforall (url)"); GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]); for(new i; i < MAX_PLAYERS; i++) { if(IsPlayerInRangeOfPoint(i, 10.0, Pos[0], Pos[1], Pos[2])) { PlayAudioStreamForPlayer(i, params); } } return 1; }
And that is why you don't post untested code.
Also, why use sscanf for one string? |
No need to use sscanf for just one input. (nor foreach)
Код:
CMD:musicforall(playerid, params[]) { new Float: Pos[3]; if(isnull(params)) return SendClientMessage(playerid, -1, "/musicforall (url)"); GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]); for(new i; i < MAX_PLAYERS; i++) { if(IsPlayerInRangeOfPoint(i, 10.0, Pos[0], Pos[1], Pos[2])) { PlayAudioStreamForPlayer(i, params); } } return 1; } |
Why not?, it's a better question considering you're the most experienced scripter who replied
I thought using normal vars is better than using arrays for these cases |