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

[CS] CS 1.5 (Retro) Knife


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
anssik
Senior Member
Join Date: May 2006
Location: Suomi Finland Perkele
Old 02-10-2024 , 01:50   [CS] CS 1.5 (Retro) Knife
Reply With Quote #1

Very simple addon to use the CS 1.5 knife model in CS 1.6.

Note that only the p_knife_r.mdl needs to be downloaded from server, since v_knife_r.mdl already exist by default in CS1.6 installation but is unused. The w_knife.mdl is still the same 1.5 model in 1.6, so it doesn't need to be changed.

edit: use the code from the post below, as it is more efficient

Also note that while it's supposedly better to hook v_ / p_ model using
PHP Code:
RegisterHam(Ham_Item_Deploy"weapon_knife""OnKnifeDeploy"1
It doesn't work with bots or on knife maps. While the event method below always works.



PHP Code:
#include <amxmodx>
#include <engine>

#define PLUGIN "CS 1.5 Knife"
#define VERSION "1.0"
#define AUTHOR "kebabstorm"

#pragma semicolon 1

new const V_KNIFE_R[] = "models/v_knife_r.mdl";
new const 
P_KNIFE_R[] = "models/p_knife_r.mdl";

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_event("CurWeapon""EV_CurWeapon""be""1=1");
}

public 
plugin_precache()
{
    
precache_model(V_KNIFE_R);
    
precache_model(P_KNIFE_R);
}

public 
EV_CurWeapon(player)
{
    if (
get_user_weapon(player) == CSW_KNIFE) {
        
entity_set_string(playerEV_SZ_viewmodelV_KNIFE_R);
        
entity_set_string(playerEV_SZ_weaponmodelP_KNIFE_R);
    }

Attached Files
File Type: zip cs15_knife_models.zip (123.1 KB, 21 views)
__________________

Last edited by anssik; 02-14-2024 at 12:25.
anssik is offline
WATCH_D0GS UNITED
Senior Member
Join Date: Jan 2023
Old 02-10-2024 , 09:03   Re: [CS] CS 1.5 (Retro) Knife
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "CS 1.5 Knife"
#define VERSION "1.1"
#define AUTHOR "kebabstorm"

new const V_KNIFE_R[] = "models/v_knife_r.mdl"
new const P_KNIFE_R[] = "models/p_knife_r.mdl"

static iPlayer
static iWeapon

public plugin_init() {
        
register_plugin(PLUGINVERSIONAUTHOR);
        
RegisterHam(Ham_Item_Deploy,"weapon_knife","OnKnifeDeployPost",1)
}

public 
plugin_precache() {
        
precache_model(V_KNIFE_R)
        
precache_model(P_KNIFE_R)
}

public 
OnKnifeDeployPost(ent) {
        
iPlayer get_pdata_cbase(ent,41)
        
iWeapon get_pdata_int(ent,43)
        if(
iWeapon == CSW_KNIFE) {
                
set_pev(iPlayerpev_viewmodel2V_KNIFE_R)
                
set_pev(iPlayerpev_weaponmodel2P_KNIFE_R)
        }

Thanks for sharing!
Have a nice day.
__________________
💻Know Our New Blog👄
🔗tube2downs.blogspot.com
WATCH_D0GS UNITED is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-11-2024 , 06:40   Re: [CS] CS 1.5 (Retro) Knife
Reply With Quote #3

Please do not use CurWeapon to set weapon models. Use Ham_Item_Deploy.

To make it work with bots, look into RegisterHamFromEntity and provide a bot id, or if you are using amxx 1.9+, there are two easier solutions: set the last argument of RegisterHam called specialbot to true or use RegisterHamPlayer.

There should be no difference for knife maps, a knife is a knife and it is deployed in the same way no matter the map.
__________________

Last edited by HamletEagle; 02-11-2024 at 06:41.
HamletEagle is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Location: Siiiiiiiiuu
Old 02-11-2024 , 06:58   Re: [CS] CS 1.5 (Retro) Knife
Reply With Quote #4

There are some problems that will cause the model not change on item deploy but it’s always a programmer mistake.

If you use multiple model plugins to change the model of the same weapon you may encounter this “bug”. It isn’t really a bug just a bad server management.

Also, and derailing topic, i guy once asked me help because on Basebuilder a m4 model would display on Knife model. I guess it’s the fast weapon change that bb plugin causes on build time. At the time I didn’t had the opportunity to help the guy fixing but yeah. Item deploy despite reliable must be used carefully if you run multiple plugins with it.
__________________
Jhob94 is offline
anssik
Senior Member
Join Date: May 2006
Location: Suomi Finland Perkele
Old 02-11-2024 , 22:56   Re: [CS] CS 1.5 (Retro) Knife
Reply With Quote #5

@WATCH_D0GS UNITED

This version seems to indeed work correctly, even with bots and on knife maps.
So the problem was using Ham_Item_Deploy and then entity_set_string, which doesn't work correctly; by using set_pev it works. Thanks.
__________________
anssik is offline
metal_upa
Senior Member
Join Date: Jun 2016
Old 02-13-2024 , 08:52   Re: [CS] CS 1.5 (Retro) Knife
Reply With Quote #6

ReAPI method:
metal_upa 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 01:18.


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