#1

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?
Reply
#2

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.
Reply
#3

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.
Reply
#4

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.
Reply
#5

Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
StopAudioStreamForPlayer(playerid);
return 1;
}
Reply
#6

Any?
Reply
#7

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)");
    }
}
Reply
#8

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];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)