Why is this not starting when i enter a car - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Why is this not starting when i enter a car (
/showthread.php?tid=356452)
Why is this not starting when i enter a car -
Euan Hughes - 03.07.2012
Well when you turn a car radio on and listen to something when in a car and then you get out of it and get back in it i want it to stay playing what you was just listening to.. It dont do that please help
pawn Код:
{
switch(listitem)
{
case 0:
{
new vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid)
{
for(new i; i < MAX_PLAYERS; ++i)
{
if(!IsPlayerConnected(i))continue;
if(IsPlayerInVehicle(i, vehicleid))
{
PlayAudioStreamForPlayer(i, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1504548");
CarMusicPlaying = 1;
}
}
}
}
case 1:
{
new vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid)
{
for(new i; i < MAX_PLAYERS; ++i)//foreach would be much better
{
if(!IsPlayerConnected(i))continue;
if(IsPlayerInVehicle(i, vehicleid))
{
PlayAudioStreamForPlayer(i, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283896");
CarMusicPlaying = 2;
}
}
}
}
}
}
pawn Код:
if(CarMusicPlaying == 1)
{
new playervehicleid = GetPlayerVehicleID(playerid);
if(playervehicleid)
{
for(new i; i < MAX_PLAYERS; ++i)
{
if(!IsPlayerConnected(i))continue;
if(IsPlayerInVehicle(i, playervehicleid))
{
PlayAudioStreamForPlayer(i, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1504548");
}
}
}
}
if(CarMusicPlaying == 2)
{
new pvehicleid = GetPlayerVehicleID(playerid);
if(pvehicleid)
{
for(new i; i < MAX_PLAYERS; ++i)//foreach would be much better
{
if(!IsPlayerConnected(i))continue;
if(IsPlayerInVehicle(i, pvehicleid))
{
PlayAudioStreamForPlayer(i, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283896");
}
}
}
}
If you need any more code just asks
Thanks
Re: Why is this not starting when i enter a car -
Euan Hughes - 03.07.2012
Please help me
Thanks