[CS] CS 1.5 (Retro) Knife

For scripting examples for learning how to use AMXX.
User avatar
Archive-Poster
Posts: 1189
Gender:
United States of America

[CS] CS 1.5 (Retro) Knife

Post by Archive-Poster »

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

Code: Select all

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.

Image

Code: Select all

#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(PLUGIN, VERSION, AUTHOR);
    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(player, EV_SZ_viewmodel, V_KNIFE_R);
        entity_set_string(player, EV_SZ_weaponmodel, P_KNIFE_R);
    }
} 
Attachments
cs15_knife_models.zip
(123.11 KiB) Downloaded 5 times

Who is online

Users browsing this forum: No registered users and 1 guest