SA-MP Forums Archive
[HELP]How can i make /play play in car im using audio plugin and only in 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]How can i make /play play in car im using audio plugin and only in car (/showthread.php?tid=174688)



[HELP]How can i make /play play in car im using audio plugin and only in car - Lilcuete - 06.09.2010

How can i make /play play in the vehicle so only me and who ever is in the car can hear it.This is my code right now.
Code:
dcmd_play(playerid, params[])
{
	#pragma unused playerid
	new
		audioid,
		bool:downmix,
		bool:loop,
		bool:pause;
	if (sscanf(params, "dddd", audioid, pause, loop, downmix))
	{
		SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /play <audioid> <pause (0/1)> <loop (0/1)> <downmix (0/1)>");
		return 1;
	}
	/*for(new i; i<MAX_PLAYERS; i++)
	{
	if(IsPlayerConnected(i))
	{
	Audio_Play(i,audioid, pause, loop, downmix);  //Use i instead of playerid here
	}
	}*/
	new vehicleid = GetPlayerVehicleID(playerid);
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
    {
   	Audio_Play(playerid,audioid, pause, loop, downmix);  //Use i instead of playerid here
	return 1;

   }
I want to make it so like if the player dat does /play in the vehicle can hear it i want for the people dats in the vehicle with him can hear it also.Not just him.


Re: [HELP]How can i make /play play in car im using audio plugin and only in car - Lilcuete - 06.09.2010

Anyone??


Re: [HELP]How can i make /play play in car im using audio plugin and only in car - Lilcuete - 07.09.2010

BUMPED BEEN 1 DAY And still no reply damn.If someone can atleast reply with some helpful answer i will appreciate it.


Re: [HELP]How can i make /play play in car im using audio plugin and only in car - miokie - 08.09.2010

Find the other people in the car by finding the vehicle ID from the driver and checking everybody in a loop, and if that vehicle id matchs up with them and they're a passenger play them the music.


Re: [HELP]How can i make /play play in car im using audio plugin and only in car - Lilcuete - 08.09.2010

Can you show me like what you mean like a example or something thanks.


Re: [HELP]How can i make /play play in car im using audio plugin and only in car - Lilcuete - 08.09.2010

BUMPED Been 1 day


Re: [HELP]How can i make /play play in car im using audio plugin and only in car - miokie - 09.09.2010

Get the vehicle the main player is driving:
Code:
new VehID = GetPlayerVehicleID(playerid);
Check who else is in the car that isn't the driver:
Code:
for(new i = 0; i < GetMaxPlayers(); i++ )
{
if(GetPlayerVehicleID(i) == VehID && GetPlayerVehicleSeat(i) != 0)
Play them the audio.
Code:
Audio_Play(i,audioid, pause, loop, downmix);
So to conclude:

Code:
new VehID = GetPlayerVehicleID(playerid);
for(new i = 0; i < GetMaxPlayers(); i++ )
{
    if(GetPlayerVehicleID(i) == VehID && GetPlayerVehicleSeat(i) != 0)
    {
        Audio_Play(i,audioid, pause, loop, downmix);
    }
}
That will play the audio to everybody but the driver that's in that vehicle.


Re: [HELP]How can i make /play play in car im using audio plugin and only in car - Lilcuete - 09.09.2010

So it wont play for the driver only passangers how can i make it play for driver and passangers?


Re: [HELP]How can i make /play play in car im using audio plugin and only in car - Lilcuete - 09.09.2010

Code:
dcmd_play(playerid, params[])
{
        #pragma unused playerid
        new
                audioid,
                bool:downmix,
                bool:loop,
                bool:pause;
        if (sscanf(params, "dddd", audioid, pause, loop, downmix))
        {
                SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /play <audioid> <pause (0/1)> <loop (0/1)> <downmix (0/1)>");
                return 1;
        }
        /*for(new i; i<MAX_PLAYERS; i++)
        {
        if(IsPlayerConnected(i))
        {
        Audio_Play(i,audioid, pause, loop, downmix);  //Use i instead of playerid here
        }
        }*/
    new VehID = GetPlayerVehicleID(playerid);
for(new i = 0; i < GetMaxPlayers(); i++ )
{
    if(GetPlayerVehicleID(i) == VehID && GetPlayerVehicleSeat(i) != 0)
    {
        Audio_Play(i,audioid, pause, loop, downmix);
        Audio_Play(playerid,audioid, pause, loop, downmix);
        }
    }
}
It doesnt work it says "Unknown command"


Re: [HELP]How can i make /play play in car im using audio plugin and only in car - Lilcuete - 10.09.2010

Quote:
Originally Posted by Lilcuete
View Post
Code:
dcmd_play(playerid, params[])
{
        #pragma unused playerid
        new
                audioid,
                bool:downmix,
                bool:loop,
                bool:pause;
        if (sscanf(params, "dddd", audioid, pause, loop, downmix))
        {
                SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /play <audioid> <pause (0/1)> <loop (0/1)> <downmix (0/1)>");
                return 1;
        }
        /*for(new i; i<MAX_PLAYERS; i++)
        {
        if(IsPlayerConnected(i))
        {
        Audio_Play(i,audioid, pause, loop, downmix);  //Use i instead of playerid here
        }
        }*/
    new VehID = GetPlayerVehicleID(playerid);
for(new i = 0; i < GetMaxPlayers(); i++ )
{
    if(GetPlayerVehicleID(i) == VehID && GetPlayerVehicleSeat(i) != 0)
    {
        Audio_Play(i,audioid, pause, loop, downmix);
        Audio_Play(playerid,audioid, pause, loop, downmix);
        }
    }
}
It doesnt work it says "Unknown command"
BUMPED it has been 1 day please try to respond to this new problem