Radio - 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: Radio (
/showthread.php?tid=438751)
Radio -
edzis84 - 21.05.2013
Need help with making radio system.
I have command for turning on car radio and i want that anyone who enters car can hear my radio station.
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(cInfo[playerid][pPradio] == 4)
{
PlayAudioStreamForPlayer(playerid, "http://stream.europeanhitradio.com/%20(56%20kb)");
}
I know that this is wrong because there is that Playerid and radio works only for me, but how can i make that it works for everyone? like its attached to car?
Re: Radio -
FiniteSurvival - 21.05.2013
http://pastebin.com/CAjFrDHs
This might work, I'm not too sure as it's untested and doesn't fit with your enumeration names and whatnot.
Re: Radio -
edzis84 - 21.05.2013
Okay in this case radio will play in all cars with same ids. like in all cheetahs but how can i make that radio plays in only that one car.
Re: Radio -
Pottus - 21.05.2013
Just remember streaming audio for players can cause them lag even if they're radio is off in settings you should provide a command to toggle it off completely.
Re: Radio -
edzis84 - 21.05.2013
Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
StopAudioStreamForPlayer(playerid);
return 1;
}
Re: Radio -
edzis84 - 22.05.2013
Any?
Re: Radio -
Pottus - 22.05.2013
Quote:
Originally Posted by edzis84
Okay in this case radio will play in all cars with same ids. like in all cheetahs but how can i make that radio plays in only that one car.
|
There is a few ways, you could make an array to keep track of all your vehicle data for example.
pawn Код:
enum VINFO {
bool:HasRadio,
Float:VSpawnX,
Float:VSpawnY,
Float:VSpawnZ,
Float:VSpawnFA
Float:VFuel,
Float:VHealth
}
new gVehicleData[MAX_VEHICLES][VINFO];
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(cInfo[playerid][pPradio] == 4)
{
if(gVehicleData[vehicleid][HasRadio])
PlayAudioStreamForPlayer(playerid, "http://stream.europeanhitradio.com/%20(56%20kb)");
}
}
Re: Radio -
edzis84 - 22.05.2013
Yeah looks like i don't have proper car spawning script, so it would be nice if someone can help me to make it proper.
basically i got enums for carid and parking floats
and i spawn cars by this
Код:
CreateVehicle(cInfo[playerid][pCar],cInfo[playerid][vx],cInfo[playerid][vy],cInfo[playerid][vz],1,1,1,0);
here is enums
Код:
enum CarInfo
{
pCColor,
pCColor2,
pCar[max_owned],
Float:vx,
Float:vy,
Float:vz
}
Код:
new cInfo[MAX_PLAYERS][CarInfo];