Raised This Month: $ Target: $400
 0% 

Solved Call messagemode with params


Post New Thread Reply   
 
Thread Tools Display Modes
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
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-28-2018 , 15:12   Re: Call messagemode with params
Reply With Quote #2

You can read the entire input with "read_args" and separate the arguments with "parse".
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 12-29-2018 , 05:35   Re: Call messagemode with params
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
You can read the entire input with "read_args" and separate the arguments with "parse".
Im reading it already (not sure what exactly you mean by saying entire).
__________________
Airkish is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 12-29-2018 , 06:04   Re: Call messagemode with params
Reply With Quote #4

Seems you are miss lead using register_clcmd function

Its function passed into it only 3 parameters id, level, cid. There is no such a parameter called inputfor

Inputfor should be a global user variable to determind which shop is the player using right now.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 12-29-2018 at 06:06.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-29-2018 , 06:28   Re: Call messagemode with params
Reply With Quote #5

You can use player_menu_info() to determine which menu is currently open and take action based on that, if it's possible to input those values only while those menus are open.
__________________

Last edited by klippy; 12-29-2018 at 06:28.
klippy is offline
eat1k
Senior Member
Join Date: Apr 2018
Old 12-29-2018 , 06:39   Re: Call messagemode with params
Reply With Quote #6

client_cmd(id, "messagemode iInput 1"); ?
__________________
eat1k is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 12-29-2018 , 06:49   Re: Call messagemode with params
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
Seems you are miss lead using register_clcmd function

Its function passed into it only 3 parameters id, level, cid. There is no such a parameter called inputfor

Inputfor should be a global user variable to determind which shop is the player using right now.
Oh ok, gonna use global variable.

Thanks everyone for contribution.
__________________
Airkish is offline
Reply



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