Spamming
#1

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
Reply
#2

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); 
Reply
#3

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)