Raised This Month: $51 Target: $400
 12% 

Help with weapon touching


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
reinert
Veteran Member
Join Date: Feb 2007
Old 09-05-2010 , 06:55   Help with weapon touching
Reply With Quote #1

Hey.

I Can buy awp, but when I drop it. I can't pickup it. my Snaiperio_Ginklai[id] is true

PHP Code:
    register_menucmd(register_menuid("T_BuyRifle"1), (1<<4), "BuyRifle")
    
register_menucmd(register_menuid("T_BuyRifle"1), (1<<5), "BuyRifle")
    
register_menucmd(register_menuid("CT_BuyRifle"1), (1<<5), "BuyRifle")
    
register_menucmd(register_menuid("CT_BuyRifle"1), (1<<4), "BuyRifle")

public 
BuyRifle(id)
{
    if(!(
get_user_flags(id) & VIP_FLAGAS))
    {
        
Message_No_Vip(id)
        return 
PLUGIN_HANDLED
    
}
    if(
A_Snaiperio_Ginklai[id] == false && get_user_flags(id) & VIP_FLAGAS)
    {
        
Message_No_Awp(id)
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

public 
client_command(id)
{
    static 
szCommand[8]

    if( 
read_argv(0szCommandcharsmax(szCommand)) < && bCheckArgAwp(idszCommand) )
    {
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

public 
CS_InternalCommand(id, const szCommand[])
{
    if( 
strlen(szCommand) < && bCheckArgAwp(idszCommand) )
    {
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

bool:bCheckArgAwp(id, const szCommand[])
{
    static const 
awp[] = "awp"
    
static const magnum[] = "magnum"
    
static const sg550[] = "sg550"
    
static const g3sg1[] = "g3sg1"

    
if((equali(szCommandawp) || equali(szCommandmagnum) || equali(szCommandsg550) || equali(szCommandg3sg1)))
    {
        if(!(
get_user_flags(id) & VIP_FLAGAS))
    {
    
Message_No_Vip(id)
    return 
true
    
}
        if(
A_Snaiperio_Ginklai[id] == false && get_user_flags(id) & VIP_FLAGAS)
    {
    
Message_No_Awp(id)
    return 
true
             
}
    }
    return 
false
}

public 
WeaponBox_Touch(iWpnBxid)
{
    if( 
is_user_alive(id) && entity_get_int(iWpnBxEV_INT_flags) & FL_ONGROUND )
    {
        const 
XTRA_OFS_WEAPONBOX 4
        
const m_rgpPlayerItems_wpnbx_slot1 35

        
static iWeapon
        iWeapon 
get_pdata_cbase(iWpnBxm_rgpPlayerItems_wpnbx_slot1XTRA_OFS_WEAPONBOX)
    
        if( 
iWeapon && A_Snaiperio_Ginklai[id] == false && cs_get_weapon_id(iWeapon) == CSW_AWP || CSW_G3SG1 ||  CSW_SG550)
        {
            if( 
g_iLastTouchedBox[id] != iWpnBx )
            {
                if(!
user_has_weapon(idCSW_AWP || CSW_G3SG1 || CSW_SG550))
                {
                    
Message_No_Awp(id)
                }
                
g_iLastTouchedBox[id] = iWpnBx
            
}
            return 
PLUGIN_HANDLED
        
}
    }
    return 
PLUGIN_CONTINUE
}

Message_No_Awp(id)
{
    const 
HUD_PRINTCENTER    =    4
    
static const szOnlyVIP[] = "Jusu snaiperio ginklu rezimas isjungtas" 

    
message_begin(MSG_ONE_UNRELIABLEgmsgTextMsg, .player=id)
    
write_byteHUD_PRINTCENTER )
    
write_stringszOnlyVIP )
    
message_end()

I Think the problem is in WeaponBox_Touch but my eyes can't see teh problem :/ help me please :/
reinert is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-05-2010 , 10:33   Re: Help with weapon touching
Reply With Quote #2

I did not look closely or test your code but this could be part of your problem. You cannot compare multiple values against one value like this.
PHP Code:
[...] cs_get_weapon_id(iWeapon) == CSW_AWP || CSW_G3SG1 ||  CSW_SG550
Try this, untested
PHP Code:
const iWeapons = ( << CSW_AWP ) | ( << CSW_G3SG1 ) | ( << CSW_SG550 );

if( ( 
iWeapon ) && ( A_Snaiperio_Ginklai[id] == false ) && ( ( << cs_get_weapon_idiWeapon ) ) & iWeapons ) ) 
__________________
Bugsy is online now
reinert
Veteran Member
Join Date: Feb 2007
Old 09-05-2010 , 12:38   Re: Help with weapon touching
Reply With Quote #3

Oh I fixed it already otherway. But thanks anyways.
1 Problem more, in end of Player_Spawn I'm checking

PHP Code:
if((user_has_weapon(idCSW_AWP) || user_has_weapon(idCSW_SG550) || user_has_weapon(idCSW_G3SG1)) && A_Snaiperio_Ginklai[id] == false)
{
set_task(1.0,"dropZOOM")
}

public 
dropZOOM(id)
{
    
engclient_cmd(id"slot1")
    
engclient_cmd(id"drop""weapon_awp")
    
engclient_cmd(id"drop""weapon_g3sg1")
    
engclient_cmd(id"drop""weapon_sg550")

A_Snaiperio_Ginklai[id] sets to False at start of Player_Spawn function, maybe the problem is here ?. Should I check it after Player_Spawn checked +1sec ? or problem is elsewhere ?
reinert is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-05-2010 , 14:48   Re: Help with weapon touching
Reply With Quote #4

You can try that. What sets it to true?
__________________
Bugsy is online now
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 11:29.


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