I'm tryng to make a plugin who block multiple prints( an user who prints more times the same text ).
Problem is acting in the next way: Is check and let first propozition(when i entry to server) THEN IT's BLOCKING Everything without scan, or is a wrong formating string message, i realy dunno...
Here's the code:
Code:
/*
Credits:
ConnorMcLeod - SayText code
Bugsy - string copy/formating for each client.
*/
#include <amxmodx>
new const PLUGIN[] = "Block Multiple Prints",
VERSION[] = "v0.1",
AUTHOR[] = "Craxor"
new gLastUserMessage[33][120], bool:StringCopied[33];
new const BlockMsg[] = "**** Multiple Prints Detected! ****";
public plugin_init( )
{
register_plugin
(
.plugin_name = PLUGIN,
.version = VERSION,
.author = AUTHOR
);
register_message(get_user_msgid("SayText"),"Message_SayText");
}
public client_putinserver( id )
{
StringCopied[ id ] = false;
gLastUserMessage[id][0] = EOS;
}
public Message_SayText(msgId,msgDest,msgEnt)
{
new Msg[65], id = get_msg_arg_int(1);
get_msg_arg_string(2, Msg, charsmax(Msg));
if( is_user_connected( id ) )
{
if( equal( Msg, gLastUserMessage[id] ) )
set_msg_arg_string(2, BlockMsg);
else
set_msg_arg_string(2, Msg );
if( StringCopied[ id ] == false )
{
copy( gLastUserMessage[id], charsmax( gLastUserMessage[] ), Msg );
StringCopied[ id ] = true;
}
else if( StringCopied[id] == true )
{
formatex( gLastUserMessage[id], charsmax( gLastUserMessage[] ), Msg );
}
}
}