09.08.2012, 19:40
guys i need to make antispam command for /shout and /me commands so the player should stay 10 sec. till using them again also i need when the player use shout or me it appear with their job colour
guys i need to make antispam command for /shout and /me commands so the player should stay 10 sec. till using them again also i need when the player use shout or me it appear with their job colour
|
new ShoutTime[ MAX_PLAYERS ],
MeTime[ MAX_PLAYERS ]; // top
#define ME_TIME (10000) // 10 seconds at top
#define SHOUT_TIME (10000) // 10 seconds at top
CMD:me( playerid, params[ ] )
{
new szString[ 50 ];
format( szString, sizeof( szString ), "Wait for %i seconds before using it again!", ( MeTime[ playerid ] - GetTickCount( ) )/1000 );
if( MeTime[ playerid ] > GetTickCount( ) ) return SendClientMessage( playerid, -1, szString );
MeTime[ playerid ] = GetTickCount( ) + ME_TIME; // he can't do it in the next 10 seconds
if( isnull( params ) ) return SendClientMessage( playerid, -1, "Usage: /me [message]" );
new szStr[ 128 ], szPname[ MAX_PLAYER_NAME ];
GetPlayerName( playerid, szPname, sizeof( szPname ) );
format( szStr, sizeof( szStr ), "* %s %s", szPname, params );
SendClientMessageToAll( -1, szStr );
return 1;
}
CMD:shout( playerid, params[ ] )
{
new szString[ 50 ];
format( szString, sizeof( szString ), "Wait for %i seconds before using it again!", ( ShoutTime[ playerid ] - GetTickCount( ) )/1000 );
if( ShoutTime[ playerid ] > GetTickCount( ) ) return SendClientMessage( playerid, -1, szString );
ShoutTime[ playerid ] = GetTickCount( ) + SHOUT_TIME; // he can't do it in the next 10 seconds
if( isnull( params ) ) return SendClientMessage( playerid, -1, "Usage: /shout [message]" );
new szStr[ 128 ], szPname[ MAX_PLAYER_NAME ];
GetPlayerName( playerid, szPname, sizeof( szPname ) );
format( szStr, sizeof( szStr ), "* %s shouts %s", szPname, params );
SendClientMessageToAll( -1, szStr );
return 1;
}
i need it in scanf cause i have my own code so i need it in scanf to adpt in ma code
|
new ShoutTime[ MAX_PLAYERS ],
MeTime[ MAX_PLAYERS ]; // top
#define ME_TIME (10000) // 10 seconds at top
#define SHOUT_TIME (10000) // 10 seconds at top
CMD:me( playerid, params[ ] )
{
new szString[ 50 ];
format( szString, sizeof( szString ), "Wait for %i seconds before using it again!", ( MeTime[ playerid ] - GetTickCount( ) )/1000 );
if( MeTime[ playerid ] > GetTickCount( ) ) return SendClientMessage( playerid, -1, szString );
MeTime[ playerid ] = GetTickCount( ) + ME_TIME; // he can't do it in the next 10 seconds
new message[ 128 ];
if( sscanf( params, "s[128]", message ) ) return SendClientMessage( playerid, -1, "/me [message]" );
new szStr[ 128 ], szPname[ MAX_PLAYER_NAME ];
GetPlayerName( playerid, szPname, sizeof( szPname ) );
format( szStr, sizeof( szStr ), "* %s %s", szPname, message );
SendClientMessageToAll( -1, szStr );
return 1;
}
CMD:shout( playerid, params[ ] )
{
new szString[ 50 ];
format( szString, sizeof( szString ), "Wait for %i seconds before using it again!", ( ShoutTime[ playerid ] - GetTickCount( ) )/1000 );
if( ShoutTime[ playerid ] > GetTickCount( ) ) return SendClientMessage( playerid, -1, szString );
ShoutTime[ playerid ] = GetTickCount( ) + SHOUT_TIME; // he can't do it in the next 10 seconds
new message[ 128 ];
if( sscanf( params, "s[128]", message ) ) return SendClientMessage( playerid, -1, "Usage: /shout [message]" );
new szStr[ 128 ], szPname[ MAX_PLAYER_NAME ];
GetPlayerName( playerid, szPname, sizeof( szPname ) );
format( szStr, sizeof( szStr ), "* %s shouts %s", szPname, message );
SendClientMessageToAll( -1, szStr );
return 1;
}
C:\Users\joe\Desktop\pcash.pwn(302) : error 001: expected token: ";", but found "{"
C:\Users\joe\Desktop\pcash.pwn(325) : error 017: undefined symbol "MeTime" C:\Users\joe\Desktop\pcash.pwn(325) : error 029: invalid expression, assumed zero C:\Users\joe\Desktop\pcash.pwn(325) : error 029: invalid expression, assumed zero C:\Users\joe\Desktop\pcash.pwn(325) : fatal error 107: too many error messages on one line i use the me command only |
format( szString, sizeof( szString ), "Wait for %i seconds before using it again!", ( MeTime[ playerid ] - GetTickCount( ) )/1000 ); here is the line 325 ,, 302 is another error in ma code i will fix it
|
new MeTime[ MAX_PLAYERS ]; // top
#define ME_TIME (10000) // 10 seconds at top