Raised This Month: $ Target: $400
 0% 

Show description when menu item is pressed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 03-19-2017 , 19:16   Show description when menu item is pressed
Reply With Quote #1

Need to make that when menu key is pressed it would show description of that achievement

PHP Code:
public CmdAch(iPlayer

    new 
g_AchMenu menu_create("\wPasiekimai""Achievements_Handler"
     
    new 
Key[6
     
    for(new 
iAch 0iAch AchievesiAch++) 
    { 
        if(
Achievement[iPlayer][iAch] == 0formatex(szTempcharsmax(szTemp), "\d%s - [%d/%d]"AchName[iAch], Achievement[iPlayer][iAch], AchRequirement[iAch]) 
        else if(
Achievement[iPlayer][iAch] >= AchRequirement[iAch]) formatex(szTempcharsmax(szTemp), "\y%s \w- [\rĮVYKDYTAS\w]"AchName[iAch]) 
        else 
formatex(szTempcharsmax(szTemp), "\y%s \w- [\r%d\w/\r%d\w]"AchName[iAch], Achievement[iPlayer][iAch], AchRequirement[iAch]) 
        
menu_additem(g_AchMenuszTempKey
    } 
     
    
menu_setprop(g_AchMenuMPROP_EXITMEXIT_ALL
    
menu_display(iPlayerg_AchMenu0


public 
Achievements_Handler(iPlayerg_AchMenuitem)  
{  
    if(
item == MENU_EXIT)  
    {  
        
menu_destroy(g_AchMenu
        return 
PLUGIN_HANDLED  
    

    else 
    { 
        if(
Achievement[iPlayer][item] >= AchRequirement[item])  
        {  
            
ColorChat(iPlayerRED"Completed."
            
CmdAch(iPlayer);  
        }  
        else  
        {  
            
ColorChat(iPlayerRED"%s"AchDescription[iPlayer]) 
                       
CmdAch(iPlayer);  
        }  
    }  
    return 
PLUGIN_CONTINUE  

__________________
Airkish is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-19-2017 , 19:49   Re: Show description when menu item is pressed
Reply With Quote #2

So what's the problem?!
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 03-19-2017 , 20:43   Re: Show description when menu item is pressed
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
So what's the problem?!
The problem is that when I press any key I get same description.

EDIT: Stupid me
PHP Code:
ColorChat(iPlayerRED"%s"AchDescription[iPlayer]) 
->
PHP Code:
ColorChat(iPlayerRED"%s"AchDescription[item]) 
__________________

Last edited by Airkish; 03-19-2017 at 20:46.
Airkish is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-20-2017 , 04:27   Re: Show description when menu item is pressed
Reply With Quote #4

SmaLL optimize

Remove the if statments (item == menu_exit)
In the menu handler and destroy the menu directly since ur not saving any data
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 18:05.


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