Raised This Month: $ Target: $400
 0% 

Solved Passing arguments to messagemode


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-17-2018 , 17:13   Passing arguments to messagemode
Reply With Quote #1

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_HandleridiMenuiItem )
{
    new 
szPlayerId], iAccessiItemCallback;
    
    
menu_item_getinfoiMenuiItemiAccessszPlayerIdcharsmaxszPlayerId ), __iItemCallback );
    
menu_destroyiMenu );
    
    new 
iTarget str_to_numszPlayerId );
    
    
log_to_file"sss.txt""#1" );
    
    if( ! 
is_user_connectediTarget ) )
    return 
PLUGIN_HANDLED;
    
    
log_to_file"sss.txt""#2" );
    
    new 
szName32 ];
    
get_user_nameiTargetszNamecharsmaxszName ) );
        
    
client_cmdid"messagemode suspendTime ^"%s^""szName );
    
    
log_to_file"sss.txt""#3" );
    return 
PLUGIN_CONTINUE;
}

public 
OnSuspendTimeid )
{
    
log_to_file"sss.txt""#4" );

    new 
szArgs192 ], szTarget32 ]
    
read_argsszArgscharsmaxszArgs ) );
    
remove_quotesszArgs );
    
    
read_argv1szTargetcharsmaxszTarget ) );
    
    
log_to_file"sss.txt""%s | %s | %s"szArgsszTargetszNum );
    
    if( ! 
is_str_numszArgs ) )
    {
        
client_print_coloridDontChange"^4[Suspend System] ^3You can't input letters." );
        return 
PLUGIN_HANDLED;
    }
    
    new 
iMinutes str_to_numszArgs );
    
    if( 
is_negative_numiMinutes ) )
    {
        
client_print_coloridDontChange"^4[Suspend System] ^3You can't input negative numbers." );
        return 
PLUGIN_HANDLED;
    }
    
    new 
iTarget find_player"a"szTarget );
    
    if( ! 
is_user_connectediTarget ) )
    return 
PLUGIN_HANDLED;
    
    
SuspendPlayeriTargetid );
    
SuspendSaveDataiTargetszTargetiMinutes );

    return 
PLUGIN_CONTINUE;

Any help is greatly appreciated, thanks!
__________________

Last edited by edon1337; 08-18-2018 at 06:49.
edon1337 is offline
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode