Message spamming
#1

I just made this simple lotto system, it works perfectly but i have a problem, it spams the winning/losing message. (I know the message is in a loop and thats why is spammed, but if i remove from it i have to define "playerid" and i dont know if it will work (can be bugged like showing winner name/id as 0):

pawn Код:
public Estrazione()
{
  numerofortunato=random(50);
  new a=0;
  for(new i=0;i<MAX_PLAYERS;i++)
  {
  if(Biglietto[i]==numerofortunato)
  {
  GetPlayerName(i,nome,sizeof(nome));
  vincita=VINCITABASE+random(VINCITAEXTRA);
  GivePlayerMoney(i,vincita);
  new j[128];
  format(j, sizeof(j), "Won at ~r~lottery~w~! (~g~%d ~w~CSCash)!",vincita);
  GameTextForPlayer(i,j,5000,4);
  a=1;
  }
  Biglietto[i]=0;
 if(a==1)
 {
 new stringa[200];
 format(stringa,sizeof(stringa),"[LOTTO]: {8CE46C}%s (%d){FFFFFF} won the lottery! {C14124}(%d CSCash){FFFFFF} - Winning number: {C14124}%d{FFFFFF}",nome,i,vincita,numerofortunato);
 SCMTA(-1,stringa);
 SCMTA(-1, "** Another lotto draw in {8CE46C}5 minutes.");
 new echo[200];
 format(echo,sizeof(echo),"04,01[LOTTO]: %s (%d) won the lottery! (%d CSCash) - Winning number: %d",nome,i,vincita,numerofortunato);
 IRC_GroupSay(gGroupID, IRC_CHANNEL, echo);
 IRC_GroupSay(gGroupID, IRC_ACHANNEL, echo);
 return 1;
 }
 else
 {
 new stringb[128];
 format(stringb,sizeof(stringb),"[LOTTO]: For this draw lucky ticket number was: {C14124}%d{FFFFFF} - Nobody won -",numerofortunato);
 SCMTA(-1,stringb);
 SCMTA(-1,"** Another lotto draw in {8CE46C}5 minutes.");
 new echoi[128];
 format(echoi,sizeof(echoi),"04,01[LOTTO]: For this draw lucky ticket number was: %d - Nobody won -",numerofortunato);
 IRC_GroupSay(gGroupID, IRC_CHANNEL, echoi);
 IRC_GroupSay(gGroupID, IRC_ACHANNEL, echoi);
 }
 }
 return 1;
}
Reply


Messages In This Thread
Message spamming - by Face9000 - 09.05.2013, 00:04
Re: Message spamming - by Jefff - 09.05.2013, 00:34
Re: Message spamming - by Face9000 - 09.05.2013, 11:06

Forum Jump:


Users browsing this thread: 4 Guest(s)