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

Weapon Model Replacement


Post New Thread Reply   
 
Thread Tools Display Modes
IoNut1290
Junior Member
Join Date: Oct 2019
Location: Newcastle
Old 01-25-2021 , 05:38   Re: Weapon Model Replacement
Reply With Quote #761

Hi

If you want to add a new model,one that cs doesn’t have. How do i tell the plugin to add that model?

Tried to put medical mask.

1st try was only “modelas/new/medical_mask.mdl” “T” (and CT next line) and didn’t work

2nd try i’ve put the same model in models folder medical-mask and went

“Models/medical-mask/medical_mask.mdl “models/new/medical_mask.mdl” T but didn’t work

New files named he same .ztmp appeared after i’ve restared the server. Min models is on 0
IoNut1290 is offline
Rhytham
Junior Member
Join Date: Dec 2020
Old 01-26-2021 , 00:15   Re: Weapon Model Replacement
Reply With Quote #762

Quote:
Originally Posted by OciXCrom View Post
How is the name of the file relevant? Please don't try to post solutions when you have no clue what you're doing in life. Simple!
I have also made the same mistake at the first time!
PHP Code:
"models/v_awp.mdl" "models/myawp.mdl" 

Last edited by Rhytham; 01-26-2021 at 00:18. Reason: I have also made made the same mistake at the first time!
Rhytham is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-26-2021 , 07:16   Re: Weapon Model Replacement
Reply With Quote #763

I don't see a mistake there. If your file is named "myawp.mdl", of course you will write "my_awp.mdl" and not "v_myawp.mdl" in the file. Use your brain, please.
There is no part in the code that checks if the filename contains "v_" or something like that and there's no reason for it to have such a thing.
__________________

Last edited by OciXCrom; 01-26-2021 at 07:18.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Whoisnext
Member
Join Date: Apr 2020
Old 04-05-2021 , 16:44   Re: Weapon Model Replacement
Reply With Quote #764

Can someone help me i want to make everyone who joins to have default player models, how do i do that, don't understand very well with the "sv download .. " do i need FDL for this or it can work without fdl too ?
Whoisnext is offline
Old 05-31-2021, 15:55
roots
This message has been deleted by roots. Reason: Wrong post
roots
Junior Member
Join Date: Apr 2020
Old 05-31-2021 , 15:55   Re: Weapon Model Replacement
Reply With Quote #765

Hello, thanks for the plugin, the weapon from the ground are not with skins. Is there a way make those with skins also? Thanks
roots is offline
drag1c
Junior Member
Join Date: Apr 2014
Location: Serbia, Nova Pazova
Old 11-16-2021 , 14:21   Re: Weapon Model Replacement
Reply With Quote #766

Quote:
Originally Posted by GHW_Chronic View Post
  • This plugin allows you to replace all client's weapon models + sounds to custom skins from your server. In Example: You found a pretty M4A1 model that you want everyone to use cause it's so leet, you can download it and put it onto your server and edit the config file to use the custom M4A1's models. Sounds however only work for melee weapons (IE: knife, crowbar).


Config file Info:
  • new_weapons.ini is read for every map if new_weapons_mapname.ini is not found. (IE: new_weapons_de_dust2.ini)
  • Team name that comes after the models/sounds can be both without or with quotes. The team is optional, if no team specified the model/sound will be applied to all players on all teams. If you do specify a team it should be one of the following:
    • T
    • Terrorist
    • Terrorists
    • Blue
    • B
    • Allies
    • 1
    • CT
    • Counter
    • Counter-Terrorist
    • Counter-Terrorists
    • CounterTerrorists
    • CounterTerrorist
    • Red
    • R
    • Axis
    • 2
    • Yellow
    • Y
    • 3
    • Green
    • G
    • 4

Notes:
    • Note 1: The more models + sounds you replace into the config file the less efficient this plugin will become. This doesn't mean that you cannot put a bunch of models + sounds into the config file, nor that it is not recommended, just that if your server experiences higher ping, consider reducing the number of replaced models + sounds.
    • Note 2: By default you can replace a max of 50 v_models + 50 p_models + 50 w_models + 50 sounds. You can change this on lines 5 - 9 of the .sma file then you'll have to recompile+replace the plugin with the new .sma file and you are good2go.
    • Note 3: Remember, the client has to download every model + sound that you are replacing upon entering the server. Don't go overboard please.
    • Note 4: you cannot replace any sound files except for melee weapons.
    • Note 5: Stay away from using symbols in your file and folder names. Example: "sound/weapons/==GHW==/knife_slash1.wav" is a bad name. "sound/weapons/GHW/knife_slash1-2.wav" is also a bad name.
      Note 6: Can't replace shield models.


Recommendations:
FPS Banana (skins)
sv_downloadurl
_
Could anyone change public Changeweapon_Hook(id) so it has option say: /skins
to load and unload skins if player wish to have default?
drag1c is offline
Send a message via Skype™ to drag1c
Siska1
Senior Member
Join Date: Feb 2020
Location: BedRock
Old 12-08-2021 , 05:25   Re: Weapon Model Replacement
Reply With Quote #767

Quote:
Originally Posted by drag1c View Post
Could anyone change public Changeweapon_Hook(id) so it has option say: /skins
to load and unload skins if player wish to have default?
Here with /skins :
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define MAX_SOUNDS   50
#define MAX_p_MODELS   50
#define MAX_v_MODELS   50
#define MAX_w_MODELS   50

#define MAP_CONFIGS   1

new new_sounds[MAX_SOUNDS][48]
new old_sounds[MAX_SOUNDS][48]
new soundsnum

new new_p_models[MAX_p_MODELS][48]
new old_p_models[MAX_p_MODELS][48]
new p_modelsnum

new new_v_models[MAX_v_MODELS][48]
new old_v_models[MAX_v_MODELS][48]
new v_modelsnum

new new_w_models[MAX_w_MODELS][48]
new old_w_models[MAX_w_MODELS][48]
new w_modelsnum

new maxplayers
new g_bDisabled[33]

public plugin_init()
{
    register_plugin("Weapon Model + Sound Replacement","1.2","GHW_Chronic")
    register_forward(FM_EmitSound,"Sound_Hook")
    register_forward(FM_SetModel,"W_Model_Hook",1)
    register_logevent("newround",2,"1=Round_Start")
    register_event("CurWeapon","Changeweapon_Hook","be","1=1")
    register_clcmd("say /skins", "ToggleSkins")
    register_clcmd("say_team /skins", "ToggleSkins")
    maxplayers = get_maxplayers()
}

public client_putinserver(id)
    g_bDisabled[id] = false

public ToggleSkins(id)
{
    g_bDisabled[id] = !g_bDisabled[id]
    client_print(id, print_chat, "* Weapon skins have been %s.", g_bDisabled[id] ? "disabled" : "enabled")
    return PLUGIN_HANDLED
}

public plugin_precache()
{
    new configfile[200]
    new configsdir[200]
    new map[32]
    get_configsdir(configsdir,199)
    get_mapname(map,31)
    format(configfile,199,"%s/new_weapons_%s.ini",configsdir,map)
    if(file_exists(configfile))
    {
        load_models(configfile)
    }
    else
    {
        format(configfile,199,"%s/new_weapons.ini",configsdir)
        load_models(configfile)
    }
}

public load_models(configfile[])
{
    if(file_exists(configfile))
    {
        new read[96], left[48], right[48], trash
        for(new i=0;i<file_size(configfile,1);i++)
        {
            read_file(configfile,i,read,95,trash)
            if(containi(read,";")!=0 && containi(read," ")!=-1)
            {
                strbreak(read,left,47,right,47)
                replace_all(right,47,"^"","")
                if(file_exists(right))
                {
                    if(containi(right,".mdl")==strlen(right)-4)
                    {
                        if(!precache_model(right))
                        {
                            log_amx("Error attempting to precache model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
                        }
                        else if(containi(left,"models/p_")==0)
                        {
                            format(new_p_models[p_modelsnum],47,right)
                            format(old_p_models[p_modelsnum],47,left)
                            p_modelsnum++
                        }
                        else if(containi(left,"models/v_")==0)
                        {
                            format(new_v_models[v_modelsnum],47,right)
                            format(old_v_models[v_modelsnum],47,left)
                            v_modelsnum++
                        }
                        else if(containi(left,"models/w_")==0)
                        {
                            format(new_w_models[w_modelsnum],47,right)
                            format(old_w_models[w_modelsnum],47,left)
                            w_modelsnum++
                        }
                        else
                        {
                            log_amx("Model type(p_ / v_ / w_) unknown for model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
                        }
                    }
                    else if(containi(right,".wav")==strlen(right)-4 || containi(right,".mp3")==strlen(right)-4)
                    {
                        replace(right,47,"sound/","")
                        replace(left,47,"sound/","")
                        if(!precache_sound(right))
                        {
                            log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
                        }
                        else
                        {
                            format(new_sounds[soundsnum],47,right)
                            format(old_sounds[soundsnum],47,left)
                            soundsnum++
                        }
                    }
                    else
                    {
                        log_amx("Invalid File: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
                    }
                }
                else
                {
                    log_amx("File Inexistent: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
                }
                if(!file_exists(left))
                {
                    log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1)
                }
            }
        }
    }
}

public Changeweapon_Hook(id)
{
    if(!is_user_alive(id) || g_bDisabled[id])
    {
        return PLUGIN_CONTINUE
    }
    static model[32], i
    
    pev(id,pev_viewmodel2,model,31)
    for(i=0;i<v_modelsnum;i++)
    {
        if(equali(model,old_v_models[i]))
        {
            set_pev(id,pev_viewmodel2,new_v_models[i])
            break;
        }
    }
    
    pev(id,pev_weaponmodel2,model,31)
    for(i=0;i<p_modelsnum;i++)
    {
        if(equali(model,old_p_models[i]))
        {
            set_pev(id,pev_weaponmodel2,new_p_models[i])
            break;
        }
    }
    return PLUGIN_CONTINUE
}

public Sound_Hook(id,channel,sample[])
{
    if(!is_user_alive(id) || g_bDisabled[id])
    {
        return FMRES_IGNORED
    }
    if(channel!=CHAN_WEAPON && channel!=CHAN_ITEM)
    {
        return FMRES_IGNORED
    }
    static i
    for(i=0;i<soundsnum;i++)
    {
        if(equali(sample,old_sounds[i]))
        {
            engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM)
            return FMRES_SUPERCEDE
        }
    }
    return FMRES_IGNORED
}

public W_Model_Hook(ent,model[])
{
    if(!pev_valid(ent))
    {
        return FMRES_IGNORED
    }
    static i
    for(i=0;i<w_modelsnum;i++)
    {
        if(equali(model,old_w_models[i]))
        {
            engfunc(EngFunc_SetModel,ent,new_w_models[i])
            return FMRES_SUPERCEDE
        }
    }
    return FMRES_IGNORED
}

public newround()
{
    static ent, classname[8], model[32]
    ent = engfunc(EngFunc_FindEntityInSphere,maxplayers,Float:{0.0,0.0,0.0},4800.0)
    while(ent)
    {
        pev(ent,pev_classname,classname,7)
        if(containi(classname,"armoury")!=-1)
        {
            pev(ent,pev_model,model,31)
            W_Model_Hook(ent,model)
        }
        ent = engfunc(EngFunc_FindEntityInSphere,ent,Float:{0.0,0.0,0.0},4800.0)
    }
}
Siska1 is offline
Send a message via Skype™ to Siska1
Surimi
Junior Member
Join Date: Apr 2022
Old 04-25-2022 , 12:49   Re: Weapon Model Replacement
Reply With Quote #768

Can someone make it so we can also change the sprites and gfx of the gun please ?
Surimi is offline
kirksite
Member
Join Date: Feb 2021
Old 08-21-2022 , 10:05   Re: Weapon Model Replacement
Reply With Quote #769

I've been using this plugin on 2 servers for 6 months with no issues until recently installing two new maps.

csg_office
csg_office_night

the plugin works on csg_office_night but crashes the server on the other. Once I disable the plugin the csg_office runs fine. There is NOTHING in the logs to indicate what the issue may be.

Seems the only difference in the two maps is the skyboxes and lighting, why would this cause a conflict? There is nothing in the logs to indicate why the server crashes.

Last edited by kirksite; 08-21-2022 at 10:54.
kirksite is offline
kirksite
Member
Join Date: Feb 2021
Old 08-22-2022 , 14:16   Re: Weapon Model Replacement
Reply With Quote #770

Quote:
Originally Posted by kirksite View Post
I've been using this plugin on 2 servers for 6 months with no issues until recently installing two new maps.

csg_office
csg_office_night

the plugin works on csg_office_night but crashes the server on the other. Once I disable the plugin the csg_office runs fine. There is NOTHING in the logs to indicate what the issue may be.

Seems the only difference in the two maps is the skyboxes and lighting, why would this cause a conflict? There is nothing in the logs to indicate why the server crashes.
What I've done to trouble shoot this issue, is I've confirmed diss-abling GHW plugin and map loads/plays normally.

Enabled the GHW plugin and renamed the night skybox files to match the day skybox files (csg_office_night map works) and replaced the day office skyboxes with these and the server still crashed when loading at the pre-caching resources point.

Removed all text from the new_weapons.ini file and the server still crashed at the same pre-caching resources point.

Summary, not a skybox problem, not a mdl problem. csg_office_night and csg_office have other differences than what is displayed in their respective res files. Since I did not build the map I've taken that part of the troubleshooting as far as I can go.

I was hoping this issue had been presented or reported on other maps and there was a known fix.

Last edited by kirksite; 08-22-2022 at 14:17.
kirksite 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 19:34.


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