pawn Код:
#define FILTERSCRIPT
#include <a_samp>
//#pragma tabsize 0
new Radio[MAX_VEHICLES][128 char];
new pname[MAX_PLAYER_NAME char];
new str[128 char];
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" RADIO FILTERSCRIPT BY LUCAS MORAIS");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnGameModeInit()
{
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/radio", true))
{
if(IsPlayerInAnyVehicle(playerid))
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Escolha a estaзгo", "COUNTRY\nPOP\nHIP HOP\nROCK\nELETRФNICA\nHEAVY METAL", "Tunar", "Desligar");
else
SendClientMessage(playerid, 0x8F1B14AA, "Vocк nгo estб em um veнculo!");
return 1;
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
PlayAudioStreamForPlayer(playerid, Radio[GetPlayerVehicleID(playerid)]);
else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
{
StopAudioStreamForPlayer(playerid);
SendClientMessage(playerid, 0x50AF6CAA, "Rбdio desligado automaticamente!");
}
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
GetPlayerName(playerid, pname, sizeof(pname));
if(dialogid == 1)
{
switch(listitem)
{
case 0:
{
ChangeRadioStation(GetPlayerVehicleID(playerid), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1274603");
SendClientMessage(playerid, 0x178C4DAA, "Rбdio tunado na estaзгo 102.1FM - A sua rбdio Country, I-HA!");
format(str, sizeof(str), "%s leva sua mгo atй o painel do carro, ligando o rбdio.", pname);
SendLocalChat(playerid,0xD563E4AA,str,2.5);
format(str, sizeof(str), "%s aperta o botгo '1' no painel do rбdio, tunando na rбdio Country.", pname);
SendLocalChat(playerid,0xD563E4AA,str,2.5);
}
case 1:
{
ChangeRadioStation(GetPlayerVehicleID(playerid), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=2947897");
SendClientMessage(playerid, 0x178C4DAA, "Rбdio tunado na estaзгo 107.5FM - A rбdio POP do momento!");
format(str, sizeof(str), "%s leva sua mгo atй o painel do carro, ligando o rбdio.", pname);
SendLocalChat(playerid,0xD563E4AA,str,2.5);
format(str, sizeof(str), "%s aperta o botгo '2' no painel do rбdio, tunando na rбdio POP.", pname);
SendLocalChat(playerid,0xD563E4AA,str,2.5);
}
case 2:
{
ChangeRadioStation(GetPlayerVehicleID(playerid), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=616366");
SendClientMessage(playerid, 0x178C4DAA, "Rбdio tunado na estaзгo 103.2FM - Sua rбdio de RAP!");
format(str, sizeof(str), "%s leva sua mгo atй o painel do carro, ligando o rбdio.", pname);
SendLocalChat(playerid,0xD563E4AA,str,2.5);
format(str, sizeof(str), "%s aperta o botгo '3' no painel do rбdio, tunando na rбdio de RAP.", pname);
SendLocalChat(playerid,0xD563E4AA,str,2.5);
}
case 3:
{
ChangeRadioStation(GetPlayerVehicleID(playerid), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=37586");
SendClientMessage(playerid, 0x178C4DAA, "Rбdio tunado na estaзгo 109.4FM - ROCK EVERYDAY!");
format(str, sizeof(str), "%s leva sua mгo atй o painel do carro, ligando o rбdio.", pname);
SendLocalChat(playerid,0xD563E4AA,str,2.5);
format(str, sizeof(str), "%s aperta o botгo '4' no painel do rбdio, tunando na rбdio de Rock.", pname);
SendLocalChat(playerid,0xD563E4AA,str,2.5);
}
case 4:
{
ChangeRadioStation(GetPlayerVehicleID(playerid), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1177953");
SendClientMessage(playerid, 0x178C4DAA, "Rбdio tunado na estaзгo 106.6FM - LET'S PARTY!");
format(str, sizeof(str), "%s leva sua mгo atй o painel do carro, ligando o rбdio.", pname);
SendLocalChat(playerid,0xD563E4AA,str,2.5);
format(str, sizeof(str), "%s aperta o botгo '5' no painel do rбdio, tunando na rбdio Eletrфnica.", pname);
SendLocalChat(playerid,0xD563E4AA,str,2.5);
}
case 5:
{
ChangeRadioStation(GetPlayerVehicleID(playerid), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280610");
SendClientMessage(playerid, 0x178C4DAA, "Rбdio tunado na estaзгo 101.6FM - HEAVY METAL FOREVER!");
format(str, sizeof(str), "%s leva sua mгo atй o painel do carro, ligando o rбdio.", pname);
SendLocalChat(playerid,0xD563E4AA,str,2.5);
format(str, sizeof(str), "%s aperta o botгo '6' no painel do rбdio, tunando na rбdio de Heavy Metal.", pname);
SendLocalChat(playerid,0xD563E4AA,str,2.5);
}
}
}
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
stock SendLocalChat(playerid,color,msg[],Float:radius)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
for(new ply;ply<MAX_PLAYERS;ply++)
{
if(IsPlayerInRangeOfPoint(ply,radius,x,y,z))
SendClientMessage(ply,color,msg);
}
return 1;
}
stock ChangeRadioStation(carid, const url[])
{
format(Radio[carid],strlen(url), url);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(GetPlayerVehicleID(i) == carid)
{
StopAudioStreamForPlayer(i);
PlayAudioStreamForPlayer(i, Radio[carid]);
}
}
}