Raised This Month: $ Target: $400
 0% 

Solved Call messagemode with params


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 12-28-2018 , 15:01   Call messagemode with params
Reply With Quote #1

I have a fair amount of user inputs and creating new function for every input doesn't seem good (unless it's the only way).

So is there a way to call messagemode with params?

PHP Code:
register_clcmd("iInput""@InputInt"); 
//This what Im using atm
PHP Code:
@InputInt(id) {
    new 
szText[16];
    
read_args(szTextcharsmax(szText));
    
remove_quotes(szText);

    
g_ePlayerShop[id][Quantity] = str_to_num(szText);
    @
ShopMenu(idPAGE_ONE);
    return 
PLUGIN_HANDLED;

//I would like to have an extra param
PHP Code:
@InputInt(idInputFor) {
    new 
szText[16];
    
read_args(szTextcharsmax(szText));
    
remove_quotes(szText);

    switch(
InputFor) {
        case 
INPUT_SHOP: {
            
g_ePlayerShop[id][Quantity] = str_to_num(szText);
            @
ShopMenu(idPAGE_ONE);
        }
        case 
INPUT_GIFT: {
            
g_ePlayerGift[id][Quantity] = str_to_num(szText);
            @
GiftMenu(idPAGE_ONE);
        }
        case 
INPUT_MARKET: {
            
g_ePlayerMarket[id][Quantity] = str_to_num(szText);
            @
MarketMenu(idPAGE_ONE);
        }
    }
    
    return 
PLUGIN_HANDLED;

PHP Code:
//how do I set extra param here (if its even possible)?
client_cmd(id"messagemode iInput"); 
__________________

Last edited by Airkish; 12-29-2018 at 06:50.
Airkish is offline
 



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 07:32.


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