SA-MP Forums Archive
Car Sound - 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: Car Sound (/showthread.php?tid=532406)



Car Sound - SonicFreeStyle - 18.08.2014

Hey guys i'm trying to make a song sistem but i'm having some problems,i want to play a song on my car but i want to play for everyone who is next to me like a car sound you know,but how i can make the sound still on the car coordinates? i need to make the music play together with the car...i tried to make this command but he only gets 1 coordinate and play the song there...

pawn Код:
if(strcmp(cmd, "/testesong", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
        new currentveh;
        currentveh = GetPlayerVehicleID(playerid);
        new Float:songx, Float:songy, Float:songz;
        GetVehiclePos(currentveh, songx, songy, songz);
        new carid = currentveh;
        PlayAudioStreamForPlayer(i, "http://dc677.4shared.com/img/5007482591/6bd05747/dlink__2Fdownload_2FMu3VbE0vba_3Ftsid_3D20140818-034743-893bc92_26lgfp_3D1000_26dsid_3D6yh6k5.1f90f5deb1506f39a7c17a25a7b41710_26sbsr_3D9a428b511a77d6cb2fb3ff76834e7eb624d31b18f84a1c9d/preview.mp3",carid,carid,carid,20,1);
        }
        }
        return 1;
    }



Re: Car Sound - jidavid - 18.08.2014

You don't have to use coordinates. Use
Quote:

PlayAudioStreamForPlayer(i, "http://dc677.4shared.com/img/5007482591/6bd05747/dlink__2Fdownload_2FMu3VbE0vba_3Ftsid_3D20140818-034743-893bc92_26lgfp_3D1000_26dsid_3D6yh6k5.1f90f5deb150 6f39a7c17a25a7b41710_26sbsr_3D9a428b511a77d6cb2fb3 ff76834e7eb624d31b18f84a1c9d/preview.mp3");

and it will be playing everywhere.


Re: Car Sound - SonicFreeStyle - 19.08.2014

but i don't want this i want the song to play only near the car,like a real sound in the car :/


Re: Car Sound - SnG.Scot_MisCuDI - 19.08.2014

Quote:
Originally Posted by SonicFreeStyle
Посмотреть сообщение
but i don't want this i want the song to play only near the car,like a real sound in the car :/
EDIT: removed, proven wrong below.. hahaha


Re: Car Sound - SonicFreeStyle - 19.08.2014

but how? if i make a public or put this on a cmd the system only will take 1 place to put the music and i need the song on the car on everyplace :P


Re: Car Sound - Threshold - 19.08.2014

The thing with this is, the sound can only be played on one place at a time. You cannot currently 'attach' an audio stream to a vehicle and have it move around with the vehicle. Using loops is out of the question, because when using PlayAudioStreamForPlayer in succession just results in the stream being restarted over and over.

There currently is no effective way to do what you're asking, but you can produce and broadcast a live stream that allows players to hear the same music at the same time. Then simply play it when the player goes within a certain distance of the vehicle, then stop it when they move too far away.


Re: Car Sound - SonicFreeStyle - 19.08.2014

i was think the same,thanks ^^