12.01.2013, 13:50
Hello. I wanted to make script that will play music for players near ceratin car and stop if they move out from that car.
Here is my code:
But it isn't working at all
Any ideas?
Here is my code:
Код:
new BusMuza;
public OnFilterScriptInit()
{
BusMuza = CreateVehicle(437,914.2512,-1692.9191,13.5017,179.9307,5,5, 5000);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
SetPVarInt(playerid, "Muzyka", 0);
SetPVarString(playerid, "BoomboxURL", "http://djmixes.radioparty.pl:8888/listen.pls");
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
new BusMuza;
if((vehicleid == BusMuza) && (GetPVarInt(forplayerid, "Muzyka") == 0)) {
SetPVarInt(forplayerid, "Muzyka", 1);
new streamurl[256];
GetPVarString(forplayerid, "BoomboxURL", streamurl, 256);
PlayAudioStreamForPlayer(forplayerid, streamurl);
return 1;
}
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
new BusMuza;
if((vehicleid == BusMuza) && (GetPVarInt(forplayerid, "Muzyka") == 1)) {
SetPVarInt(forplayerid, "Muzyka", 0);
StopAudioStreamForPlayer(forplayerid);
return 1;
}
return 1;
}
Any ideas?


And when he is gone away from that car the audio stream will stop