Quote:
Originally Posted by Black Rose
You can. Just use read_args() and strbreak(), parse() or strtok() to single out the first argument from the rest.
|
Hm.. I just tried all this out, but i can't get it to work.. Nothing at all happens, it doesn't even seem to go to the Playerreport function when i type /report bla blablal.. I know why.. It is because "/report blablabla" isn't a command.. But i gotta make it one somehow, so it is a command whatever you type after the /report
Code:
PHP Code:
#include <amxmodx>
new const File[ ] = "addons/amxmodx/reportlog.txt"
public plugin_init( ) {
register_plugin( "Report Player", "1.0", "BuckShot" )
register_clcmd( "say /report", "PlayerReport" )
}
public PlayerReport( id )
{
new FullMsg[ 192 ], Reason[ 161 ], Name[ 32 ], WriteMsg[ 192 ]
read_args( FullMsg, 31 )
read_argv( 1, Name, 32 )
new len = sizeof( Name )
strbreak( FullMsg, Name, len, Reason, 160 )
formatex( WriteMsg, 192, "Player: %s\n Reason: %s", Name, Reason)
write_file( File, WriteMsg )
}
Edit: I gotta register_clcmd("say ", "PlayerReport" ) only, and check if contains /report? that could work
__________________