21.11.2015, 19:19
(
Последний раз редактировалось PT; 22.11.2015 в 12:29.
)
PHP код:
CMD:boombox(playerid, params[])
{
new
type[8],
string[128];
if (!Inventory_HasItem(playerid, "Boombox"))
return SendErrorMessage(playerid, "Vocк nгo tem uma boombox ");
if (sscanf(params, "s[8]S(nada)[128]", type, string))
{
SendSyntaxMessage(playerid, "/boombox [nome]");
SendClientMessage(playerid, COLOR_YELLOW, "[NOMES]:{FFFFFF} colocar, pegar, url");
return 1;
}
if (!strcmp(type, "colocar", true))
{
if (BoomboxData[playerid][boomboxPlaced])
return SendErrorMessage(playerid, "Vocк jб colocou uma boombox.");
if (Boombox_Nearest(playerid) != INVALID_PLAYER_ID)
return SendErrorMessage(playerid, "Vocк estб perto de outra boombox.");
if (IsPlayerInAnyVehicle(playerid))
return SendErrorMessage(playerid, "Vocк precisa sair do veiculo.");
Boombox_Place(playerid);
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s coloca a boombox no chгo.", ReturnName(playerid, 0));
SendServerMessage(playerid, "Vocк colocou sua boombox no chгo (use \"/boombox\" para ver as opзхes).");
}
else if (!strcmp(type, "pegar", true))
{
if (!BoomboxData[playerid][boomboxPlaced])
return SendErrorMessage(playerid, "Vocк nгo tem nenhuma boombox no chгo.");
if (!IsPlayerInRangeOfPoint(playerid, 3.0, BoomboxData[playerid][boomboxPos][0], BoomboxData[playerid][boomboxPos][1], BoomboxData[playerid][boomboxPos][2]))
return SendErrorMessage(playerid, "Vocк nгo estб perto da sua boombox.");
Boombox_Destroy(playerid);
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s pega sua boombox.", ReturnName(playerid, 0));
}
else if (!strcmp(type, "url", true))
{
if (sscanf(string, "s[128]", string))
return SendSyntaxMessage(playerid, "/boombox url [url da musica]");
if (!BoomboxData[playerid][boomboxPlaced])
return SendErrorMessage(playerid, "Vocк nгo tem nenhuma boombox no chгo.");
if (!IsPlayerInRangeOfPoint(playerid, 3.0, BoomboxData[playerid][boomboxPos][0], BoomboxData[playerid][boomboxPos][1], BoomboxData[playerid][boomboxPos][2]))
return SendErrorMessage(playerid, "Vocк nгo estб perto da sua boombox.");
Boombox_SetURL(playerid, string);
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s altera a musica da boombox.", ReturnName(playerid, 0));
}
return 1;
}
PHP код:
stock Boombox_SetURL(playerid, url[])
{
if (BoomboxData[playerid][boomboxPlaced])
{
foreach (new i : Player)
{
StopAudioStreamForPlayer(i);
PlayAudioStreamForPlayer(i, url, BoomboxData[playerid][boomboxPos][0], BoomboxData[playerid][boomboxPos][1], BoomboxData[playerid][boomboxPos][2], 30.0, 1);
}
strpack(BoomboxData[playerid][boomboxURL], url, 128 char);
}
return 1;
}