14.01.2011, 16:52
Well I don't know what's the problem with my code.
If I'm the only one on my server, I hear the audio file which I suppose to hear (Audio Plugin).
As soon as somebody else connects to my server, I can't hear anything.
This is my function which I call on my cmd:
And this is a timer which getting called each 0.1 seconds:
If there is another player in my server, it prints automaticly after "Siren started volume 0", "Siren stopped for you".
I posted it here because I don't think the problem is with the plugin.
Does anybody knows what's the problem here?
If I'm the only one on my server, I hear the audio file which I suppose to hear (Audio Plugin).
As soon as somebody else connects to my server, I can't hear anything.
This is my function which I call on my cmd:
Код:
forward Siren(playerid);
public Siren(playerid)
{
new Float: pPos[3][2];
GetPlayerPos(playerid, pPos[0][0], pPos[1][0], pPos[2][0]);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && !IsPlayerNPC(i))
{
if(siren[playerid] == 0)
{
//GetPlayerPos(i, pPos[0][1], pPos[1][1], pPos[2][1]);
pPos[0][1] = -1935.770019;
pPos[1][1] = 228.789993;
pPos[2][1] = 34.156250;
soundID_siren[i] = Audio_Play(i, 1, false, true, false);
//Audio_SetVolume(i, soundID_siren[i], 0);
siren[playerid] = 1;
SendClientMessage(i,0xFFFFFFAA,"Siren started volumu 0");
}
else if(siren[playerid] == 1)
{
for(new j=0; j<MAX_PLAYERS; j++)
{
if(IsPlayerConnected(j) && !IsPlayerNPC(j))
{
Audio_Stop(j,soundID_siren[j]);
SendClientMessage(j,0xFFFFFFAA,"Siren stopped for you");
}
}
siren[playerid] = 0;
}
}
}
return 1;
}
Код:
forward AudioUpdate();
public AudioUpdate()
{
new Float: pPos[3][2];
new string[256];
for(new j=0; j<MAX_PLAYERS; j++)
{
if(siren[j] == 1) // check if soembody has his siren On
{
pPos[0][0] = -1935.770019;
pPos[1][0] = 228.789993;
pPos[2][0] = 34.156250;
//GetPlayerPos(j, pPos[0][0], pPos[1][0], pPos[2][0]);
for(new i=0; i<MAX_PLAYERS; i++)//
{
if(IsPlayerConnected(i) && !IsPlayerNPC(i))
{
if(IsPlayerInRangeOfPoint(i, 100.0, pPos[0][0], pPos[1][0], pPos[2][0]))
{
GetPlayerPos(i, pPos[0][1], pPos[1][1], pPos[2][1]);
new distance = 100 - floatround(floatsqroot(floatpower(floatabs(pPos[0][1] - pPos[0][0]), 2) + floatpower(floatabs(pPos[1][1] - pPos[1][0]), 2) + floatpower(floatabs(pPos[2][1] - pPos[2][0]), 2)), floatround_ceil);
format(string, sizeof(string), "Distance: %d", distance);
SendClientMessage(i,0xFFFFFFAA,string);
Audio_SetVolume(i, soundID_siren[i], distance);
Audio_Resume(i, soundID_siren[i]);
return 1;
}
else
{
Audio_SetVolume(i, soundID_siren[i], 0);
Audio_Pause(i, soundID_siren[i]);
return 1;
}
}
}
}
}
return 1;//the value what function returning
}
I posted it here because I don't think the problem is with the plugin.
Does anybody knows what's the problem here?

