CMD:deployradio (playerid, params[])
{
new Float:X;
new Float:Y;
new Float:Z;
GetPlayerPos(playerid, X, Y, Z);
new songUrl[128];
if (PRinfo[playerid][radioDeployed]==1)
{
SendClientMessage(playerid, 0xF0A20FFF, "Your radio is already deployed.");
}
else
{
new PName[MAX_PLAYER_NAME];
new string[40];
if(sscanf(params, "s", songUrl)) return SendClientMessage(playerid, 0xCFF0FFCF, "USAGE: /deployradio [SONG URL]");
GetPlayerPos(playerid, X, Y, Z);
PRinfo[playerid][radioDeployed]=1;
SendClientMessage(playerid, 0xFFE2E817, "You have deployed your radio at your current position.");
PRinfo[playerid][locX]=X+2;
PRinfo[playerid][locY]=Y;
PRinfo[playerid][locZ]=Z;
GetPlayerName(playerid, PName, sizeof(PName));
format(string, sizeof(string), "%s's radio is here", PName);
radioDeployedLabel[playerid] = Create3DTextLabel(string, 0xFFF900FF, PRinfo[playerid][locX], PRinfo[playerid][locY], PRinfo[playerid][locZ], 35.0, 0, 0);
radioObject[playerid] = CreateObject(2103, PRinfo[playerid][locX], PRinfo[playerid][locY], PRinfo[playerid][locZ]-1, 0.0, 0.0, 0.0);
PlayAudioStreamForPlayer(playerid, songUrl, PRinfo[playerid][locX], PRinfo[playerid][locY], PRinfo[playerid][locZ], 20.0, 1);
playerListeningRadio[playerid]=1;
for (new i = 0;i<MAX_PLAYERS;i++)
{
if (IsPlayerInRangeOfPoint(i, 10.0, PRinfo[playerid][locX], PRinfo[playerid][locY], PRinfo[playerid][locZ]) && i != playerid)
{
playerListeningRadio[i]=1;
PlayAudioStreamForPlayer(i, "http://mp3rehab.com/user_uploads_10813-12345/C.C.Catch%20-%20Backseat%20Of%20Your%20Cadillac.mp3", PRinfo[playerid][locX], PRinfo[playerid][locY], PRinfo[playerid][locZ], 10.0, 1);
}
}
}
return 1;
}
if(sscanf(params, "s", songUrl)) return SendClientMessage(playerid, 0xCFF0FFCF, "USAGE: /deployradio [SONG URL]");
if(sscanf(params, "s[128]", songUrl)) return SendClientMessage(playerid, 0xCFF0FFCF, "USAGE: /deployradio [SONG URL]");
|
try getting in a vehicle before typing the command. works in most cases
|