This repository was archived by the owner on Feb 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
SetRadioStationForPlayer
GtakillerIV edited this page Nov 14, 2014
·
7 revisions
Sets a player's radio station
playerid
The player's id.
stationid
The station id.
0 if player is not connected
CMD:setradio(playerid, params[])
{
//If the player has the SA-MP+ plugin installed
if(IsUsingSAMPP(playerid))
{
new stationId, targetid;
//If the player entered the wrong parameters, send him a message with the correct ones
if(sscanf(params, "ui", targetid, stationId)) return SendClientMessage(playerid, -1, "Correct usage: /setradio playerid stationid");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "The requested player doesn't appear to be online");
if(!IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid, -1, "The requested player is not in a vehicle");
//If the stationId variable is less than 1 or greater than 13, tell the user the correct range
if(stationId < 1 || stationId > 13) return SendClientMessage(playerid, -1, "Radio IDs range from 1-13");
//Set the player's radio station
SetRadioStationForPlayer(targetid, stationId);
//Send message telling the user that the radio station has been changed
SendClientMessage(playerid, -1, "The requested player's radio station has been changed successfully");
}
else
{
SendClientMessage(playerid, -1, "You need the SA-MP+ plugin");
}
return 1;
}
See also
Callbacks