Problem with private admin chat
#1

hey, i made private admin chat, but does not work

stock:
Код:
AdminZinute( playerid, Spalva, string[] )
{
	foreach(Player, i) // Optimizuoti negalima
	{
		if( PlayerData[ playerid ][ AdminLevel ] !=3 )
		{
			SendClientMessage( i, Spalva, string );
		}
	}
	return true;
}
Код:
public OnPlayerText( playerid, text[] )
{	
	if( strcmp( "!" ,text[ 0 ], true, 1 ) == 0 )
	{
  	    if( PlayerData[ playerid ][ AdminLevel ] != 3 )
	    {
			new
			    Zinute[ 128 ],
			    string[ 20  ];
			    
	        CreateNameVariable( playerid, MAX_PLAYER_NAME, "Vardas" );
	        
			if( sscanf( text, "s[128]" ,Zinute ) ) return SendUsageText( playerid, " ! [Tavo Ћinutė] " );

		    format     ( string, sizeof( string ), "[%s]: %s" ,Vardas, Zinute[ 1 ] );
	  		AdminZinute( playerid, COLOR_MELYNA, string );
        }
		else
		{
			SendInfoText( playerid, " ADMIN Chatu naudotis gali tik ADMIN nariai" );
		}
		return true;
	}
	
	
    return true;
}
What is the problem?
Reply
#2

***bump***
Reply
#3

try
pawn Код:
if( text[ 0 ] == '!' )
also
pawn Код:
if( sscanf( text, "s[128]" ,Zinute ) ) return SendUsageText( playerid, " ! [Tavo Ћinutė] " );
can be simplified to
pawn Код:
// remove new Zinute[128];
if(strlen(text) < 2) return SendUsageText( playerid, " ! [Tavo Ћinutė] " );
//then you just use 'text' in the format instead of 'Zinute'
//if you don't want the '!' in the message, you will need to do more formatting
I also notice that the size of 'string' is only 20, you might want to make it at least 128
While you are checking things, look at changing return 1; to return 0; under OnPlayerText, that might make things work better.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)