Raised This Month: $66 Target: $400
 16% 

BF2 invisible


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
myusername
Senior Member
Join Date: Aug 2012
Old 02-22-2014 , 09:59   BF2 invisible
Reply With Quote #1

Im making vip player fully invisible in BF2 server. But vip invisible not work. Where did i put wrong?

Invisible part
PHP Code:
#define ADMIN_VIP ADMIN_BAN

public set_invis(id)
{
    if ( !
get_pcvar_num(gPcvarBadgesActive) || !get_pcvar_num(gPcvarBadgePowers) ) return;
    if ( !
is_user_alive(id) ) return;

    new 
shotgunlevel g_PlayerBadges[id][BADGE_SHOTGUN];

    if ( 
shotgunlevel && get_user_weapon(id) == CSW_KNIFE )
    {
        
fm_set_rendering(idkRenderFxNone000kRenderTransTexturegInvisAlphaValue[shotgunlevel-1]);
        
g_invis[id] = true;
    }
    else if ( 
ADMIN_VIP && get_user_weapon(id) == CSW_KNIFE )
    {
        
fm_set_rendering(idkRenderFxNone000kRenderTransTexture0);
        
g_invis[id] = true;
    }
    else
    {
        
fm_set_rendering(id);
        
g_invis[id] = false;
    }

and ive added this
PHP Code:
else if ( ADMIN_VIP && get_user_weapon(id) == CSW_KNIFE )
    {
        
fm_set_rendering(idkRenderFxNone000kRenderTransTexture0);
        
g_invis[id] = true;
    } 
__________________
Rest in piece.
myusername is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Upplands Väsby, Sweden
Old 02-22-2014 , 11:48   Re: BF2 invisible
Reply With Quote #2

else if ( get_user_flags(id) & ADMIN_VIP && get_user_weapon(id) == CSW_KNIFE )

I would also switch them around because now if shotgunlevel is anything but 0, that case will be called instead of the VIP part.
__________________
Black Rose is offline
myusername
Senior Member
Join Date: Aug 2012
Old 02-22-2014 , 12:22   Re: BF2 invisible
Reply With Quote #3

Oh yea i forgot the get_user_flags. Yea that's the problem. If i put this top of the shotgunlevel this will work?
__________________
Rest in piece.
myusername is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Upplands Väsby, Sweden
Old 02-22-2014 , 13:43   Re: BF2 invisible
Reply With Quote #4

Try it and you'll find out. I haven't tested it myself but that's one obvious error.
__________________
Black Rose is offline
myusername
Senior Member
Join Date: Aug 2012
Old 02-23-2014 , 07:23   Re: BF2 invisible
Reply With Quote #5

is there any force way to make invisible?
__________________
Rest in piece.
myusername is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Upplands Väsby, Sweden
Old 02-23-2014 , 09:20   Re: BF2 invisible
Reply With Quote #6

What do you mean?
__________________
Black Rose is offline
myusername
Senior Member
Join Date: Aug 2012
Old 02-23-2014 , 13:46   Re: BF2 invisible
Reply With Quote #7

I mean if player is vip then player will always invisible. Whenever if player has shotgun badge or not.
__________________
Rest in piece.
myusername is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Upplands Väsby, Sweden
Old 02-23-2014 , 16:07   Re: BF2 invisible
Reply With Quote #8

Quote:
Originally Posted by myusername View Post
I mean if player is vip then player will always invisible. Whenever if player has shotgun badge or not.
Code:
#define ADMIN_VIP ADMIN_BAN public set_invis(id) {     if ( ! get_pcvar_num(gPcvarBadgesActive) || ! get_pcvar_num(gPcvarBadgePowers) ) return;     if ( ! is_user_alive(id) ) return;         new shotgunlevel = g_PlayerBadges[id][BADGE_SHOTGUN];         if ( ADMIN_VIP && get_user_weapon(id) == CSW_KNIFE )     {         fm_set_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransTexture, 0);         g_invis[id] = true;     }     else if ( shotgunlevel && get_user_weapon(id) == CSW_KNIFE )     {         fm_set_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransTexture, gInvisAlphaValue[shotgunlevel-1]);         g_invis[id] = true;     }     else     {         fm_set_rendering(id);         g_invis[id] = false;     } }
This would give the user invisibility if:
gPcvarBadgesActive and gPcvarBadgePowers is true (I assume it is)
if the user is alive, a VIP and holding a knife

The code I provided now should be the same as you have since I already told you to do these changes. As you can see, the shotgunlevel is set but isn't used until we have already made sure that the user is not a VIP.
So basically, yes, this will give any VIP invisibility no matter what shotgunlevel is.
__________________
Black Rose is offline
Reply


Thread Tools
Display Modes

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 05:22.


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