#1

i have a problem with timer

Code:
 SetTimer("RandBotMsgs", 3000, true);
And after the timer

Code:
new bmsgTDswitch;
forward RandBotMsgs();
public RandBotMsgs()
{
	bmsgTDswitch ++;
	switch(bmsgTDswitch)
	{
		case 1:
		{
		new string[130];
		format(string,sizeof(string),"Text 1");
		TextDrawSetString(Textdraw7,string);
		}
		case 2:
		{
		Topscore();
		}
		case 3:
		{
		Topcash();
		}
  	}
  	bmsgTDswitch = 0;
	return true;
}
But it only after i spawn it show Text 1 and not changing to the next
Reply
#2

Because it keeps getting reset to 0 at the end of RandBotMsgs.
Reply
#3

It work but not showing topcash also i want it when it reachs topcash it reset to the first textdraw
Reply
#4

Then you've to reset your bmsgTDswitch variable to zero under 3rd (or last) case. Post your Topcash() function here if it's not working.
Reply
#5

Ok it works also got onther thing

PHP Code:
stock Topscore()
{
    
mysql_tquery(mysql ,"SELECT Username,Score FROM players WHERE ID ORDER BY Score DESC LIMIT 1;""ShowBestScore","");
    return 
true;
}
forward ShowBestScore();
public 
ShowBestScore()
{
      new 
rows;
    
cache_get_row_count(rows);
    if(
rows)
    {
        new 
playername[35];
        new 
playerscore;
        new 
str[1303];
        
        
cache_get_value_index(00playername);
        
cache_get_value_name_int(0,"Score",playerscore);
        
cache_get_value_index_int(0,1playerscore);

        
format(strsizeof(str), "News: Player with the most score is~g~~h~ %s~w~ have (~r~~h~%d score~w~)~n~~n~"playernameplayerscore);
        
TextDrawSetString(Textdraw7,str);
        
TextDrawShowForAll(Textdraw7);
    }
    return 
1;
}
stock Topcash()
{
    
mysql_tquery(mysql ,"SELECT Username,Money FROM players WHERE ID ORDER BY Money LIMIT 1;""ShowBestCash","");
    return 
true;
}
forward ShowBestCash();
public 
ShowBestCash()
{
      new 
rows;
    
cache_get_row_count(rows);
    if(
rows)
    {
        new 
playername[35];
        new 
playermoney;
        new 
str[1303];

        
cache_get_value_index(00playername);
        
cache_get_value_name_int(0,"Money",playermoney);
        
cache_get_value_index_int(0,1playermoney);

        
format(strsizeof(str), "News:~g~~h~ %s~w~ Is the reachest player (~r~~h~%d cash~w~)~n~~n~"playernameplayermoney);
        
TextDrawSetString(Textdraw7,str);
        
TextDrawShowForAll(Textdraw7);
    }
    return 
1;

If i changed my cash or my score to onther thing it doesn't change
Reply
#6

Help?
Reply
#7

You should mysql-update your money/cash when you do so.
Reply
#8

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)