Spamming message!
#1

Hello I've making a command for a robbing and After the robbing succesfuly they are spamming the message FORMAT

PHP код:
forward FourDragonRobbery();
public 
FourDragonRobbery()
{
         for(new 
i=0i<MAX_PLAYERSi++)
        {
            if(
IsPlayerConnected(i)) // checking if player connected
            
{
                
//ROBBERIES
                  
if(ROBBING_FourDragon[i] > 1// Checking if robbery time is above 1
                
{
                    
ROBBING_FourDragon[i] --; // Decreasing time
                    
new time[20]; //adding time variable
                      
format(time,sizeof(time),"%d",ROBBING_FourDragon[i]);
                      
TextDrawSetString(Textdraw494time);
                    
TextDrawShowForPlayer(iTextdraw492);
                    
TextDrawShowForPlayer(iTextdraw493);
                    
TextDrawShowForPlayer(iTextdraw494);
                    
TextDrawShowForPlayer(iTextdraw495);
                    
ApplyAnimation(i"ROB_BANK""CAT_Safe_Rob"4.1111111);
                }
                if(
ROBBING_FourDragon[i] == 1// IF the timer reached 1
                
{
                    new 
string[150], pName[MAX_PLAYER_NAME];// getting player name
                    
GetPlayerName(i,pName,MAX_PLAYER_NAME);
                    
SetPlayerWantedLevel(iGetPlayerWantedLevel(i) + 5); //giving player 5 wanted level
                    
SetPlayerColor(iCOLOR_ORANGE);
                    new 
mrand =random(200000);
                    
ROBBING_FourDragon[i] = 0// Complete the timer for next step!
                    
TextDrawHideForPlayer(iTextdraw494);
                    
format(string,sizeof(string),"[Four Dragon]: %s(%d) has robbed Four Dragon Casino and collect: $%d.",pName,i,mrand);
                    
SendClientMessageToAll(COLOR_REDstring);
                    
                    
ROBBING_FourDragon[i] = 1// Complete the timer for next step!
                     
SetPlayerRaceCheckpoint(i1750.7642,382.4462,23.1719,263.0588,0,02);
                     
SetTimer("FourDragonFinal",300000,true);
                    
TimeM 3;
                    
TimeS 0;
                    
Time SetTimer("UpdateTime"1000true);
                    
TextDrawShowForPlayer(iTextdraw494);
                }
            }
        }
        return 
1;

Reply
#2

Just get the formatted string outside the loop and you'll have no problems
Reply
#3

Try this

PHP код:
forward FourDragonRobbery();
public 
FourDragonRobbery()
{
    if(
IsPlayerConnected(i)) // checking if player connected
    
{
         
//ROBBERIES
           
if(ROBBING_FourDragon[i] > 1// Checking if robbery time is above 1
         
{
              
ROBBING_FourDragon[i] --; // Decreasing time
              
new time[20]; //adding time variable
            
format(time,sizeof(time),"%d",ROBBING_FourDragon[i]);
             
TextDrawSetString(Textdraw494time);
              
TextDrawShowForPlayer(iTextdraw492);
               
TextDrawShowForPlayer(iTextdraw493);
               
TextDrawShowForPlayer(iTextdraw494);
            
TextDrawShowForPlayer(iTextdraw495);
            
ApplyAnimation(i"ROB_BANK""CAT_Safe_Rob"4.1111111);
        }
          if(
ROBBING_FourDragon[i] == 1// IF the timer reached 1
        
{
             new 
string[150], pName[MAX_PLAYER_NAME];// getting player name
               
GetPlayerName(i,pName,MAX_PLAYER_NAME);
             
SetPlayerWantedLevel(iGetPlayerWantedLevel(i) + 5); //giving player 5 wanted level
              
SetPlayerColor(iCOLOR_ORANGE);
               new 
mrand =random(200000);
            
ROBBING_FourDragon[i] = 0// Complete the timer for next step!
            
TextDrawHideForPlayer(iTextdraw494);
            
format(string,sizeof(string),"[Four Dragon]: %s(%d) has robbed Four Dragon Casino and collect: $%d.",pName,i,mrand);
            
SendClientMessageToAll(COLOR_REDstring);
            
ROBBING_FourDragon[i] = 1// Complete the timer for next step!
               
SetPlayerRaceCheckpoint(i1750.7642,382.4462,23.1719,263.0588,0,02);
              
SetTimer("FourDragonFinal",300000,true);
            
TimeM 3;
             
TimeS 0;
              
Time SetTimer("UpdateTime"1000true);
               
TextDrawShowForPlayer(iTextdraw494);
           }
    }
    return 
1;

Reply
#4

this code is messed up, is this timer starts from ongamemodeinit or from where?
Reply
#5

Quote:
Originally Posted by N0FeaR
Посмотреть сообщение
Try this

PHP код:
forward FourDragonRobbery();
public 
FourDragonRobbery()
{
    if(
IsPlayerConnected(i)) // checking if player connected
    
{
         
//ROBBERIES
           
if(ROBBING_FourDragon[i] > 1// Checking if robbery time is above 1
         
{
              
ROBBING_FourDragon[i] --; // Decreasing time
              
new time[20]; //adding time variable
            
format(time,sizeof(time),"%d",ROBBING_FourDragon[i]);
             
TextDrawSetString(Textdraw494time);
              
TextDrawShowForPlayer(iTextdraw492);
               
TextDrawShowForPlayer(iTextdraw493);
               
TextDrawShowForPlayer(iTextdraw494);
            
TextDrawShowForPlayer(iTextdraw495);
            
ApplyAnimation(i"ROB_BANK""CAT_Safe_Rob"4.1111111);
        }
          if(
ROBBING_FourDragon[i] == 1// IF the timer reached 1
        
{
             new 
string[150], pName[MAX_PLAYER_NAME];// getting player name
               
GetPlayerName(i,pName,MAX_PLAYER_NAME);
             
SetPlayerWantedLevel(iGetPlayerWantedLevel(i) + 5); //giving player 5 wanted level
              
SetPlayerColor(iCOLOR_ORANGE);
               new 
mrand =random(200000);
            
ROBBING_FourDragon[i] = 0// Complete the timer for next step!
            
TextDrawHideForPlayer(iTextdraw494);
            
format(string,sizeof(string),"[Four Dragon]: %s(%d) has robbed Four Dragon Casino and collect: $%d.",pName,i,mrand);
            
SendClientMessageToAll(COLOR_REDstring);
            
ROBBING_FourDragon[i] = 1// Complete the timer for next step!
               
SetPlayerRaceCheckpoint(i1750.7642,382.4462,23.1719,263.0588,0,02);
              
SetTimer("FourDragonFinal",300000,true);
            
TimeM 3;
             
TimeS 0;
              
Time SetTimer("UpdateTime"1000true);
               
TextDrawShowForPlayer(iTextdraw494);
           }
    }
    return 
1;

Its not worked....

Quote:
Originally Posted by Mugalito
Посмотреть сообщение
this code is messed up, is this timer starts from ongamemodeinit or from where?
Missed up? what do you mean? I've adding everything

guys just help me wtih the Message its spamming ...
Reply
#6

PHP код:
ROBBING_FourDragon[i] = 1// Complete the timer for next step! 
If you are setting this variable INSIDE the loop, it will always be one (1), no wonder your message is spamming.
Reply
#7

Quote:
Originally Posted by GangstaSunny.
Посмотреть сообщение
PHP код:
ROBBING_FourDragon[i] = 1// Complete the timer for next step! 
If you are setting this variable INSIDE the loop, it will always be one (1), no wonder your message is spamming.
So I must do it ROBBING_FourDragon[i] = 0;?
Reply
#8

Код:
forward FourDragonRobbery();
public FourDragonRobbery()
{
        new TimerCompleted[MAX_PLAYERS];
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i)) // checking if player connected
            {
                //ROBBERIES
                  if(ROBBING_FourDragon[i] > 1) // Checking if robbery time is above 1
                {
                    ROBBING_FourDragon[i] --; // Decreasing time
                    new time[20]; //adding time variable
                      format(time,sizeof(time),"%d",ROBBING_FourDragon[i]);
                      TextDrawSetString(Textdraw494, time);
                    TextDrawShowForPlayer(i, Textdraw492);
                    TextDrawShowForPlayer(i, Textdraw493);
                    TextDrawShowForPlayer(i, Textdraw494);
                    TextDrawShowForPlayer(i, Textdraw495);
                    ApplyAnimation(i, "ROB_BANK", "CAT_Safe_Rob", 4.1, 1, 1, 1, 1, 1, 1);

                }
                if(ROBBING_FourDragon[i] == 1) // IF the timer reached 1
                {
                    SetPlayerWantedLevel(i, GetPlayerWantedLevel(i) + 5); //giving player 5 wanted level
                    SetPlayerColor(i, COLOR_ORANGE);
                    
                    ROBBING_FourDragon[i] = 0; // Complete the timer for next step!
                    TimerCompleted[i] = 1; //set this to 1 so we can call it back later
                    TextDrawHideForPlayer(i, Textdraw494);
                    
                    ROBBING_FourDragon[i] = 1; // Complete the timer for next step!
                     SetPlayerRaceCheckpoint(i, 1, 750.7642,382.4462,23.1719,263.0588,0,0, 2);
                     SetTimer("FourDragonFinal",300000,true);
                    TimeM = 3;
                    TimeS = 0;
                    Time = SetTimer("UpdateTime", 1000, true);
                    TextDrawShowForPlayer(i, Textdraw494);
                }
            }
        }
        if(TimerCompleted[playerid] == 1) 
        {
            new mrand =random(200000);
            new string[150], pName[MAX_PLAYER_NAME];// getting player name
            GetPlayerName(i,pName,MAX_PLAYER_NAME);
            format(string,sizeof(string),"[Four Dragon]: %s(%d) has robbed Four Dragon Casino and collect: $%d.",pName,i,mrand);
            SendClientMessageToAll(COLOR_RED, string);
        }
        return 1;
}
I'm not sure about this 'cause i couldn't look much at your script but i made something.
Reply
#9

and when FourDragonRobbery() <-- is called? or if it's timer, can u show me a timer code?
Reply
#10

hello, My problem is only here.. Spamming this message Did I place it in wrong place?

format(string,sizeof(string),"[Four Dragon]: %s(%d) has robbed Four Dragon Casino and collect: $%d.",pName,i,mrand);
SendClientMessageToAll(COLOR_RED, string);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)