Raised This Month: $ Target: $400
 0% 

Bit Sum Fun


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 09-28-2011 , 02:49   Bit Sum Fun
Reply With Quote #1

When using the following bitsum.
PHP Code:
#define fm_cs_set_user_nobuy(%1)    set_pdata_int(%1, m_iMapZone, get_pdata_int(%1, m_iMapZone) & ~(1<<0)) 
How would i Add that specific item back into the m_iMapZone Offset?

I tried the below but not really sure how to do it.
PHP Code:
#define fm_cs_set_user_nobuy(%1)    set_pdata_int(%1, m_iMapZone, get_pdata_int(%1, m_iMapZone) & (1<<0)) 
Doc-Holiday is offline
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 09-28-2011 , 03:04   Re: Bit Sum Fun
Reply With Quote #2

i also dont know but heave to tried this ?
PHP Code:
#define fm_cs_set_user_nobuy(%1)    set_pdata_int(%1, m_iMapZone, get_pdata_int(%1, m_iMapZone) | (1<<0)) 
__________________
Preparing to release my plugins..
r0ck is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 09-28-2011 , 03:10   Re: Bit Sum Fun
Reply With Quote #3

Quote:
Originally Posted by r0ck View Post
i also dont know but heave to tried this ?
PHP Code:
#define fm_cs_set_user_nobuy(%1)    set_pdata_int(%1, m_iMapZone, get_pdata_int(%1, m_iMapZone) | (1<<0)) 
That doesnt seem to do it...

Code:
#define fm_cs_set_user_nobuy(%1)    set_pdata_int(%1, m_iMapZone, get_pdata_int(%1, m_iMapZone) & ~(1<<0))
#define fm_cs_set_user_buy(%1)    set_pdata_int(%1, m_iMapZone, get_pdata_int(%1, m_iMapZone) | (1<<0))
Doc-Holiday is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-28-2011 , 07:29   Re: Bit Sum Fun
Reply With Quote #4

r0cks code looks correct to me.

Add bit:
Var | ( 1 << X )

Remove bit:
Var & ~( 1 << X )
__________________
Bugsy is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-28-2011 , 11:30   Re: Bit Sum Fun
Reply With Quote #5

Your code is correct, but player has to really be in buyzone in order to work, else you would need to constantly add the bit somewhere like prethink POST.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 09-28-2011 , 15:37   Re: Bit Sum Fun
Reply With Quote #6

Quote:
Originally Posted by ConnorMcLeod View Post
Your code is correct, but player has to really be in buyzone in order to work, else you would need to constantly add the bit somewhere like prethink POST.
I have it being added on info changed when they switched teams. (inorder to reenable the buy zone.)

and the buyzone block is filtered by the players team.
Doc-Holiday is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-28-2011 , 16:26   Re: Bit Sum Fun
Reply With Quote #7

You don't understand.
Each frame, mapzone are checked, so if you have disabled them on a player you have to disable indefinitely if they stand on a buyzone, same if they are not in a zone and you want to enable buy.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 09-29-2011 , 07:12   Re: Bit Sum Fun
Reply With Quote #8

it removes the bit on the status icon... However it filters to only one team (atleast it should)

PHP Code:
public plugin_cfg()
{
    
register_message(get_user_msgid("StatusIcon") , "Message_StatusIcon"); //Message for BuyZone
}

public 
Message_StatusIcon(iMsgIdMSG_DESTid)
{
    if(!
get_pcvar_num(g_iToggle))
        return 
PLUGIN_HANDLED;
    static 
szIcon[5];
    
get_msg_arg_string(2szIcon4);
    if(
szIcon[0] == 'b' && szIcon[2] == 'y' && szIcon[3] == 'z')
    {
        if(
get_msg_arg_int(1))
        {
            if(
get_pcvar_num(g_iTeamMode))
            {
                if(
g_iPlayerTeam[id] == g_MenuTeam)
                {
                    
fm_cs_set_user_nobuy(id);
                }
            }
            else
            {
                
fm_cs_set_user_nobuy(id);
            }
            return 
PLUGIN_HANDLED;
        }
    }
    return 
PLUGIN_CONTINUE;

But for some reason it doesn't only filter T's..

g_iPlayerTeam[id] = CS_TEAM_CT/T

g_MenuTeam = CS_TEAM_CT/T depending on the value of the cvar.
1 = T 2 = CT any other value = Both.

For some reason if g_iTeamMode is 1. Buyzones are blocked for each player on both teams.
Doc-Holiday is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-30-2011 , 01:05   Re: Bit Sum Fun
Reply With Quote #9

Use info_map_parameters entity to disable buy on a wanted team.
Remove the StatusIcon hook.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 09-30-2011 at 01:11.
ConnorMcLeod is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 09-30-2011 , 02:16   Re: Bit Sum Fun
Reply With Quote #10

Quote:
Originally Posted by ConnorMcLeod View Post
Use info_map_parameters entity to disable buy on a wanted team.
Remove the StatusIcon hook.

PHP Code:
public plugin_precache() 
{
    new 
iEntity create_entity(info_map_parameters);
    
g_iTeamMode register_cvar("wm_teammode""1"); // 0 = both 1 = T only 2 = CT only.
        
    
switch(get_pcvar_num(g_iTeamMode))
    {
        case 
1DispatchKeyValue(iEntity"buying""1");
        case 
2DispatchKeyValue(iEntity"buying""2");
        default: 
DispatchKeyValue(iEntity"buying""3");
    }
    
    
DispatchSpawn(iEntity);
    
    
g_hSpawn register_forward(FM_Spawn"FwdSpawn");
}

public 
FwdSpawn(iEntity)
{
    static 
szClassname[32];
    
entity_get_string(iEntityEV_SZ_classnameszClassname31);
    
    if(
equal(szClassnameinfo_map_parameters)) 
    {
        
remove_entity(iEntity);
        return 
FMRES_SUPERCEDE;
    }
    return 
FMRES_IGNORED;

The above code for some reason no matter what the value of the cvar is. it allows both teams to buy.
Doc-Holiday 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 19:31.


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