Raised This Month: $32 Target: $400
 8% 

Admin Weapon Skins Error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
feren02
Senior Member
Join Date: Mar 2012
Old 11-26-2020 , 01:15   Admin Weapon Skins Error
Reply With Quote #1

Hello everyone!

Hope you are coping with this pandemic. Anyway, I am trying to add custom weapon skin models basically (v_model) only for "admins" in my server. Unfortunately, the custom skin models does not show in-game. I am using this .sma:

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Admin Knife Model"
#define VERSION "1.0"
#define AUTHOR "Flicker"


new VMODEL[] = "models/v_admin_knife.mdl"
new PMODEL[] = "models/p_admin_knife.mdl"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("CurWeapon""cWeapon""be""1=29")
}

public 
plugin_precache()
{
    
precache_model(VMODEL)
    
precache_model(PMODEL)
}

public 
cWeapon(id)
{
    if(
is_user_alive(id) && get_user_flags(id) & ADMIN_SLAY)
    {
        
set_pev(idpev_viewmodel2VMODEL)
        
set_pev(idpev_weaponmodel2PMODEL)
    }

***OF COURSE I edit the values of depending on the weapon and directory of my v_model skins of weapon but it does not showup in-game when I buy the weapon and even I am in all admin flags. Also .sma compiles with no error, and runs normally when amx_plugins check***

Need your expertise if there are other alternative coding to force a weapon skin v_model when an ADMIN buys it in-game.


Thank you and looking forward!
feren02 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-26-2020 , 07:27   Re: Admin Weapon Skins Error
Reply With Quote #2

2=29, not 1=29.
WeaponID is the second argument - https://wiki.alliedmods.net/Half-Lif...ents#CurWeapon
Also I would use 1=1 as well.

PS: you don't need the 'is_user_alive' check. The event cannot be triggered on dead players.
__________________

Last edited by OciXCrom; 11-26-2020 at 07:28.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
feren02
Senior Member
Join Date: Mar 2012
Old 11-26-2020 , 19:25   Re: Admin Weapon Skins Error
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
2=29, not 1=29.
WeaponID is the second argument - https://wiki.alliedmods.net/Half-Lif...ents#CurWeapon
Also I would use 1=1 as well.

PS: you don't need the 'is_user_alive' check. The event cannot be triggered on dead players.
My pleasure to get a response from a "Legend"

It worked amazingly! But last thing, it is now having problems in-game when:

a. I switched from Primary to Secondary Ammo (handgun NOT CUSTOMIZED weapon skin), the custom weapon v_model of the Primary Ammo (e.g. m4a1), stays on the screen but the sound of the gun and ammo rounds/magazine is of the handgun. However, if Primary and Secondary Ammo are both CUSTOMIZED weapon skin, there seems to be no problem at all.

-How can I avoid this? Fancy cause if from Secondary Ammo (CUSTOMIZED weapon skin to Primary Ammo (NOT CUSTOMIZED weapon skin), the views are normal in-game.

b. The weapon models stays on the lefthand or righthand view depending on the v.mdl I applied on the models folder (if mirrored or not)

- How can I include a code that shows different v_model (e.g. v_customm4a1.mdl and v_customm4a1_r.mdl) if for an instance
: "be", 2=22 ) or do I have to edit something to show it differently for left and right hand in-game?




Looking forward! Thank you in advance. ^_^

Last edited by feren02; 11-26-2020 at 21:43.
feren02 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-27-2020 , 07:37   Re: Admin Weapon Skins Error
Reply With Quote #4

What do you mean custom ammo skins? How did you change them? Can you show pictures of the issue?

Quote:
b. The weapon models stays on the lefthand or righthand view depending on the v.mdl I applied on the models folder (if mirrored or not)

- How can I include a code that shows different v_model (e.g. v_customm4a1.mdl and v_customm4a1_r.mdl) if for an instance
: "be", 2=22 ) or do I have to edit something to show it differently for left and right hand in-game?
cl_righthand 0/1?
__________________

Last edited by OciXCrom; 11-27-2020 at 07:38.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
feren02
Senior Member
Join Date: Mar 2012
Old 11-28-2020 , 22:51   Re: Admin Weapon Skins Error
Reply With Quote #5

Quote:
Originally Posted by OciXCrom View Post
What do you mean custom ammo skins? How did you change them? Can you show pictures of the issue?



cl_righthand 0/1?
Hello OciXCRom!

Here are the photos:

https://ibb.co/Wfn40HY [Custom Primary Weapon Skin]


https://ibb.co/2ZF3Zvp
[ERROR IN SECONDARY AMMO WHEN SWITCHING FROM CUSTOM PRIMARY WEAPON SKIN]
*NOTE: WHEN SECONDARY AMMO IS ALSO CUSTOMIZED AND INCLUDED IN THE PLUGIN, IT SWITCHES NORMALLY. BUT IF THE SECONDARY AMMO MODEL SKIN IS DEFAULT IT HAS THE ERROR ON PHOTO.

~~~~~ Also, the issue regarding v_models for weapons, when righthand is set, it still shows the CUSTOM WEAPON skins at lefthand, is there any code to set e.g. v_neonawp.mdl_r whenever a player in-game types cl_righthand 1 or if righthand is enabled?

----> This is the .SMA used.

PHP Code:
#include <amxmodx>  
#include <amxmisc>  
#include <cstrike>  
#include <fakemeta>

new const v_knife [] = "models/olgPH_weapons/v_neonknife.mdl";  
new const 
v_knife_r [] = "models/olgPH_weapons/v_neonknife_r.mdl"
new const 
v_m4a1 [] = "models/olgPH_weapons/v_neonm4a1.mdl";  
new const 
v_m4a1_r [] = "models/olgPH_weapons/v_neonm4a1_r.mdl";  
new const 
v_ak47 [] = "models/olgPH_weapons/v_neonak47.mdl";  
new const 
v_ak47_r [] = "models/olgPH_weapons/v_neonak47_r.mdl";  
new const 
v_awp [] = "models/olgPH_weapons/v_neonawp.mdl";  
new const 
v_awp_r [] = "models/olgPH_weapons/v_neonawp_r.mdl";  
//new const v_usp [] = "models/usp_comet.mdl";  
//new const v_glock18 [] = "models/glock18_water.mdl";  
new const v_deagle [] = "models/olgPH_weapons/v_neondeagle.mdl";  
new const 
v_deagle_r [] = "models/olgPH_weapons/v_neondeagle_r.mdl";  


new 
g_HaveFlags;  


public 
plugin_init( )  
{  
    
register_plugin"Server Models""1.0""feruchio" );  
    
    
    
register_event"CurWeapon""event_Curwp""be""2=18""2=22""2=26""2=28""2=29" );  
    
    
g_HaveFlags register_cvar"admin_knife_flags""t" );  
}  


public 
plugin_precache( )  
{  
    
precache_modelv_knife );  
    
precache_modelv_knife_r );  
    
precache_modelv_m4a1 ); 
    
precache_modelv_m4a1_r ); 
    
precache_modelv_ak47 ); 
    
precache_modelv_ak47_r ); 
    
precache_modelv_awp ); 
    
precache_modelv_awp_r ); 
//    precache_model( v_usp ); 
//    precache_model( v_glock18 ); 
    
precache_modelv_deagle ); 
    
precache_modelv_deagle_r ); 
}  

public 
event_Curwpid )  
{  
    new 
szHaveFlag[15];  
    
get_pcvar_stringg_HaveFlagsszHaveFlagcharsmaxszHaveFlag ) )  
    
    new 
WeaponIdUserHandle get_user_weaponid );
    
    if( 
has_all_flagsidszHaveFlag ) )  
    {  
        switch ( 
WeaponIdUserHandle )
        {
            case 
CSW_KNIFEset_pevidpev_viewmodel2v_knife );
            case 
CSW_M4A1set_pevidpev_viewmodel2v_m4a1 );
            case 
CSW_AK47set_pevidpev_viewmodel2v_ak47 );
            case 
CSW_AWPset_pevidpev_viewmodel2v_awp );
//            case CSW_USP: set_pev( id, pev_viewmodel2, v_usp );
//            case CSW_GLOCK18:set_pev( id, pev_viewmodel2, v_glock18 );
            
case CSW_DEAGLE:set_pevidpev_viewmodel2v_deagle );
        }
    }  
    
    return 
PLUGIN_CONTINUE;  



THANK YOU IN ADVANCE!

Last edited by feren02; 11-28-2020 at 22:54.
feren02 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-29-2020 , 07:21   Re: Admin Weapon Skins Error
Reply With Quote #6

I really don't understand what you mean by 'secondary ammo customization'. What I see on the image is you having an AWP model when you're holding the USP. This is happening because you didn't add what I said earlier:

Quote:
Also I would use 1=1 as well.
Code:
register_event( "CurWeapon", "event_Curwp", "be", "1=1", "2=18", "2=22", "2=26", "2=28", "2=29" );

If the custom weapon skins are mirrored, of course it will show them in the other hand. Bear in mind that some model viewer programs always display them mirrored, so that might be confusing you. Personally I've never seen a skin being left-handed by default.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
feren02
Senior Member
Join Date: Mar 2012
Old 11-30-2020 , 01:55   Re: Admin Weapon Skins Error
Reply With Quote #7

Quote:
Originally Posted by OciXCrom View Post
I really don't understand what you mean by 'secondary ammo customization'. What I see on the image is you having an AWP model when you're holding the USP. This is happening because you didn't add what I said earlier:



Code:
register_event( "CurWeapon", "event_Curwp", "be", "1=1", "2=18", "2=22", "2=26", "2=28", "2=29" );

Yes my bad 1=1 it is.

If the custom weapon skins are mirrored, of course it will show them in the other hand. Bear in mind that some model viewer programs always display them mirrored, so that might be confusing you. Personally I've never seen a skin being left-handed by default.
Indeed, some v_models are already mirrored upon downloading.. trying to point out that .sma I use only sets v_model of a weapon not v_model_r of a weapon. That is why when players use lefthand in-game, it still shows righthand custom weapon skin. How can I tap the lefthand or vice-versa weapon skin view? Is it by adding some code to .sma?


Thanks so much it feels light to talk to you really.
feren02 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-30-2020 , 07:25   Re: Admin Weapon Skins Error
Reply With Quote #8

By deleting the mirrored model and using the one that is right-handed by default. You don't need to use both .mdl files. Always use v_models that are right-handed to avoid this issue.
__________________

Last edited by OciXCrom; 11-30-2020 at 07:26.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
feren02
Senior Member
Join Date: Mar 2012
Old 12-01-2020 , 09:07   Re: Admin Weapon Skins Error
Reply With Quote #9

Quote:
Originally Posted by OciXCrom View Post
By deleting the mirrored model and using the one that is right-handed by default. You don't need to use both .mdl files. Always use v_models that are right-handed to avoid this issue.
I got it, worked for some v_model. But is it still okay to stretch on what codes to add in the .sma if ever to force a weapon view model: e.g. v_neonak47.mdl to left and v_neonak47_r.mdl to righthand?

Really appreciate all the help. I am really learning a lot.
feren02 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 03:40.


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