AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   BF2 invisible (https://forums.alliedmods.net/showthread.php?t=235855)

myusername 02-22-2014 08:59

BF2 invisible
 
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;
    } 


Black Rose 02-22-2014 10:48

Re: BF2 invisible
 
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.

myusername 02-22-2014 11:22

Re: BF2 invisible
 
Oh yea i forgot the get_user_flags. Yea that's the problem. If i put this top of the shotgunlevel this will work?

Black Rose 02-22-2014 12:43

Re: BF2 invisible
 
Try it and you'll find out. I haven't tested it myself but that's one obvious error.

myusername 02-23-2014 06:23

Re: BF2 invisible
 
is there any force way to make invisible?

Black Rose 02-23-2014 08:20

Re: BF2 invisible
 
What do you mean?

myusername 02-23-2014 12:46

Re: BF2 invisible
 
I mean if player is vip then player will always invisible. Whenever if player has shotgun badge or not.

Black Rose 02-23-2014 15:07

Re: BF2 invisible
 
Quote:

Originally Posted by myusername (Post 2103741)
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.


All times are GMT -4. The time now is 16:50.

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