Raised This Month: $ Target: $400
 0% 

[Resolved][REQ][TF2]Set weapon alpha


Post New Thread Reply   
 
Thread Tools Display Modes
Sreaper
髪を用心
Join Date: Nov 2009
Old 09-21-2013 , 15:38   Re: [REQ][TF2]Set weapon alpha
Reply With Quote #11

Would someone kindly edit that plugin to be sm_alpha_wep <target> <amount>? And remove the convar.
Sreaper is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 09-21-2013 , 15:44   Re: [REQ][TF2]Set weapon alpha
Reply With Quote #12

When posting error messages, please post the ENTIRE message. The line # is especially important.

I had a friend compile this for me, as I cannot do so at my current location.

The first issue is on line 12. The version string needs to be enclosed in quotation marks. That one was my fault.

The second issue is on line 18, or rather, the command it links to.

Code:
public Action:Command_SetWepAlpha(client)
needs to be
Code:
public Action:Command_SetWepAlpha(client, args)
The final issue is on line 45. Someone put a return in SetWeaponInvis for no apparent reason, when it should have gone in Command_SetWepAlpha.

PHP Code:
#include <sourcemod>
#include <tf2_stocks> 

new Handle:hcvar_alpha_wep INVALID_HANDLE;
new 
_:cvar_alpha_wep;
 
public 
Plugin:myinfo =
{
    
name "WepAlphanator",
    
author "Assyrian/Nergal",
    
description "makes weapons transparent",
    
version "1.0.0.2",
    
url "http://www.sourcemod.net/"

 
public 
OnPluginStart()   
{
    
RegAdminCmd("sm_alphawep"Command_SetWepAlphaADMFLAG_GENERIC);
    
hcvar_alpha_wep CreateConVar("sm_alphawep""128""Default alpha");
    
HookConVarChange(hcvar_alpha_wepcvarChange);
}

public 
OnConfigsExecuted()
{
    
cvarChange(INVALID_HANDLE"0""0");
}

public 
Action:Command_SetWepAlpha(clientargs)
{
    
SetWeaponInvis(client);
    return 
Plugin_Continue;
}

stock SetWeaponInvis(clientbool:set true)

    for (new 
05i++)
    { 
        new 
entity GetPlayerWeaponSlot(clienti); 
        if (
entity != -1)
        { 
            
SetEntityRenderMode(entityRENDER_TRANSCOLOR); 
            
SetEntityRenderColor(entity___set cvar_alpha_wep 255); 
        } 
    }
    
}

public 
cvarChange(Handle:hHandle, const String:strOldValue[], const String:strNewValue[])
{
    if (
hHandle == hcvar_alpha_wep || hHandle == INVALID_HANDLE)
    {
        
cvar_alpha_wep GetConVarInt(hcvar_alpha_wep);
        if (
cvar_alpha_wep 255 || cvar_alpha_wep 0)
        {
            
cvar_alpha_wep 128;
            
LogError("Value of sm_alphawep is invalid. Plugin will behave as if value was 128.");
        }
    }

__________________

Last edited by ddhoward; 09-21-2013 at 15:45.
ddhoward is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 09-21-2013 , 15:58   Re: [REQ][TF2]Set weapon alpha
Reply With Quote #13

Quote:
Originally Posted by Sreaper View Post
Would someone kindly edit that plugin to be sm_alpha_wep <target> <amount>? And remove the convar.
This should work (untested):
Spoiler
Attached Files
File Type: sp Get Plugin or Get Source (alpha_wep.sp - 251 views - 1.7 KB)
__________________

Last edited by ddhoward; 09-21-2013 at 16:18.
ddhoward is offline
Sreaper
髪を用心
Join Date: Nov 2009
Old 09-21-2013 , 16:06   Re: [REQ][TF2]Set weapon alpha
Reply With Quote #14

Thank you all for your help. :)
Sreaper is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 09-21-2013 , 16:43   Re: [Resolved][REQ][TF2]Set weapon alpha
Reply With Quote #15

Like someone said before, it doesn't work for stock weapons in slot 0 (primary) .
__________________
Want to check my plugins ?
Arkarr is offline
nergal
Veteran Member
Join Date: Apr 2012
Old 09-21-2013 , 17:00   Re: [Resolved][REQ][TF2]Set weapon alpha
Reply With Quote #16

Quote:
Originally Posted by Arkarr View Post
Like someone said before, it doesn't work for stock weapons in slot 0 (primary) .
yea, why is that? on every other weapon it's invis, but with the sm_alpha from funcommandsx, it turns the stock weapons transparent.
__________________

Last edited by nergal; 09-21-2013 at 17:12.
nergal is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 09-21-2013 , 17:53   Re: [Resolved][REQ][TF2]Set weapon alpha
Reply With Quote #17

Set the render color to like 120 120 120 255. This will mmic 120 alpha, yu proportion the values. Just setting alha wont work. Messing with rendermode isnt what you want to do here. Note that setting the color and transparency on these weapons will also alter the viewmodel.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 09-21-2013 , 23:24   Re: [Resolved][REQ][TF2]Set weapon alpha
Reply With Quote #18

The method I posted works fine, at least in my Friendly Mode plugin. No one has complained about it not affecting stock primaries. It is functioning fine how it is, and unless I can duplicate the error, I cannot fix it.
__________________

Last edited by ddhoward; 09-21-2013 at 23:24.
ddhoward is offline
nergal
Veteran Member
Join Date: Apr 2012
Old 09-21-2013 , 23:39   Re: [Resolved][REQ][TF2]Set weapon alpha
Reply With Quote #19

Quote:
Originally Posted by ddhoward View Post
The method I posted works fine, at least in my Friendly Mode plugin. No one has complained about it not affecting stock primaries. It is functioning fine how it is, and unless I can duplicate the error, I cannot fix it.
eh it's not a big deal
__________________
nergal is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 09-22-2013 , 11:09   Re: [Resolved][REQ][TF2]Set weapon alpha
Reply With Quote #20

Dunno, been using this for some 2+ years, works on clients as well.
Is also good to note that some rendermodes/colors will have to be reset at later times (clients?) though weapons and hats will probably get refredhed kn cabinet touch/respawn.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.

Last edited by friagram; 09-22-2013 at 11:10.
friagram 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 10:48.


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