Raised This Month: $ Target: $400
 0% 

[DONE]Blocking a function with cvar


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Unkolix
Veteran Member
Join Date: Sep 2012
Old 02-08-2013 , 12:04   [DONE]Blocking a function with cvar
Reply With Quote #1

Hey! Could someone tell me how to block a function with cvar?
I have this code, that blocks players from getting grenades in certain maps and I want to block that if
PHP Code:
g_map_active register_cvar("map_active""1"
is set to 0.
I believe it should be something with this:
PHP Code:
if (!get_pcvar_num(map_active))
        return 
PLUGIN_CONTINUE 
But I can't figure it out were to put it.
PHP Code:
public fwHamPlayerSpawnPost(id
{
    
VIPMenuUsed=0;
    
get_mapnameszMap charsmaxszMap ) );
    for( new 
sizeofmapnames ) ; i++ )
    {
        if ( 
containiszMap mapnames] ) !=-)
            return;
    }
    if(
is_user_alive(id) && get_user_flags(id) & ADMIN_LEVEL_H)
    {
        
give_item(id"weapon_hegrenade");
        
give_item(id"weapon_flashbang");
        
give_item(id"weapon_flashbang");
        
give_item(id"weapon_smokegrenade");
        
give_item(id"item_assaultsuit");
        
give_item(id"item_thighpack");
    }


Last edited by Unkolix; 02-09-2013 at 12:07.
Unkolix is offline
naven
Veteran Member
Join Date: Jun 2008
Location: Poland, Cieszyn
Old 02-08-2013 , 12:22   Re: Blocking a function with cvar
Reply With Quote #2

Quote:
how to block a cvar with another cvar?
I don't see where is this another cvar.

If you meant to check a cvar for giving grenades, do it here:
Code:
if(is_user_alive(id) && get_user_flags(id) & ADMIN_LEVEL_H && get_pcvar_num(map_active))
__________________
naven.com.pl
"At the end of the day, there are always going to be mental disorders and people who cause violence for no other reason than the fact that they're fucked up and lost. And all we can do is try to learn from it." Corey Taylor.
naven is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 02-08-2013 , 12:40   Re: Blocking a function with cvar
Reply With Quote #3

EDITED!!!!

Got it working with vip menu, but still it doesn't give grenades on that map if g_map_active is 0... I did the same as this:
PHP Code:
public Showrod(id)
{
    
get_mapnameszMap charsmaxszMap ) );
    
map_active get_pcvar_num (g_map_active)
    if (
map_active == 1)
    {
        for( new 
sizeofmapnames ) ; i++ )
        {
            if ( 
containiszMap mapnames] ) !=-)
                return;
        }
    }
    new 
menu menu_create("\rVIP meniu:""Pressedrod");
    
    
menu_additem(menu"\yM4A1 su Deagle""1"0);
    
menu_additem(menu"\yAK47 su Deagle""2"0);
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);

And this: But this doesn't work...
PHP Code:
public fwHamPlayerSpawnPost(id
{
    
VIPMenuUsed=0;
    
get_mapnameszMap charsmaxszMap ) );
    
map_active get_pcvar_num (g_map_active)
    if (
map_active == 1)
    {
        for( new 
sizeofmapnames ) ; i++ )
        {
            if ( 
containiszMap mapnames] ) !=-)
                return;
        }
    }
    if(
is_user_alive(id) && get_user_flags(id) & ADMIN_LEVEL_H)
    {
        
give_item(id"weapon_hegrenade");
        
give_item(id"weapon_flashbang");
        
give_item(id"weapon_flashbang");
        
give_item(id"weapon_smokegrenade");
        
give_item(id"item_assaultsuit");
        if(
g_bHasBombSite && cs_get_user_team(id) == CS_TEAM_CT)
        {
            
cs_set_user_defuse(id1);
        }
    }


Last edited by Unkolix; 02-08-2013 at 13:31.
Unkolix is offline
naven
Veteran Member
Join Date: Jun 2008
Location: Poland, Cieszyn
Old 02-09-2013 , 11:36   Re: Blocking a function with cvar
Reply With Quote #4

Really, I do not understand you at all now.
__________________
naven.com.pl
"At the end of the day, there are always going to be mental disorders and people who cause violence for no other reason than the fact that they're fucked up and lost. And all we can do is try to learn from it." Corey Taylor.
naven is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 02-09-2013 , 11:45   Re: Blocking a function with cvar
Reply With Quote #5

Nevermind. I got it working.
Unkolix 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 20:34.


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