SA-MP Forums Archive
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: Spamming (/showthread.php?tid=635070)



Spamming - Loinal - 31.05.2017

PHP код:
//OnGameModeInIT
SetTimer("SaveAllPlayerData",180000,1);
forward SaveAllPlayerData();
public 
SaveAllPlayerData()
{
    for (new 
0MAX_PLAYERSi++)
    {
        if( 
IsPlayerConnected) )
        {
            new 
query[600];
            
mysql_format(mysqlquerysizeof(query), "UPDATE `players` SET `IP` = '%e', `Admin` = %d, `Tokens` = %d, `Kills` = %d,`Deaths` = %d, `Score` = %d, `Money` = %d, `Hours` = %d,\
            `Minutes` = %d, `RaceWon` = %d WHERE `ID` = %d"
,
            
IP[i], pData[i][Admin], pData[i][Tokens], pData[i][Kills],pData[i][Deaths], GetPlayerScore(i),\
            
pData[i][Money], pData[i][pHours], pData[i][pMinutes],pData[i][RaceWon], pData[i][ID]);            
            
mysql_tquery(mysqlquery);
        }
        new 
str[128];
        
SendClientMessageToAll(0x009D00DB,"* Admin spork007 has saved your stats");
        
format(strsizeof(str),"* Admin spork007 has saved all online players stats");
        
IRC_GroupSay(groupIDIRC_CHANNELstr);
    }
    return 
1;

That spam the irc and the game


Re: Spamming - ShihabSoft - 31.05.2017

Ah isn't that obvious mate?

Just paste the message sending code outside the loop.

PHP код:

//After the FOR loop.
    
        
new str[128]; 
        
SendClientMessageToAll(0x009D00DB,"* Admin spork007 has saved your stats"); 
        
format(strsizeof(str),"* Admin spork007 has saved all online players stats"); 
        
IRC_GroupSay(groupIDIRC_CHANNELstr); 



Re: Spamming - Toroi - 31.05.2017

If both the SendClientMessageToAll and the IRC_GroupSay are inside the loop, the only logically outcome is for these functions to repeat themselves the amount of times the loop loops, right?