View Single Post
Author Message
Hanna
Member
Join Date: Sep 2016
Old 09-04-2016 , 02:01   Viewmodel bodygroup switch example
Reply With Quote #1

This method forces game engine to think that in our hands there is no weapons. So we can completely rewrite the code of the main CS weapons. Why this way? Bcz
client side forces the animation replace 2 and not only. So we should completely resend everything from the server side to avoid bugs.
The way it's done is not very perfect, but it works in unique way, cz u can modify everything u want in simple way (not only view body switch, but damage, attack speed, recoil, rate and other).
There is three examples are attached, some people are saying the code is unreadable, but it's my style.

The blocking client side useful guide i found here (written by KCE):
https://forums.alliedmods.net/showthread.php?t=41265

From this thread, i've used method 1.

So, everything another part just was easy to complete. I' ve made 3 examples: knife, glock18, ak47.
You can put them together and test. While testing, use cl_lw 1 or 0 to see how it works.
I' ve seen once a person who made view body switch by another way, but it was buggy while using cl_lw 0. So...
Type in console switch_sex and set to 0 to view male hands. 1 is female.

Using this examples you can completely replace default CS weapon system and play with any bodygroup you want.

Updated: added shells, Glock18 Burst mode, removed some useless code again.
Updated: fix shoot event for other weapons, fix left-right hand auto switch
Attached Files
File Type: zip models.zip (1.12 MB, 386 views)
File Type: sma Get Plugin or Get Source (weapon_knife.sma - 1198 views - 3.3 KB)
File Type: sma Get Plugin or Get Source (weapon_glock18.sma - 1127 views - 6.8 KB)
File Type: sma Get Plugin or Get Source (weapon_ak47.sma - 1280 views - 5.1 KB)

Last edited by Hanna; 09-08-2016 at 16:34. Reason: A bit better description
Hanna is offline