ahoj sem viděl že tu nemate [TuT]tak ho sem hodím i s fs sem začátečnik tak nenadavejte když zkopírujete tut musíte odstranit napr.//maximalni počet hraču kteři si mohou //
#include
#undef MAX_PLAYERS
#define MAX_PLAYERS 25 [color=#40BF40]//maximalni počet hraču kteři si mohou naladit radio nechte 25//[/color]
forward PlayVehicleRadioForPlayer(playerid,online);
forward NonChangeRadio(playerid);
forward IsAVel(vehicleid);
forward HideStationTitle(playerid,numberid);
new VehRadio[MAX_VEHICLES];
new PassengerInCar[MAX_VEHICLES][8];
new bool:WaitForBuf[MAX_PLAYERS];
new PassengerSeat[MAX_PLAYERS];
new OldCar[MAX_PLAYERS];
enum params
{
Float:X,Float:Y,Title[64],URL[64]
};
new RadioParams[17][params] = {
{205.0,20.0,"Sofa FM: Xmas in Frisko","http://ice.somafm.com/xmasinfrisko"}, // 1
{200.0,20.0,"Sofa FM: Christmas Lounge","http://mp2.somafm.com:8000"}, //2
{220.0,20.0,"Sofa FM: Groove Salad","http://streamer-dtc-aa01.somafm.com:80/stream/1018"}, //3
{260.0,20.0,"Sofa FM: Lush","http://mp1.somafm.com:8800"}, //4
{205.0,20.0,"Sofa FM: Indie Pop Rocks","http://voxsc1.somafm.com:8090"}, //5
{235.0,20.0,"Sofa FM: Digitalis","http://voxsc1.somafm.com:8900"}, // 6
{225.0,20.0,"Sofa FM: 480 Minutes","http://mp1.somafm.com:8080"}, //7
{245.0,20.0,"Sofa FM: PopTron","http://voxsc1.somafm.com:2200"}, //8
{210.0,20.0,"Sofa FM: Sonic Universe","http://ice.somafm.com/sonicuniverse"}, //9
{230.0,20.0,"Sofa FM: Drone Zone","http://voxsc1.somafm.com:8014"}, //10
{195.0,20.0,"Sofa FM: Space Station Soma","http://ice.somafm.com/spacestation"}, //11
{200.0,20.0,"Sofa FM: Underground 80's","http://voxsc1.somafm.com:8880"}, //12
{220.0,20.0,"Sofa FM: Beat Blender","http://voxsc1.somafm.com:8384"}, //13
{220.0,20.0,"Sofa FM: Secret Agent","http://streamer-dtc-aa05.somafm.com:80/stream/1021"}, //14
{210.0,20.0,"Sofa FM: Suburbs of Goa","http://ice.somafm.com/suburbsofgoa"}, //15
{250.0,20.0,"Sofa FM: Covers","http://voxsc1.somafm.com:8700"}, //16
{270.0,20.0,"Radio Off","none"}[color=#808080] //17 //toto sou radia zde si mužete dat vlasni pomoci {250.0,20.0,"Sofa FM:a stranku radia zakončíte "}, //a čislo ktere nasleduje v tomto připadě 17 toto {270.0,20.0,"Radio Off","none"} //17 zmente na {270.0,20.0,"Radio Off","none"} //18 atd. a už nic se zde neda změnit//[/color]
};
new Text:StationText[17];
public OnFilterScriptInit()
{
print("----------------------------------");
print("FS Online Radio In Vehicles Loaded");
print("Author: bobo");
print("----------------------------------");
for(new i = 0; i < MAX_VEHICLES; i++)
{
VehRadio[i] = 2;
for(new s = 1; s < 8; s++) PassengerInCar[i][s] = INVALID_PLAYER_ID;
}
for(new t = 0; t < sizeof(StationText); t++)
{
StationText[t] = TextDrawCreate(RadioParams[t][X],RadioParams[t][Y],RadioParams[t][Title]);
TextDrawAlignment(StationText[t],0);
TextDrawBackgroundColor(StationText[t],0x000000ff);
TextDrawFont(StationText[t],2);
TextDrawLetterSize(StationText[t],0.4,1.6);
TextDrawColor(StationText[t],0x906010ff);
TextDrawSetOutline(StationText[t],1);
TextDrawSetProportional(StationText[t],2);
TextDrawSetShadow(StationText[t],1);
}
return 1;
}
public OnFilterScriptExit()
{
for(new t = 0; t < sizeof(StationText); t++) TextDrawDestroy(StationText[t]);
return 1;
}
public OnPlayerConnect(playerid)
{
WaitForBuf[playerid] = false;
OldCar[playerid] = INVALID_VEHICLE_ID;
PassengerSeat[playerid] = 0;
return 0;
}
public OnPlayerDisconnect(playerid)
{
if(OldCar[playerid] != INVALID_VEHICLE_ID) PassengerInCar[OldCar[playerid]][PassengerSeat[playerid]] = INVALID_PLAYER_ID;
return 0;
}
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
new veh = GetPlayerVehicleID(playerid);
if(IsAVel(veh)) return 0;
new seat = GetPlayerVehicleSeat(playerid);
if(seat != 0)
{
PassengerInCar[veh][seat] = playerid;
PassengerSeat[playerid] = seat;
OldCar[playerid] = veh;
}
PlayVehicleRadioForPlayer(playerid,VehRadio[veh]);
}
if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
{
new veh = GetPlayerVehicleID(playerid);
if(IsAVel(veh)) return 0;
StopAudioStreamForPlayer(playerid);
if(OldCar[playerid] != INVALID_VEHICLE_ID)
{
PassengerInCar[OldCar[playerid]][PassengerSeat[playerid]] = INVALID_PLAYER_ID;
OldCar[playerid] = INVALID_VEHICLE_ID;
}
}
return 0;
}
public PlayVehicleRadioForPlayer(playerid,online)
{
if(online == 0)
{
StopAudioStreamForPlayer(playerid);
TextDrawShowForPlayer(playerid,StationText[16]);
WaitForBuf[playerid] = true;
SetTimerEx("NonChangeRadio",5000,false,"i",playerid);
SetTimerEx("HideStationTitle",3500,false,"id",playerid,16);
return 1;
}
StopAudioStreamForPlayer(playerid);
PlayAudioStreamForPlayer(playerid,RadioParams[online - 1][url]);
TextDrawShowForPlayer(playerid,StationText[online - 1]);
WaitForBuf[playerid] = true;
SetTimerEx("NonChangeRadio",5000,false,"i",playerid);
SetTimerEx("HideStationTitle",3500,false,"id",playerid,online - 1);
return 1;
}
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
if(newkeys == KEY_ACTION)
{
if(!IsPlayerInAnyVehicle(playerid)) return 0;
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 0;
new veh = GetPlayerVehicleID(playerid);
if(IsAVel(veh)) return 0;
if(WaitForBuf[playerid]) return SendClientMessage(playerid,0xFF0000FF,"* You can't change radio. Wait for 5 seconds.");
VehRadio[veh]++;
if(VehRadio[veh] == 17) VehRadio[veh] = 0;
PlayVehicleRadioForPlayer(playerid,VehRadio[veh]);
for(new s = 1; s < 8; s++)
{
if(PassengerInCar[veh][s] != INVALID_PLAYER_ID) PlayVehicleRadioForPlayer(PassengerInCar[veh][s],VehRadio[veh]);
}
}
if(newkeys == 132)
{
if(!IsPlayerInAnyVehicle(playerid)) return 0;
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 0;
new veh = GetPlayerVehicleID(playerid);
if(IsAVel(veh)) return 0;
if(WaitForBuf[playerid]) return SendClientMessage(playerid,0xFF0000FF,"* You can't change radio. Wait for 5 seconds.");
VehRadio[veh]--;
if(VehRadio[veh] == -1) VehRadio[veh] = 16;
PlayVehicleRadioForPlayer(playerid,VehRadio[veh]);
for(new s = 1; s < 8; s++)
{
if(PassengerInCar[veh][s] != INVALID_PLAYER_ID) PlayVehicleRadioForPlayer(PassengerInCar[veh][s],VehRadio[veh]);
}
}
return 0;
}
public NonChangeRadio(playerid) return WaitForBuf[playerid] = false;
public HideStationTitle(playerid,numberid) return TextDrawHideForPlayer(playerid,StationText[numberid]);
public IsAVel(vehicleid)
{
new model = GetVehicleModel(vehicleid);
if(model == 481 || model == 509 || model == 510) return 1;
return 0;
}
//zbytek nechte jak je//