Raised This Month: $ Target: $400
 0% 

when more than requiet ?!!!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-14-2017 , 08:54   when more than requiet ?!!!
Reply With Quote #1

hi guys.

i have problem with level when a player have more than level requiet he can't get the less guns level
Example :

Infinity black[lvl:0]
Balrog-I[lvl:1]

when a player have level 0 he can take the infinity black but if he get level up he can't get it anymore he can get only Blarog-I can you help me here is the part of the code where this 2 :
PHP Code:
Pistols_submenuid )
{
    
menu menu_create"Pistols Menu""submenu_handler" );

    
menu_additemmenu"Infinity black[lvl:0]""")
    
menu_additemmenu"Blarog-I[lvl:3]""")
    
menu_additemmenu"Dual Infinity[lvl:5]""")

    
menu_displayidmenu)
}
public 
submenu_handleridmenuitem )
{
    switch( 
item )
    {
        case 
0:
        {
            if(
ITEM1[id])
            {
                
client_print(idprint_center"you already have Infinity Black")
            }
            else
            {
                if(
is_user_connectedid ) && ( g_iLevel[id] == ))
                {
                    
client_cmdid"get_infb" )
                }
            }
        }
        case 
1:
        {
            if(
ITEM2[id])
            {
                
client_print(idprint_center"you already have Blarog-I")
            }
            else
            {
                if( 
is_user_connectedid ) && ( g_iLevel[id] == ))
                {
                    
client_cmdid"get_b1" )
                }
            }
        }
        case 
2:
        {
            if(
ITEM3[id])
            {
                
client_print(idprint_center"you already have Dual Infinity")
            }
            else
            {
                if( 
is_user_connectedid ) && ( g_iLevel[id] == ))
                {
                    
client_cmdid"get_infiniy" )
                }
            }
        }
        case 
MENU_EXIT:
        {
            if( 
is_user_connectedid ) )
            
main_menuid );
        }
    }
    
menu_destroymenu );
    return 
PLUGIN_HANDLED;

P.S: btw this happen with all guns every lvl up can't get the gun before it :/.

Thanks for advance.

Last edited by yas17sin; 02-14-2017 at 08:55.
yas17sin is offline
Send a message via ICQ to yas17sin
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-14-2017 , 11:28   Re: when more than requiet ?!!!
Reply With Quote #2

do you know a person called farouk?

btw heres the solution ------->> g_iLevel[id] >= LEVEL_NUMBER

Last edited by Natsheh; 02-14-2017 at 11:31.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-14-2017 , 12:32   Re: when more than requiet ?!!!
Reply With Quote #3

Arab : la ana mab3ref had ismo farouk.

English : no i don't know someone called farouk.

btw Thanks m8.

EDIT : sorry i fixed it all thanks you so much.

Last edited by yas17sin; 02-14-2017 at 13:55.
yas17sin is offline
Send a message via ICQ to yas17sin
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-14-2017 , 14:07   Re: when more than requiet ?!!!
Reply With Quote #4

can i ask for one more thing i don't want to create a new post.

how i can make a menu show only for a periode of time ?.
yas17sin is offline
Send a message via ICQ to yas17sin
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-14-2017 , 14:17   Re: when more than requiet ?!!!
Reply With Quote #5

Quote:
Originally Posted by yas17sin View Post
can i ask for one more thing i don't want to create a new post.

how i can make a menu show only for a periode of time ?.
For a player or for all like a vote mmenu?


for a player..

PHP Code:

new bool:menu1_destroyed

show_menu
(idiTime)
{
    new 
sText[64]
    
formatex(sTextcharsmax(sText), "Random Menu^nClose's in %d Second's!"iTime)
    
    new 
menu menu_create(sText"menu_handler");
    
    
menu_additem(menu"item one")
    
menu_additem(menu"item two")
    
    
menu_display(idmenu)
    
    new 
sStr[3]; sStr[0] = iTimesStr[1] = id;
    
set_task(1.0"task_destroy_menu"menusStrcharsmax(sStr))
}

public 
menu_handler(idmenuitem)
{
    switch( 
item )
    {
        case 
0// item one chosen...
        
case 1// item two chosen...
        
case MENU_EXIT:
        {
            
menu1_destroyed true;
            
menu_destroy(menu)
            
remove_task(menu)
        }
    }
}

public 
task_destroy_menu(sStr[], iMenu)
{
    new 
iTime sStr[0] - 1;
    new 
id sStr[1]
    
    if(!
iTime)
    {
        
menu1_destroyed true;
        
menu_destroy(iMenu)
        return;
    }
    
    if(!
menu1_destroyed)
        
show_menu(idiTime)

__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 02-14-2017 at 14:52.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-14-2017 , 14:44   Re: when more than requiet ?!!!
Reply With Quote #6

it's level submenu.

EDIT : here is the part of menu where it's need the change i think :
PHP Code:
public playerSpawnid )
{
    
ITEM1id ] = false;
    
ITEM2id ] = false;
    
ITEM3id ] = false;
    
ITEM4id ] = false;
}
public 
main_menuid )
{
    if(!
is_user_aliveid ) && ( cs_get_user_team(id) == CS_TEAM_CT ))
    return;

    
menu menu_create"Weapon Menu""menu_handler" );
    
    
menu_additemmenu"Pistols Menu""")
    
menu_additemmenu"Shootguns Menu""")
    
menu_additemmenu"Assaults Menu """)
    
menu_additemmenu"Snipers Menu""")
    
menu_additemmenu"Machineguns Menu""")
    
menu_additemmenu"Knifes Menu """)
    
    
menu_displayidmenu);
}

public 
menu_handleridmenuitem )
{
    switch( 
item )
    {
        case 
0:
        {
            
Pistols_submenuid );
        }
        case 
1:
        {
            
Shootguns_submenuid );
        }
        case 
2:
        {
            
Assault_submenuid );
        }
        case 
3:
        {
            
Sniper_submenuid );
        }
        case 
4:
        {
            
Machinegun_submenuid );
        }
        case 
5:
        {
            
Knife_submenuid );
        }
        case 
MENU_EXIT:
        {
            
client_printidprint_center"Good Luck And Be a Pro CSO Player");
        }
    }
    
menu_destroymenu );
    return 
PLUGIN_HANDLED;
}
Pistols_submenuid )
{
    
menu menu_create"Pistols Menu""submenu_handler" );
    
    
menu_additemmenu"Infinity black[lvl:0]""")
    
menu_additemmenu"Blarog-I[lvl:3]""")
    
menu_additemmenu"Dual Infinity[lvl:5]""")
    
menu_additemmenu"Janus-1[LVL:10][ADMIN & VIP]"""ADMIN_CHAT )
    
    
menu_displayidmenu)
}
public 
submenu_handleridmenuitem )
{
    switch( 
item )
    {
        case 
0:
        {
            if(
ITEM1[id])
            {
                
client_print(idprint_center"You can't get 2 Pistols")
            }
            else
            {
                if(
is_user_connectedid ) && ( g_iLevel[id] >= ))
                {
                    
client_cmdid"get_infb" )
                    
ITEM1id ] = true;
                }
            }
        }
        case 
1:
        {
            if(
ITEM2[id])
            {
                
client_print(idprint_center"You can't get 2 Pistols")
            }
            else
            {
                if( 
is_user_connectedid ) && ( g_iLevel[id] >= ))
                {
                    
client_cmdid"get_b1" )
                    
ITEM5id ] = true;
                }
            }
        }
        case 
2:
        {
            if(
ITEM3[id])
            {
                
client_print(idprint_center"You can't get 2 Pistols")
            }
            else
            {
                if( 
is_user_connectedid ) && ( g_iLevel[id] >= ))
                {
                    
client_cmdid"get_infiniy" )
                    
ITEM3id ] = true;
                }
            }
        }
        case 
3:
        {
            if(
ITEM4[id])
            {
                
client_print(idprint_center"You can't get 2 Pistols")
            }
            else
            {
                if( 
is_user_connectedid ) && ( g_iLevel[id] >= 10 ))
                {
                    
client_cmd(id"get_j1")
                    
ITEM4id ] = true;
                }
            }
        }
        case 
MENU_EXIT:
        {
            if( 
is_user_connectedid ) )
            
main_menuid );
        }
    }
    
menu_destroymenu );
    return 
PLUGIN_HANDLED;

P.S : i am sorry of this alot of asking but i did use cs_get_user_team but it same doesn't work i can open menu even if iam a Terorist and also please help me with this because if i get a gun and i don't die in the round then the next round i can keep get another gun but i if i die and i respa<<n i can get gun and if i try to get another it work and block player from take another so please help.

Last edited by yas17sin; 02-14-2017 at 15:45.
yas17sin is offline
Send a message via ICQ to yas17sin
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-14-2017 , 15:04   Re: when more than requiet ?!!!
Reply With Quote #7

please help in previous reply i update it.
yas17sin is offline
Send a message via ICQ to yas17sin
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 02-14-2017 , 17:10   Re: when more than requiet ?!!!
Reply With Quote #8

Read the if statement and think about it. The one you have will return (not create the menu) if the user is dead AND is on Counter-Terrorist team. That means that if you are ONE of the following; terrorist, spectator, unassigned or alive you will get the menu no matter what else.
You probably want || and CS_TEAM_T.

I can't help you with the other stuff on my phone.
__________________

Last edited by Black Rose; 02-14-2017 at 17:11.
Black Rose is offline
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-14-2017 , 17:39   Re: when more than requiet ?!!!
Reply With Quote #9

okay thanks i be waiting for you when ever you are on pc. okay
yas17sin is offline
Send a message via ICQ to yas17sin
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 02-15-2017 , 05:35   Re: when more than requiet ?!!!
Reply With Quote #10

i see menu_destroy() used too often when not needed. i mean when you have a menu that has the same contents every time, whats the point of re-creating and destroying it hundreds (if not thousands) of times when you could just create the menu once and just show the same menu every time when needed?

menu_destroy() is only useful when you create a menu that has a different content every time. for example a menu that displays players list

what people do:
Code:
public command() {    menu_create()    //create menu    menu_display() } public menu_handler() {    menu_destroy() }

what they should do when using the same menu over and over again:
Code:
new g_pmenu public plugin_init() {    g_pmenu = menu_create()    //create menu } public command() {    menu_display() } public plugin_end() {    menu_destroy() }
jimaway 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 21:02.


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