Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

GetPlayerRadioStation

GtakillerIV edited this page Nov 15, 2014 · 3 revisions

GetPlayerRadioStation

Retrieves the player's current radio station ID


Parameters

playerid

The player's id.

Returns

    0 if the player is not in a vehicle

Else

   Returns the station ID

Usage

CMD:getradio(playerid, params[])
{
	//If the player has the SA-MP+ plugin installed
	if(IsUsingSAMPP(playerid))
	{
	    new targetid;
	    //If the entered parameters are incorrect, show him a message displaying the correct ones
	    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Correct usage: /getradio targetid");

	    if(IsPlayerInAnyVehicle(targetid))
	    {
	        new radioId = GetPlayerRadioStation(targetid);
	        //You now have the player's radio id stored in the variable radioId
	    }
	    else
	    {
	        SendClientMessage(playerid, -1, "The requested player is not in a vehicle");
	    }
	}
	else
	{
		SendClientMessage(playerid, -1, "You need the SA-MP+ plugin");
	}

    return 1;  
}

See also

SetRadioStationForPlayer

Callbacks

OnPlayerChangeRadioStation

Clone this wiki locally