/radio command help
#1

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;
}
Reply
#2

Here the first one

Second Here
Reply
#3

pawn Код:
CMD:r(playerid,params[])
{
    #pragma unused params
    if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /r [text] to talk in team radio");
    new Name[MAX_PLAYER_NAME]; GetPlayerName(playerid, Name, sizeof(Name));
    new string[128];
    format(string, sizeof(string), "[R][Team Radio] %s: %s", Name, params[0]);
    printf("%s", string);

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i) && gTeam[i] == gTeam[playerid]) SendClientMessage(i, COLOR_GREEN, string);
    }
    return 1;
}
Reply
#4

Hmm... I still need help... I did not understand you two
Reply
#5

pawn Код:
new DriverVehID = GetPlayerVehicleID(playerid);
    foreach(Player, i)
    {
        if(DriverVehID == GetPlayerVehicleID(i))
            PlayAudioStreamForPlayer(i, string);
    }

    or

    new DriverVehID = GetPlayerVehicleID(playerid);
    foreach(Player, i)
    {
        if(IsPlayerInVehicle(i, DriverVehID))
            PlayAudioStreamForPlayer(i, string);
    }
Reply
#6

pawn Код:
if(IsPlayerInAnyVehicle(playerid))
 PlayAudioStreamForPlayer(playerid, "linkofyoursong");
Reply
#7

Still confused haha
Reply
#8

Okay that first one was a fail link...

if(GetPlayerState(playerid)== PLAYER_STATE_DRIVER)
By cheking it..
Reply
#9

Add in ur script:
pawn Код:
if(IsPlayerInAnyVehicle(playerid))
 PlayAudioStreamForPlayer(playerid, "linkofyoursong");
Correct me if its a mistake
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)