Why does it spam this message -
ShawnMiller1337 - 02.02.2012
Why does it spam the USS Seawolf Message 20 times in game ?
pawn Код:
CMD:tacticalnuke(playerid, params[])
{
if(PlayerInfo[playerid][pMember] == 11 || PlayerInfo[playerid][pLeader] == 11)
{
new Float: pos[3];
new string[128];
new Float:aX, Float:aY, Float:aZ;
GetPlayerPos(playerid, aX, aY, aZ);
if(sscanf(params, "fff", pos[0], pos[1], pos[2])) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /tacticalnuke [x coordinate] [y coordinate] [z coordinate]");
foreach(Player, i)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, -3130.6731,75.3724,1501.5393))
{
format(string, sizeof(string), "A Tactical Nuke has been launched from the USS Seawolf");
SendRadioMessage(1, DEPTRADIO, string);
SendRadioMessage(2, DEPTRADIO, string);
SendRadioMessage(3, DEPTRADIO, string);
SendRadioMessage(5, DEPTRADIO, string);
SendRadioMessage(7, DEPTRADIO, string);
SendRadioMessage(11, DEPTRADIO, string);
SendRadioMessage(13, DEPTRADIO, string);
CreateExplosion(pos[0], pos[1], pos[2]+20, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+21, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+22, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+23, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+24, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+25, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+26, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+27, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+28, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+29, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+30, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+30, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+30, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+30, 7, 1000);
PlayAudioStreamForPlayer(i, "http://k003.kiwi6.com/hotlink/7fn9uqt6b4/modern_warfare_2_tactical_nuke_sound.mp3", aX, aY, aZ, 10, 1);
}
}
}
return 1;
}
Re: Why does it spam this message -
Rokzlive - 02.02.2012
When you do:
foreach(Player, i)
Your creating a loop for all players, thus making the message send for each player.
Put the message outside the loop, and it will solve it.
Re: Why does it spam this message -
ShawnMiller1337 - 02.02.2012
I'm possibly doing something wrong lol
pawn Код:
CMD:tacticalnuke(playerid, params[])
{
if(PlayerInfo[playerid][pMember] == 11 || PlayerInfo[playerid][pLeader] == 11)
{
new Float: pos[3];
new string[128];
new Float:aX, Float:aY, Float:aZ;
GetPlayerPos(playerid, aX, aY, aZ);
if(sscanf(params, "fff", pos[0], pos[1], pos[2])) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /tacticalnuke [x coordinate] [y coordinate] [z coordinate]");
if(IsPlayerInRangeOfPoint(playerid, 2.0, -3130.6731,75.3724,1501.5393))
{
foreach(Player, i)
{
CreateExplosion(pos[0], pos[1], pos[2]+20, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+21, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+22, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+23, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+24, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+25, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+26, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+27, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+28, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+29, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+30, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+30, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+30, 7, 1000);
CreateExplosion(pos[0], pos[1], pos[2]+30, 7, 1000);
PlayAudioStreamForPlayer(i, "http://k003.kiwi6.com/hotlink/7fn9uqt6b4/modern_warfare_2_tactical_nuke_sound.mp3", aX, aY, aZ, 10, 1);
}
format(string, sizeof(string), "A Tactical Nuke has been launched from the USS Seawolf");
SendRadioMessage(1, DEPTRADIO, string);
SendRadioMessage(2, DEPTRADIO, string);
SendRadioMessage(3, DEPTRADIO, string);
SendRadioMessage(5, DEPTRADIO, string);
SendRadioMessage(7, DEPTRADIO, string);
SendRadioMessage(11, DEPTRADIO, string);
SendRadioMessage(13, DEPTRADIO, string);
}
}
}
return 1;
}
Re: Why does it spam this message -
ShawnMiller1337 - 02.02.2012
Anyone ?
Respuesta: Why does it spam this message -
Jovanny - 02.02.2012
pawn Код:
CMD:tacticalnuke(playerid, params[])
{
if(PlayerInfo[playerid][pMember] == 11 || PlayerInfo[playerid][pLeader] == 11)
{
new Float: pos[3];
new string[128];
new Float:aX, Float:aY, Float:aZ;
GetPlayerPos(playerid, aX, aY, aZ);
if(sscanf(params, "fff", pos[0], pos[1], pos[2])) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /tacticalnuke [x coordinate] [y coordinate] [z coordinate]");
if(IsPlayerInRangeOfPoint(playerid, 2.0, -3130.6731,75.3724,1501.5393))
{
for(new i=20;i<31;i++)
CreateExplosion(pos[0], pos[1], pos[2]+i, 7, 1000);
PlayAudioStreamForPlayer(i, "http://k003.kiwi6.com/hotlink/7fn9uqt6b4/modern_warfare_2_tactical_nuke_sound.mp3", aX, aY, aZ, 10, 1);
format(string, sizeof(string), "A Tactical Nuke has been launched from the USS Seawolf");
SendRadioMessage(1, DEPTRADIO, string);
SendRadioMessage(2, DEPTRADIO, string);
SendRadioMessage(3, DEPTRADIO, string);
SendRadioMessage(5, DEPTRADIO, string);
SendRadioMessage(7, DEPTRADIO, string);
SendRadioMessage(11, DEPTRADIO, string);
SendRadioMessage(13, DEPTRADIO, string);
}
}
}
return 1;
}
Re: Why does it spam this message -
ShawnMiller1337 - 02.02.2012
Didn't work it still spams
Respuesta: Why does it spam this message -
Jovanny - 02.02.2012
post the SendRadioMessage function here
Re: Why does it spam this message -
ShawnMiller1337 - 02.02.2012
pawn Код:
public SendRadioMessage(member, color, string[])
{
foreach(Player, i)
{
if(PlayerInfo[i][pMember] == member)
{
SendClientMessageEx(i, color, string);
}
}
}
Respuesta: Why does it spam this message -
Jovanny - 02.02.2012
pawn Код:
CMD:tacticalnuke(playerid, params[])
{
if(PlayerInfo[playerid][pMember] == 11 || PlayerInfo[playerid][pLeader] == 11)
{
new Float: pos[3];
new Float:aX, Float:aY, Float:aZ;
GetPlayerPos(playerid, aX, aY, aZ);
if(sscanf(params, "fff", pos[0], pos[1], pos[2])) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /tacticalnuke [x coordinate] [y coordinate] [z coordinate]");
for(new i=20;i<31;i++)
CreateExplosion(pos[0], pos[1], pos[2]+i, 7, 1000);
foreach(Player,d)
{
if(IsPlayerInRangeOfPoint(d, 2.0, -3130.6731,75.3724,1501.5393))
{
PlayAudioStreamForPlayer(d, "http://k003.kiwi6.com/hotlink/7fn9uqt6b4/modern_warfare_2_tactical_nuke_sound.mp3", aX, aY, aZ, 10, 1);
}
}
SendRadioMessage(1, DEPTRADIO, "A Tactical Nuke has been launched from the USS Seawolf");
SendRadioMessage(2, DEPTRADIO, "A Tactical Nuke has been launched from the USS Seawolf");
SendRadioMessage(3, DEPTRADIO, "A Tactical Nuke has been launched from the USS Seawolf");
SendRadioMessage(5, DEPTRADIO, "A Tactical Nuke has been launched from the USS Seawolf");
SendRadioMessage(7, DEPTRADIO, "A Tactical Nuke has been launched from the USS Seawolf");
SendRadioMessage(11, DEPTRADIO, "A Tactical Nuke has been launched from the USS Seawolf");
SendRadioMessage(13, DEPTRADIO, "A Tactical Nuke has been launched from the USS Seawolf");
}
return 1;
}
Re: Why does it spam this message -
Mafiya - 23.02.2012
You forgot to return false.
Код:
stock SendJobMessage(member,color,string[])
{
foreach (Player,i)
{
if(PlayerInfo[i][pJob] == member)
{
SendClientMessage(i,color,string);
}
}
return 0;
}