Problem with private admin chat - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with private admin chat (
/showthread.php?tid=182727)
Private admin chat does not work -
RenisiL - 12.10.2010
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?
Re: Problem with private admin chat -
RenisiL - 13.10.2010
***bump***
Re: Problem with private admin chat -
Rachael - 13.10.2010
try
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.