Audio Not working - 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: Audio Not working (
/showthread.php?tid=552840)
Audio Not working -
cyberlord - 26.12.2014
Hello need help with this code :
Код:
if (PRESSED(KEY_CTRL_BACK))
{
//if(PlayerInfo[playerid][JobID] == 15)
//{
if(IsPlayerInAnyVehicle(playerid))
{
for(new i=0; i<sizeof(PasienioCar); i++)
{
if(GetPlayerVehicleID(playerid) == PasienioCar[i])
{
if(UsedH[playerid] == false)
{
new Float:X, Float:Y, Float:Z, Float:Distance = 5.0;
GetPlayerPos(playerid, X, Y, Z);
PlayAudioStreamForPlayer(playerid, "http://127.0.0.1/siren/sound_011.wav", X, Y, Z, Distance, 1);
UsedH[playerid] = true;
}
else if(UsedH[playerid] == true)
{
StopAudioStreamForPlayer(playerid);
UsedH[playerid] = false;
}
}
}
}
//}
}
i have 17 cars ( my car variable is PasienioCar[0-16])that i want to play this file when i press H but its doesnt play anything
i have tested this with :
Код:
if(strcmp(cmdtext, "/play", true) == 0)
{
new Float:X, Float:Y, Float:Z, Float:Distance = 5.0;
GetPlayerPos(playerid, X, Y, Z);
PlayAudioStreamForPlayer(playerid, "http://127.0.0.1/siren/sound_011.wav", X, Y, Z, Distance, 1);
}
its working but if i get to the car and press h its not working , i think is about vehicle id but i dont know how to make work please help
Re: Audio Not working -
cyberlord - 26.12.2014
please tell my is this even possible to do ? cuz i make him work but i get stuck in other way and i think is impossible to to :
Код:
if (PRESSED(KEY_CTRL_BACK))
{
//if(PlayerInfo[playerid][JobID] == 15)
//{
//if(IsPlayerInAnyVehicle(playerid))
//{
//for(new i=0; i<sizeof(PasienioCar); i++)
//{
// Vehicleid[ playerid ] = GetPlayerVehicleID( playerid );
// Model[ playerid ] = GetVehicleModel( Vehicleid[ playerid ] );
//if(Model[playerid] == 424)
//{
if(UsedH[playerid] == false)
{
new Vehicleid2;
Vehicleid2 = GetPlayerVehicleID( playerid );
new Float:X, Float:Y, Float:Z, Float:Distance = 5.0,grojo;
GetVehiclePos(Vehicleid2, X, Y, Z);
grojo =0;
if(grojo == 0)
{
PlayAudioStreamForPlayer(playerid, "http://127.0.0.1/siren/sound_011.wav", X, Y, Z, Distance, 1);
grojo = 1;
}
sound11[playerid] = SetTimerEx("sirenos",3700,true,"d",playerid );
UsedH[playerid] = true;
}
else if(UsedH[playerid] == true)
{
KillTimer(sound11[playerid]);
UsedH[playerid] = false;
}
//}
//}
//}
//}
}
so first i need attach siren to car i am using getvehiclepos but this siren works only while i am in car , and if so position updates realy slow so if u drive fast after few seconds u wont hear sirens atleast u make distance realy high ,and this code has one problem that i set timer but here is still short interval between sound files and when sound file ends its gets quiet for about 100miliseconds or something so sound ist perffect like using H in police vehicles , and i am still stuck on car check so i just comment him to test is it works , so please give my some advides and how to that i am in right car