Raised This Month: $51 Target: $400
 12% 

Custom Knives


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff       
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 10-05-2007 , 05:43   Custom Knives
Reply With Quote #1

==== Custom Knives ====

This plugin's purpose is to allow people to choose their knife models/sounds.

The models are retrieved from a configs file, and allows for replacement of:

V and P models. [ 1st and 3rd person ]
All sounds (individually).

The sounds can be replaced on a per-model per-sound basis.

Admin only models are also catered for.
The admin level required is #defined as ADMIN_KICK, but can be changed if you want to.

Example config file
<configs/knife replacer/default.ini>
or:
<.../mapname.ini> :
Quote:
[Axe] default
admin=0
p_model=models/p_axe.mdl
v_model=models/v_axe.mdl
deploy=weapons/axe-deploy.wav
hitwall=weapons/axe-hitwall.wav
slash1=weapons/axe-slash1.wav
slash2=weapons/axe-slash2.wav
stab=weapons/axe-stab.wav

[Kukri] default_admin
admin=1
p_model=models/p_axe.mdl
v_model=models/v_axe.mdl
deploy=weapons/kukri-deploy.wav
The p_model and v_model keys are required.
Others can be omitted to use the defaults.

The order of the keys is not important.

Commands:
Say /knife to have a menu display of all available knives.

admin_knife <target> <model index>
gives a knife model to a player (so you can give players an admin model)

Credits:
Massive credit to GHW_Chronic for the weapon model replacement plugin, where I got the knowledge on how to replace a model or sound.

And thanks to my testers:
maplebest
themohvision
Raz0rTK
Battousai-sama

And another little thanks to maplebest for getting me to add sound support.

Essential for anyone who likes model replacement and knives.

Quote:
Originally Posted by UPDATES:


-- 05/10/07 -

Removed an excess array and replaced by using EngFunc_AllocString

Fixed a small bug in hitwall sounds.

Fixed example settings to not contain "sound/"

Added a admin_knife function to give admin only models to players

Made /knife menu show which knife you have atm.

Fixed hitwall again.

Made "normal knife" instantly switch your knife back

changed charsmax to be sizeof -1

-- 07/10/07 --
Blocked /knife from showing in chat

Added map config support
Note change to default ini file path

-- 08/10/07 --
Fixed an error unique to the web-compiler with get_user_weapon

Stopped knife model appearing when knife not equipped

-- 09/10/07 --
Added a welcome/recurring message telling users to say /knife

Added "default" and "default_admin" config support

Fixed file not existing messages to show for sounds too

Added admin command admin_showknives to display all the knives and their indices ( for use with admin_knife )

-- 11/10/07 --

Fixed "file not exist" messages again ( "sound/" complications )

-- 31/10/07 --

Replaced "default" support, as downloading / reuploading seems to have lost it somewhere along the way ...

-- 11/12/07 --

Fixed an error when sounds were played for a non-player userid.

-- 13/12/07 --

Added public cvars for plugin tracking

-- 14/04/09 --

Changed allowed character length of filenames from 32 to 255
Please respect your users and do not force ridiculous downloads
And please, please, please do not use this (for more than about 5 files) if you don't have fast downloads.
Attached Files
File Type: sma Get Plugin or Get Source (knife_replacer.sma - 3334 views - 8.6 KB)

Last edited by purple_pixie; 04-14-2009 at 05:12. Reason: A lame attempt at making it look good ...
purple_pixie is offline
BlackMilk
Veteran Member
Join Date: Jun 2007
Old 10-05-2007 , 05:47   Re: Custom Knives
Reply With Quote #2

This is actually pretty cool, but I'll just leave out the sound files when I use this plugin xD
__________________
Mod:
User:
BlackMilk is offline
Pro Patria Finland
Senior Member
Join Date: Apr 2006
Location: BaronPub.com
Old 10-05-2007 , 05:52   Re: Custom Knives
Reply With Quote #3

Hasn't this been done like 10 times?

I like the way you've done this though.
__________________
I am not a number. I am Gordon Freeman!

Last edited by Pro Patria Finland; 10-05-2007 at 05:54.
Pro Patria Finland is offline
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 10-05-2007 , 05:59   Re: Custom Knives
Reply With Quote #4

Sort of.

I am not aware of any that allow each seperate model to have its own sounds.

If there is, please link it so I can rephrase that as
"Well yeah, but that one was written by a retarded fish that couldn't script, and it's no longer supported"

Last edited by purple_pixie; 10-05-2007 at 06:43.
purple_pixie is offline
BlackMilk
Veteran Member
Join Date: Jun 2007
Old 10-05-2007 , 10:20   Re: Custom Knives
Reply With Quote #5

This is pretty much unique, except if you start linking to every single existing plugin which changes a model.
__________________
Mod:
User:
BlackMilk is offline
`666
AlliedModders Donor
Join Date: Jan 2006
Old 10-05-2007 , 11:35   Re: Custom Knives
Reply With Quote #6

cheers! this is perfect for my server!
`666 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-05-2007 , 11:41   Re: Custom Knives
Reply With Quote #7

Good Job

This is perfect for knives servers or just ka_ maps.

Could you have a per map feature (also precache) ?
Could you also make p_ models optional ?

-edit-
#define charsmax(%1) sizeof %1

Isn't that should be :
#define charsmax(%1) sizeof %1 - 1
?????
ConnorMcLeod is offline
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 10-05-2007 , 11:59   Re: Custom Knives
Reply With Quote #8

If only everyone were as retarded as me, eh?

I'll have me a good think about map-specific configs.

And maybe even make p_models optional :-O

And anything that is not in the current config will not be precached, so once it depends on the map it will only precache the relevant models/sounds.

EDIT: With the p_models, you could always specify models/p_knife.mdl ...

But I will fix this, don't worry - it wouldn't be as efficient if you do that, anyway.

Last edited by purple_pixie; 10-05-2007 at 12:02.
purple_pixie is offline
maplebest
BANNED
Join Date: May 2007
Location: Sweden, Sverige
Old 10-05-2007 , 13:05   Re: Custom Knives
Reply With Quote #9

1. sounds still dont works.
2. Default knife stilll dont works.

The rest i PERFECT!
maplebest is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-05-2007 , 17:18   Re: Custom Knives
Reply With Quote #10

Pretty much pointless. Already done, doesn't add much of anything new, it just does a more direct, less dynamic way of changing models/sounds.

Unapproved.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 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:21.


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