19.04.2013, 00:07
How would I make this command ONLY play for people in the car? I do not want anyone to hear this unless they are in the car....
Код:
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(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "You need be on car when you want listen radio"); 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/music/%s",params); foreach(Player, i) { PlayAudioStreamForPlayer(i, string); } return 1; }