SA-MP Forums Archive
I can hear this wherever i am - 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: I can hear this wherever i am (/showthread.php?tid=123984)



I can hear this wherever i am - Torran - 28.01.2010

This is my code
pawn Code:
dcmd_alarm(playerid, params[])
{
    #pragma unused params
    if(Alarm[playerid] == 0)
    {
    SendClientMessage(playerid, RED, "Alarm Sounded");
    Alarm1 = SetTimerEx("AlarmTimer", 500, 1, "i", playerid);
    Alarm[playerid] = 1;
    }
    else if(Alarm[playerid] == 1)
    {
    SendClientMessage(playerid, RED, "Alarm Stopped");
    for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1059, 0.0, 0.0, 0.0);
    KillTimer(Alarm1);
    }
    return 1;
}

public AlarmTimer()
{
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -1875.7490,1781.4775,18.2344);
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -1886.0668,1794.2535,18.2363);
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -1886.2264,1768.5934,18.2294);
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -2096.9150,1794.0295,18.2363);
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -2097.1797,1768.4430,18.2344);
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -2017.5938,1779.0508,21.2500);
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -2017.6978,1768.3654,21.2533);
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -1951.2958,1768.4454,21.2500);
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -1951.3112,1779.2534,21.2533);
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -1963.1848,1773.7068,49.3231);

}
Them coords make it so everyone on the server can only hear the alarm when there on teh ship ( them coords )
But if i type /alarm, I can hear the alarm no matter where i am, When im nowhere near the ship,
Why is this and how to fix


Re: I can hear this wherever i am - WrathOfGenesis - 28.01.2010

Its a samp issue i beleive. I dont think the XYZ coords make any difference to the sound, it plays regardless. Try to make a timer using the following

pawn Code:
if ( IsPlayerInRangeOfPoint ( playerid , X , Y , Z , distance ) )
{
  // Play Sound
}
else
{
  // Stop Sound
}
Please correct me if im wrong about the XYZ coords not making any difference


Re: I can hear this wherever i am - Torran - 28.01.2010

Quote:
Originally Posted by WrathOfGenesis
Its a samp issue i beleive. I dont think the XYZ coords make any difference to the sound, it plays regardless. Try to make a timer using the following

pawn Code:
if ( IsPlayerInRangeOfPoint ( playerid , X , Y , Z , distance ) )
{
  // Play Sound
}
else
{
  // Stop Sound
}
The coords do work, Because i use it on my pd gate,
If i go next to the gate i hear it, if i walk away, the sound fades and eventually goes away,
But if i ran back to it, I hear it again, Any idea why this particular one dont work
Please correct me if im wrong about the XYZ coords not making any difference



Re: I can hear this wherever i am - WrathOfGenesis - 28.01.2010

I think different sound ids are affected and others arent. Once again though i may be wrong


Re: I can hear this wherever i am - Torran - 28.01.2010

Hmm, Anyone know wether this is true or false or whatever,
Or a solution? xd, Cause i need this alarm to be on the ship only, And fade if ur on certain areas


Re: I can hear this wherever i am - WrathOfGenesis - 28.01.2010

Try another alarm sound id if there is one?


Re: I can hear this wherever i am - Torran - 28.01.2010

Hmm, I couldnt find one, So i just used blips and a timer of 500 miliseconds to make it sound like one


Re: I can hear this wherever i am - WrathOfGenesis - 28.01.2010

any luck with that?


Re: I can hear this wherever i am - Torran - 28.01.2010

thats what im doing now:

in my code:
Quote:
Originally Posted by Torran
This is my code
pawn Code:
dcmd_alarm(playerid, params[])
{
    #pragma unused params
    if(Alarm[playerid] == 0)
    {
    SendClientMessage(playerid, RED, "Alarm Sounded");
    Alarm1 = SetTimerEx("AlarmTimer", 500, 1, "i", playerid);
    Alarm[playerid] = 1;
    }
    else if(Alarm[playerid] == 1)
    {
    SendClientMessage(playerid, RED, "Alarm Stopped");
    for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1059, 0.0, 0.0, 0.0);
    KillTimer(Alarm1);
    }
    return 1;
}

public AlarmTimer()
{
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -1875.7490,1781.4775,18.2344);
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -1886.0668,1794.2535,18.2363);
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -1886.2264,1768.5934,18.2294);
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -2096.9150,1794.0295,18.2363);
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -2097.1797,1768.4430,18.2344);
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -2017.5938,1779.0508,21.2500);
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -2017.6978,1768.3654,21.2533);
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -1951.2958,1768.4454,21.2500);
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -1951.3112,1779.2534,21.2533);
  for(new i; i<GetMaxPlayers(); i++) PlayerPlaySound(i, 1058, -1963.1848,1773.7068,49.3231);

}
Them coords make it so everyone on the server can only hear the alarm when there on teh ship ( them coords )
But if i type /alarm, I can hear the alarm no matter where i am, When im nowhere near the ship,
Why is this and how to fix



Re: I can hear this wherever i am - Torran - 28.01.2010

Ok i will