Message spamming - 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: Message spamming (
/showthread.php?tid=435874)
Message spamming -
Face9000 - 09.05.2013
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;
}
Re: Message spamming -
Jefff - 09.05.2013
pawn Код:
public Estrazione()
{
numerofortunato = random(50);
new str[128];
static WinnerID[MAX_PLAYERS];
new Winners = 0;
for(new i=0; i != MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
if(Biglietto[i] == numerofortunato)
{
WinnerID[Winners++] = i;
vincita = VINCITABASE+random(VINCITAEXTRA);
GivePlayerMoney(i,vincita);
format(str, sizeof(str), "Won at ~r~lottery~w~! (~g~%d ~w~CSCash)!",vincita);
GameTextForPlayer(i,str,5000,4);
}
Biglietto[i] = 0;
}
if(Winners > 0)
{
new echo[128];
for(new i=0,playerid=WinnerID[0]; i < Winners; i++,playerid=WinnerID[i])
{
GetPlayerName(playerid,nome,MAX_PLAYER_NAME);
format(str,sizeof(str),"[LOTTO]: {8CE46C}%s (%d){FFFFFF} won the lottery! {C14124}(%d CSCash){FFFFFF} - Winning number: {C14124}%d{FFFFFF}",nome,playerid,vincita,numerofortunato);
format(echo,sizeof(echo),"04,01[LOTTO]: %s (%d) won the lottery! (%d CSCash) - Winning number: %d",nome,playerid,vincita,numerofortunato);
SCMTA(-1,str);
IRC_GroupSay(gGroupID, IRC_CHANNEL, echo);
IRC_GroupSay(gGroupID, IRC_ACHANNEL, echo);
}
SCMTA(-1, "** Another lotto draw in {8CE46C}5 minutes.");
}
else
{
format(str,sizeof(str),"[LOTTO]: For this draw lucky ticket number was: {C14124}%d{FFFFFF} - Nobody won -",numerofortunato);
SCMTA(-1,str);
format(str,sizeof(str),"04,01[LOTTO]: For this draw lucky ticket number was: %d - Nobody won -",numerofortunato);
IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
IRC_GroupSay(gGroupID, IRC_ACHANNEL, str);
SCMTA(-1,"** Another lotto draw in {8CE46C}5 minutes.");
}
return 1;
}
Re: Message spamming -
Face9000 - 09.05.2013
Thank you.