28.03.2013, 15:38
Okay, so for the radio I need it to ONLY play for the people in the car.
But I still need it to show this '%s switches the song on their radio to song '%s'' to players around them.
Next thing, for the CD player i need this command to ONLY play for that player but still show the '%s switch thier CD player to song '%s''
Code:
CMD:radio(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /radio [url]");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You need to be driving a car to use the radio.");
format(string, sizeof(string), "%s switches the song on their radio to song '%s'.", RPN(playerid), params);
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
format(string,sizeof(string),"http://americanrp.x10.mx/songs/%s",params);
foreach(Player, i)
{
PlayAudioStreamForPlayer(i, string);
}
return 1;
}
Next thing, for the CD player i need this command to ONLY play for that player but still show the '%s switch thier CD player to song '%s''
Code:
CMD:play(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!PlayerInfo[playerid][pCdplayer]) return SendClientMessage(playerid, COLOR_GREY, "You don't have a CD player.");
if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /play [url]");
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_GREY, "You need to be on foot to use this command.");
return 1;
}
format(string, sizeof(string), "%s switch thier CD player to song '%s'.", RPN(playerid), params);
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
format(string,sizeof(string),"http://americanrp.x10.mx/songs/%s",params);
foreach(Player, i)
{
PlayAudioStreamForPlayer(i, string);
}
return 1;
}

