))))) ну простите.
Вот код филтрсприпта, радио по идее должно играть для всех игроков, но играет лишь у одного. Пытался данный филтрскрипт вписать в мод, тоже самое, играет лишь у одного.
там есть и видео ролик к нему, помогите, прошу. Работает скрипт на отлично +, но лишь у одного, пробовал на разных серверах затестить, везде эта проблема.
pawn Код:
#include <a_samp>
#include <audio>
#undef MAX_PLAYERS
#define MAX_PLAYERS 100
main()
{
print("FS Online radio in cars loaded.");
print("Author: SDraw");
}
forward PlayVehicleRadioForPlayer(playerid,online,volume);
forward NonChangeRadio(playerid);
forward SetVolume(playerid,volume);
forward IsAVel(vehicleid);
new VehRadio[MAX_VEHICLES];
new PassengerInCar[MAX_VEHICLES][8];
new VehVolume[MAX_VEHICLES];
new HandleidForPlayer[MAX_PLAYERS];
new bool:WaitForBuf[MAX_PLAYERS];
new PassengerSeat[MAX_PLAYERS];
new OldCar[MAX_PLAYERS];
new Stations[10][2][32] = {
{"http://72.26.204.18:6006","DI Trance FM"},
{"http://85.214.146.14:8118","RS Culture FM"},
{"http://64.202.109.61:80","GotRadio"},
{"http://85.17.62.97:8036","Radio Totaal FM"},
{"http://74.63.47.82:8506","Street Lounge FM"},
{"http://213.133.120.70:8050","Techno4ever Radio"},
{"http://193.42.152.215:8018","Radio Redhill"},
{"http://46.105.109.142:9062","pLayTecH Studio"},
{"http://72.26.204.18:6696","Classic R&H Sky FM"},
{"http://194.50.90.55:10005","Real Wales Radio"}
};
public OnFilterScriptInit()
{
print("----------------------------------");
print("FS Online Radio In Vehicles Loaded");
print("Author: SDraw");
print("----------------------------------");
for(new i = 0; i < MAX_VEHICLES; i++)
{
VehRadio[i] = 2;
VehVolume[i] = 30;
for(new s = 1; s < 8; s++) PassengerInCar[i][s] = INVALID_PLAYER_ID;
}
return 1;
}
public OnPlayerConnect(playerid)
{
HandleidForPlayer[playerid] = 0;
WaitForBuf[playerid] = false;
OldCar[playerid] = INVALID_VEHICLE_ID;
return 0;
}
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
if(Audio_IsClientConnected(playerid))
{
new veh = GetPlayerVehicleID(playerid);
if(IsAVel(veh)) return 0;
if(HandleidForPlayer[playerid] == 0)
{
Audio_StopRadio(playerid);
new seat = GetPlayerVehicleSeat(playerid);
if(seat != 0)
{
PassengerInCar[veh][seat] = playerid;
PassengerSeat[playerid] = seat;
OldCar[playerid] = veh;
}
PlayVehicleRadioForPlayer(playerid,VehRadio[veh],VehVolume[veh]);
}
}
}
if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
{
if(Audio_IsClientConnected(playerid))
{
new veh = GetPlayerVehicleID(playerid);
if(IsAVel(veh)) return 0;
if(HandleidForPlayer[playerid] != 0)
{
Audio_Stop(playerid,HandleidForPlayer[playerid]);
HandleidForPlayer[playerid] = 0;
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,volume)
{
if(online == 0)
{
Audio_Stop(playerid,HandleidForPlayer[playerid]);
HandleidForPlayer[playerid] = 0;
GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~n~~g~Radio ~r~Off",3500,5);
WaitForBuf[playerid] = true;
SetTimerEx("NonChangeRadio",5000,false,"i",playerid);
return 1;
}
if(HandleidForPlayer[playerid] != 0)
{
Audio_Stop(playerid,HandleidForPlayer[playerid]);
HandleidForPlayer[playerid] = 0;
}
HandleidForPlayer[playerid] = Audio_PlayStreamed(playerid,Stations[online - 1][0],false,false,false);
Audio_SetVolume(playerid,HandleidForPlayer[playerid],volume);
new str[64];
format(str,sizeof(str),"~n~~n~~n~~n~~n~~n~~n~~g~Volume: ~y~%d%%~n~%s",volume,Stations[online - 1][1]);
GameTextForPlayer(playerid,str,3500,5);
WaitForBuf[playerid] = true;
SetTimerEx("NonChangeRadio",5000,false,"i",playerid);
return 1;
}
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
if(newkeys == KEY_ACTION)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(Audio_IsClientConnected(playerid))
{
new veh = GetPlayerVehicleID(playerid);
if(IsAVel(veh)) return 0;
if(WaitForBuf[playerid]) return SendClientMessage(playerid,0xFF0000FF,"* You can change radiostation after 5 second.");
VehRadio[veh]++;
if(VehRadio[veh] == 11) VehRadio[veh] = 0;
PlayVehicleRadioForPlayer(playerid,VehRadio[veh],VehVolume[veh]);
for(new s = 1; s < 8; s++)
{
if(PassengerInCar[veh][s] != INVALID_PLAYER_ID) PlayVehicleRadioForPlayer(PassengerInCar[veh][s],VehRadio[veh],VehVolume[veh]);
}
}
}
}
}
if(newkeys == 132)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(Audio_IsClientConnected(playerid))
{
new veh = GetPlayerVehicleID(playerid);
if(IsAVel(veh)) return 0;
if(WaitForBuf[playerid]) return SendClientMessage(playerid,0xFF0000FF,"* You can change radiostation after 5 second.");
VehRadio[veh]--;
if(VehRadio[veh] == -1) VehRadio[veh] = 10;
PlayVehicleRadioForPlayer(playerid,VehRadio[veh],VehVolume[veh]);
for(new s = 1; s < 8; s++)
{
if(PassengerInCar[veh][s] != INVALID_PLAYER_ID) PlayVehicleRadioForPlayer(PassengerInCar[veh][s],VehRadio[veh],VehVolume[veh]);
}
}
}
}
}
if(newkeys == KEY_ANALOG_UP)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(Audio_IsClientConnected(playerid))
{
new veh = GetPlayerVehicleID(playerid);
if(IsAVel(veh)) return 0;
if(VehVolume[veh] >= 0 && VehVolume[veh] < 100 && VehRadio[veh] != 0)
{
VehVolume[veh] += 5;
SetVolume(playerid,VehVolume[veh]);
for(new s = 1; s < 8; s++)
{
if(PassengerInCar[veh][s] != INVALID_PLAYER_ID) SetVolume(PassengerInCar[veh][s],VehVolume[veh]);
}
}
}
}
}
}
if(newkeys == KEY_ANALOG_DOWN)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(Audio_IsClientConnected(playerid))
{
new veh = GetPlayerVehicleID(playerid);
if(IsAVel(veh)) return 0;
if(VehVolume[veh] > 0 && VehVolume[veh] <= 100 && VehRadio[veh] != 0)
{
VehVolume[veh] -= 5;
SetVolume(playerid,VehVolume[veh]);
for(new s = 1; s < 8; s++)
{
if(PassengerInCar[veh][s] != INVALID_PLAYER_ID) SetVolume(PassengerInCar[veh][s],VehVolume[veh]);
}
}
}
}
}
}
return 0;
}
public SetVolume(playerid,volume)
{
Audio_SetVolume(playerid,HandleidForPlayer[playerid],volume);
new str[64];
format(str,sizeof(str),"~n~~n~~n~~n~~n~~n~~n~~n~~g~Volume: ~y~%d%%",volume);
GameTextForPlayer(playerid,str,3500,5);
return 1;
}
public NonChangeRadio(playerid)
{
WaitForBuf[playerid] = false;
return 1;
}
public IsAVel(vehicleid)
{
new model = GetVehicleModel(vehicleid);
if(model == 481 || model == 509 || model == 510) return 1;
return 0;
}