Raised This Month: $ Target: $400
 0% 

Simple Weapon Skin Replacement Edit


Post New Thread Reply   
 
Thread Tools Display Modes
feruchio
Member
Join Date: Feb 2016
Location: 93.123.18.81:27017
Old 09-16-2016 , 07:02   Re: Simple Weapon Skin Replacement Edit
Reply With Quote #11

Quote:
Originally Posted by Craxor View Post
Yes, but if you have so much cases will be better to replace if and else if with switch

switch( get_user_weapon( id ) )
{
case: CSW_DEAGLE
{

}

case: CSW_AWP....
}

You know how to use switch no ?
The way I did above it it does not work, I enabled it but the .mdl files does not gets even dowloaded from the server. :X
I am not sure I know how switch works, but will try later that!
__________________
feruchio is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-16-2016 , 07:06   Re: Simple Weapon Skin Replacement Edit
Reply With Quote #12

Quote:
Originally Posted by feruchio View Post
The way I did above it it does not work, I enabled it but the .mdl files does not gets even dowloaded from the server. :X
I am not sure I know how switch works, but will try later that!

What do you mean downloanded by the server? The client needs to downloand the resoursces from the server if the client do not have them( you can't download maybe because you already have them ).

What's not working, is not changing the models or what? Don't forget will not work for simple users only for admins.

Edit:

PHP Code:
public plugin_precache( ) 

    
precache_modelv_knife ); 
    
precache_modelv_m4a1 ); 

You should precache all the new weapons you have been puted in.


Edit2:

And for more optimizations do the following.
  • Replace all if/elese if with switch()
  • Insert get_user_weapon(id) in a variable and put in switch, because you're using more times this native and eating more memory.

  • Now i'm talking bullshits but maybe is posibile to use read_data(2) insteand of using get_user_weapon(id) , here :https://wiki.alliedmods.net/Half-lif...ents#CurWeapon WeaponId is the second param ( i will make more test and come back ).(forgot about this...)
__________________
Project: Among Us

Last edited by Craxor; 09-16-2016 at 07:24.
Craxor is offline
Send a message via ICQ to Craxor
feruchio
Member
Join Date: Feb 2016
Location: 93.123.18.81:27017
Old 09-16-2016 , 17:57   Re: Simple Weapon Skin Replacement Edit
Reply With Quote #13

Okay I did that:
PHP Code:
#include <amxmodx> 
#include <amxmisc> 
#include <fakemeta> 


new const v_knife [] = "models/butterfly.mdl"
new const 
v_m4a1 [] = "models/m4a1_howl.mdl"
new const 
v_ak47 [] = "models/ak47_shark.mdl"
new const 
v_awp [] = "models/awp_abstract.mdl"
new const 
v_usp [] = "models/usp_comet.mdl"
new const 
v_glock18 [] = "models/glock18_water.mdl"
new const 
v_deagle [] = "models/deagle_flames.mdl"

new 
g_HaveFlags

public 
plugin_init( ) 

    
register_plugin"Server Models""1.0""feruchio" ); 


    
register_event"CurWeapon""event_Curwp""ae" ); 

    
g_HaveFlags register_cvar"admin_knife_flags""t" ); 



public 
plugin_precache( ) 

    
precache_modelv_knife ); 
    
precache_modelv_m4a1 );
    
precache_modelv_ak47 );
    
precache_modelv_awp );
    
precache_modelv_usp );
    
precache_modelv_glock18 );
    
precache_modelv_deagle );


public 
event_Curwpid 

    new 
szHaveFlag[15]; 
    
get_pcvar_stringg_HaveFlagsszHaveFlagcharsmaxszHaveFlag ) ) 

    if( 
has_all_flagsidszHaveFlag ) ) 
    { 
        if( 
get_user_weaponid ) == CSW_KNIFE 
            
set_pevidpev_viewmodel2v_knife ); 

        switch ( 
get_user_weaponid ) == CSW_M4A1 
            
set_pevidpev_viewmodel2v_m4a1 ); 
             
        switch ( 
get_user_weaponid ) == CSW_AK47 
            
set_pevidpev_viewmodel2v_ak47 ); 
             
        switch ( 
get_user_weaponid ) == CSW_AWP 
            
set_pevidpev_viewmodel2v_awp ); 
             
        switch ( 
get_user_weaponid ) == CSW_USP 
            
set_pevidpev_viewmodel2v_usp ); 
             
        switch ( 
get_user_weaponid ) == CSW_GLOCK18 
            
set_pevidpev_viewmodel2v_glock18 ); 
             
        switch ( 
get_user_weaponid ) == CSW_DEAGLE 
            
set_pevidpev_viewmodel2v_deagle ); 

        else 
            return 
PLUGIN_CONTINUE
    } 

    return 
PLUGIN_CONTINUE

but the compiler says:


And I have no idea how do I do that:
Quote:
Insert get_user_weapon(id) in a variable and put in switch, because you're using more times this native and eating more memory.
Can you do it for me?
__________________
feruchio is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-16-2016 , 18:28   Re: Simple Weapon Skin Replacement Edit
Reply With Quote #14

More like that:

Button
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
feruchio
Member
Join Date: Feb 2016
Location: 93.123.18.81:27017
Old 09-16-2016 , 19:07   Re: Simple Weapon Skin Replacement Edit
Reply With Quote #15

Sure I complied and added it but why the models does not show up, they does not get downloaded from the server to my counter-strike either? I have that t flag and I don't have the models in my csstike folder!
__________________

Last edited by feruchio; 09-16-2016 at 19:09.
feruchio is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-16-2016 , 19:14   Re: Simple Weapon Skin Replacement Edit
Reply With Quote #16

Quote:
Originally Posted by feruchio View Post
Sure I complied and added it but why the models does not show up, they does not get downloaded from the server to my counter-strike either? I have that t flag and I don't have the models in my csstike folder!
You server have the cvar sv_allowdownload to "1" ?

Your client has the cvar cl_downloadfilter "all" cl_allowdownload "1" cl_mindmodels , etc ... ?

Type "amxx list" ( in the server console ) to see if the plugin is instaled correctly!
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
feruchio
Member
Join Date: Feb 2016
Location: 93.123.18.81:27017
Old 09-18-2016 , 11:25   Re: Simple Weapon Skin Replacement Edit
Reply With Quote #17

Quote:
Originally Posted by Craxor View Post
You server have the cvar sv_allowdownload to "1" ?

Your client has the cvar cl_downloadfilter "all" cl_allowdownload "1" cl_mindmodels , etc ... ?

Type "amxx list" ( in the server console ) to see if the plugin is instaled correctly!
Yea for sure I have all of cvars set up correctly as I said before the plugin from the first post works!
When I typed amxx list this is the result from it:

HTML Code:
 [ 82] unknown                 unknown     unknown           weapon_replacem  bad load
__________________
feruchio is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-18-2016 , 11:27   Re: Simple Weapon Skin Replacement Edit
Reply With Quote #18

You're doing something wrong, especialy i think you've instaled the plugin in a wrong way, try to reinstal it, check if is exist in plugins folder and try to re-install it.
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 09-18-2016 , 11:34   Re: Simple Weapon Skin Replacement Edit
Reply With Quote #19

Look into server console logs for any errors related to this plugin.
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
feruchio
Member
Join Date: Feb 2016
Location: 93.123.18.81:27017
Old 09-19-2016 , 11:17   Re: Simple Weapon Skin Replacement Edit
Reply With Quote #20

Quote:
Originally Posted by Craxor View Post
You're doing something wrong, especialy i think you've instaled the plugin in a wrong way, try to reinstal it, check if is exist in plugins folder and try to re-install it.
Noope what wrong could I possible do? I just copied the code above then I went to https://spider.limetech.org/ paste it change above to amx mod x, downloaded it and replaced the old one in my plugins directory?

Quote:
Look into server console logs for any errors related to this plugin.
There is no errors in there too! :X
__________________

Last edited by feruchio; 09-19-2016 at 11:57.
feruchio 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:06.


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