This code gets logged up to #3, #4 never gets logged, no idea why.
What I've done is a menu that shows some player names, when you select one of them, you should get a messagemode showing:
<playername>: <yourinput>
from where:
<playername> - The name of the player which we selected on the menu (must be passed through somewhere)
<yourinput> - the value that we're going to set in the messagemode.
PHP Code:
public plugin_init( )
{
register_clcmd( "suspendTime", "OnSuspendTime" );
}
public OnSuspend_Handler( id, iMenu, iItem )
{
new szPlayerId[ 2 ], iAccess, iItemCallback;
menu_item_getinfo( iMenu, iItem, iAccess, szPlayerId, charsmax( szPlayerId ), _, _, iItemCallback );
menu_destroy( iMenu );
new iTarget = str_to_num( szPlayerId );
log_to_file( "sss.txt", "#1" );
if( ! is_user_connected( iTarget ) )
return PLUGIN_HANDLED;
log_to_file( "sss.txt", "#2" );
new szName[ 32 ];
get_user_name( iTarget, szName, charsmax( szName ) );
client_cmd( id, "messagemode suspendTime ^"%s^"", szName );
log_to_file( "sss.txt", "#3" );
return PLUGIN_CONTINUE;
}
public OnSuspendTime( id )
{
log_to_file( "sss.txt", "#4" );
new szArgs[ 192 ], szTarget[ 32 ]
read_args( szArgs, charsmax( szArgs ) );
remove_quotes( szArgs );
read_argv( 1, szTarget, charsmax( szTarget ) );
log_to_file( "sss.txt", "%s | %s | %s", szArgs, szTarget, szNum );
if( ! is_str_num( szArgs ) )
{
client_print_color( id, DontChange, "^4[Suspend System] ^3You can't input letters." );
return PLUGIN_HANDLED;
}
new iMinutes = str_to_num( szArgs );
if( is_negative_num( iMinutes ) )
{
client_print_color( id, DontChange, "^4[Suspend System] ^3You can't input negative numbers." );
return PLUGIN_HANDLED;
}
new iTarget = find_player( "a", szTarget );
if( ! is_user_connected( iTarget ) )
return PLUGIN_HANDLED;
SuspendPlayer( iTarget, id );
SuspendSaveData( iTarget, szTarget, iMinutes );
return PLUGIN_CONTINUE;
}
Any help is greatly appreciated, thanks!
__________________