AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Bit Sum Fun (https://forums.alliedmods.net/showthread.php?t=168371)

Doc-Holiday 09-28-2011 02:49

Bit Sum Fun
 
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)) 


r0ck 09-28-2011 03:04

Re: Bit Sum Fun
 
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)) 


Doc-Holiday 09-28-2011 03:10

Re: Bit Sum Fun
 
Quote:

Originally Posted by r0ck (Post 1564570)
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))


Bugsy 09-28-2011 07:29

Re: Bit Sum Fun
 
r0cks code looks correct to me.

Add bit:
Var | ( 1 << X )

Remove bit:
Var & ~( 1 << X )

ConnorMcLeod 09-28-2011 11:30

Re: Bit Sum Fun
 
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.

Doc-Holiday 09-28-2011 15:37

Re: Bit Sum Fun
 
Quote:

Originally Posted by ConnorMcLeod (Post 1564775)
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.

ConnorMcLeod 09-28-2011 16:26

Re: Bit Sum Fun
 
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.

Doc-Holiday 09-29-2011 07:12

Re: Bit Sum Fun
 
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.

ConnorMcLeod 09-30-2011 01:05

Re: Bit Sum Fun
 
Use info_map_parameters entity to disable buy on a wanted team.
Remove the StatusIcon hook.

Doc-Holiday 09-30-2011 02:16

Re: Bit Sum Fun
 
Quote:

Originally Posted by ConnorMcLeod (Post 1565700)
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.


All times are GMT -4. The time now is 19:31.

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