Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp(playerid,"/changestation",true))
- {
- if(IsPlayerInAnyVehicle(playerid)) // Check if the player is in a vehicle, so he cannot change it onfoot.
- {
- ShowPlayerDialog(playerid,12349,DIALOG_STYLE_LIST,"Radio Stations",GetRadioStationsString(),"Choose","Close"); // Shows a dialog with all radio stations (including radio off).
- return 1;
- }
- else return SendClientMessage(playerid,COLOR_RED,"Error: You are not in a vehicle.");
- }
- return 0;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == 12349) // Our radio stations dialog
- {
- if(response)
- {
- SetRadioStation(GetPlayerVehicleID(playerid), listitem); // listitem is equal to the radio IDs, so we should use listitem here and set the radio station of the player's vehicle to that ID.
- if(listitem) // We'll send a seperate message for ID 0 (radio off)
- {
- new string[45 + NAME_SIZE]; // 45 for the default text + NAME_SIZE for the radio station name.
- format(string,sizeof(string),"You have changed your radio station: {FFFF00}%s",GetStationName(listitem));
- SendClientMessage(playerid,COLOR_WHITE,string);
- return 1;
- }
- else return SendClientMessage(playerid, COLOR_WHITE, "You have turned your radio off.");
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment