Combining two OnPlayerText things - 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)
+--- Thread: Combining two OnPlayerText things (
/showthread.php?tid=416786)
Combining two OnPlayerText things -
Goldino - 18.02.2013
Hey guys, I'm trying to combine this:
Код:
public OnPlayerText(playerid, text[])
{
if ( !IsPlayerConnected( playerid ) )
return 0;
new string[128];
format(string, sizeof(string), "%s[%d]: %s", GetName(playerid), playerid, text);
SendClientMessageToAll(-1, string);
for(new d; d<sizeof(Filter); d++)
if(strfind(text,Filter[d],true) != -1)
{
SendClientMessage(playerid,RED,"Censored word. Don't use those words in the main chat.");
return 0;
}
return 0;
}
Код:
public OnPlayerText( playerid, text[ ] )
{
if ( text[ 0 ] == '@' && pInfo[ playerid ][ Adminlevel ] > 0 )
{
new str[ 128 ], pName[ MAX_PLAYER_NAME ];
GetPlayerName( playerid, pName, sizeof ( pName ) );
format( str, sizeof ( str ), "[ AdminChat ] %s [%d] : %s", pName, playerid, text[ 1 ] );
for ( new i, j = GetMaxPlayers( ); i < j; i ++ )
{
if ( pInfo[ i ][ AdminLevel ] > 0 )
SendClientMessage( i, -1, str );
}
}
return 0;
}
with that. But I keep getting 26 errors. Can you please help me combine it.
Re: Combining two OnPlayerText things -
DaRk_RaiN - 18.02.2013
Make sure everything is defined.
pawn Код:
public OnPlayerText(playerid, text[])
{
if ( !IsPlayerConnected( playerid ) )
return 0;
new string[128];
format(string, sizeof(string), "%s[%d]: %s", GetName(playerid), playerid, text);
SendClientMessageToAll(-1, string);
for(new d; d<sizeof(Filter); d++)
if(strfind(text,Filter[d],true) != -1)
{
SendClientMessage(playerid,RED,"Censored word. Don't use those words in the main chat.");
return 0;
}
if ( text[ 0 ] == '@' && pInfo[ playerid ][ Adminlevel ] > 0 )
{
new str[ 128 ], pName[ MAX_PLAYER_NAME ];
GetPlayerName( playerid, pName, sizeof ( pName ) );
format( str, sizeof ( str ), "[ AdminChat ] %s [%d] : %s", pName, playerid, text[ 1 ] );
for ( new i, j = GetMaxPlayers( ); i < j; i ++ )
{
if ( pInfo[ i ][ AdminLevel ] > 0 )
SendClientMessage( i, -1, str );
}
return 0;
}
return 0;
}