Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include a_samp
- #include zcmd
- #include sscanf2
- //this is simple car radio system made by silverms
- #define COLOR_YELLOW 0xFFFF00AA
- new Radio[MAX_PLAYERS];
- public OnPlayerConnect(playerid)
- {
- if(Radio[playerid] == 1)
- {
- Radio[playerid] = 0;
- StopAudioStreamForPlayer(playerid);
- }
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- if(Radio[playerid] == 1)
- {
- Radio[playerid] = 0;
- StopAudioStreamForPlayer(playerid);
- }
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- if(Radio[killerid] == 1)
- {
- Radio[killerid] = 0;
- StopAudioStreamForPlayer(killerid);
- }
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- if(oldstate == PLAYER_STATE_DRIVER)
- {
- if(Radio[playerid] == 1)
- {
- Radio[playerid] = 0;
- StopAudioStreamForPlayer(playerid);
- }
- }
- if(oldstate == PLAYER_STATE_PASSENGER)
- {
- if(Radio[playerid] == 1)
- {
- Radio[playerid] = 0;
- StopAudioStreamForPlayer(playerid);
- }
- }
- }
- //the command
- CMD:radio(playerid, params[])
- {
- new option[128];
- if(sscanf(params, "s", option))
- {
- SendClientMessage(playerid, COLOR_YELLOW, "{FFFFFF} /radio [Option]");
- SendClientMessage(playerid, COLOR_YELLOW, "{FFFFFF} Options:URL, 0,1,2,3,4,5[0=clean bandit, 1=turn down for what, 2=Dont Let me down, 3=Faded, 4=IamTheOne,URL]");
- return 1;
- }
- {
- if (strcmp(option, "0", true) == 0)
- {
- new vehicle = GetPlayerVehicleID(playerid);
- for(new i; i < MAX_PLAYERS; i++)
- {
- new playercar = GetPlayerVehicleID(i);
- if(playercar == vehicle)
- {
- Radio[i] = 1;
- PlayAudioStreamForPlayer(i, "http://rintixmusic.000webhostapp.com/music/cleanbandit.mp3");
- }
- }
- new changer[MAX_PLAYER_NAME+1], string[48+MAX_PLAYER_NAME+1];
- GetPlayerName(playerid, changer, sizeof(string));
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- for(new i2; i2 < MAX_PLAYERS; i2++)
- {
- if(IsPlayerInRangeOfPoint(i2, 10.0, x, y, z))
- {
- format(string, sizeof(string), "%s reaches for the car stereo and turns some knobs.", changer);
- SendClientMessage(i2, 0xC2A2DAAA, string);
- }
- }
- return 1;
- }
- if (strcmp(option, "1", true) == 0)
- {
- new vehicle = GetPlayerVehicleID(playerid);
- for(new i; i < MAX_PLAYERS; i++)
- {
- new playercar = GetPlayerVehicleID(i);
- if(playercar == vehicle)
- {
- Radio[i] = 1;
- PlayAudioStreamForPlayer(i, "http://rintixmusic.000webhostapp.com/music/turndown.mp3");
- }
- }
- new changer[MAX_PLAYER_NAME+1], string[48+MAX_PLAYER_NAME+1];
- GetPlayerName(playerid, changer, sizeof(string));
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- for(new i2; i2 < MAX_PLAYERS; i2++)
- {
- if(IsPlayerInRangeOfPoint(i2, 10.0, x, y, z))
- {
- format(string, sizeof(string), "%s reaches for the car stereo and turns some knobs.", changer);
- SendClientMessage(i2, 0xC2A2DAAA, string);
- }
- }
- return 1;
- }
- if (strcmp(option, "2", true) == 0)
- {
- new vehicle = GetPlayerVehicleID(playerid);
- for(new i; i < MAX_PLAYERS; i++)
- {
- new playercar = GetPlayerVehicleID(i);
- if(playercar == vehicle)
- {
- Radio[i] = 1;
- PlayAudioStreamForPlayer(i, "http://rintixmusic.000webhostapp.com/music/chain2.mp3");
- }
- }
- new changer[MAX_PLAYER_NAME+1], string[48+MAX_PLAYER_NAME+1];
- GetPlayerName(playerid, changer, sizeof(string));
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- for(new i2; i2 < MAX_PLAYERS; i2++)
- {
- if(IsPlayerInRangeOfPoint(i2, 10.0, x, y, z))
- {
- format(string, sizeof(string), "%s reaches for the car stereo and turns some knobs.", changer);
- SendClientMessage(i2, 0xC2A2DAAA, string);
- }
- }
- return 1;
- }
- if (strcmp(option, "3", true) == 0)
- {
- new vehicle = GetPlayerVehicleID(playerid);
- for(new i; i < MAX_PLAYERS; i++)
- {
- new playercar = GetPlayerVehicleID(i);
- if(playercar == vehicle)
- {
- Radio[i] = 1;
- PlayAudioStreamForPlayer(i, "http://rintixmusic.000webhostapp.com/music/faded.mp3");
- }
- }
- new changer[MAX_PLAYER_NAME+1], string[48+MAX_PLAYER_NAME+1];
- GetPlayerName(playerid, changer, sizeof(string));
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- for(new i2; i2 < MAX_PLAYERS; i2++)
- {
- if(IsPlayerInRangeOfPoint(i2, 10.0, x, y, z))
- {
- format(string, sizeof(string), "%s reaches for the car stereo and turns some knobs.", changer);
- SendClientMessage(i2, 0xC2A2DAAA, string);
- }
- }
- return 1;
- }
- if (strcmp(option, "4", true) == 0)
- {
- new vehicle = GetPlayerVehicleID(playerid);
- for(new i; i < MAX_PLAYERS; i++)
- {
- new playercar = GetPlayerVehicleID(i);
- if(playercar == vehicle)
- {
- Radio[i] = 1;
- PlayAudioStreamForPlayer(i, "http://rintixmusic.000webhostapp.com/music/iamtheone.mp3");
- }
- }
- new changer[MAX_PLAYER_NAME+1], string[48+MAX_PLAYER_NAME+1];
- GetPlayerName(playerid, changer, sizeof(string));
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- for(new i2; i2 < MAX_PLAYERS; i2++)
- {
- if(IsPlayerInRangeOfPoint(i2, 10.0, x, y, z))
- {
- format(string, sizeof(string), "%s reaches for the car stereo and turns some knobs.", changer);
- SendClientMessage(i2, 0xC2A2DAAA, string);
- }
- }
- return 1;
- }
- if(isnull(params)) return SendClientMessage(playerid, -1, "USAGE: /radio [url]");
- new vehicle = GetPlayerVehicleID(playerid);
- for(new i; i < MAX_PLAYERS; i++)
- {
- new playercar = GetPlayerVehicleID(i);
- if(playercar == vehicle)
- {
- Radio[i] = 1;
- PlayAudioStreamForPlayer(i, params);
- }
- }
- new changer[MAX_PLAYER_NAME+1], string[48+MAX_PLAYER_NAME+1];
- GetPlayerName(playerid, changer, sizeof(string));
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- for(new i2; i2 < MAX_PLAYERS; i2++)
- {
- if(IsPlayerInRangeOfPoint(i2, 10.0, x, y, z))
- {
- format(string, sizeof(string), "%s reaches for the car stereo and turns some knobs.", changer);
- SendClientMessage(i2, 0xC2A2DAAA, string);
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement