How to make ZM Claw in Weapons List

Helping Topics
Post Reply
User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

How to make ZM Claw in Weapons List

#1

Post by Night Fury » 7 years ago

Hello, everyone. :)
What do you think about this? :P
For Zombies:
  • ImageImage
For Humans:
  • Image
Do you wanna know how did i make it?
It's very simple. :P
---------------------------------------------------------------------------------------------------
1-) You need to have your sprites, put it like this:

Code: Select all

new const WeaponList_Sprite[][] = { "sprites/knife_zombie.txt", "sprites/knife_zombie.spr" }
USE YOURS!!!!
---------------------------------------------------------------------------------------------------
2-) Precache them:

Code: Select all

public plugin_precache()
{
	for(new i = 0; i < sizeof WeaponList_Sprite; i++)
		precache_generic(WeaponList_Sprite[i])
		
	register_clcmd("knife_zombie", "hook") // You need to add this in precache, what's this? It calls the sprite(hud) when you need it (by your mouse)
}
---------------------------------------------------------------------------------------------------
3-)Add hook Function else you'll get errors:

Code: Select all

public hook(id)
{ 
	if(!is_user_alive(id))
		return PLUGIN_CONTINUE

	engclient_cmd(id, "weapon_knife")
	return PLUGIN_HANDLED
}
---------------------------------------------------------------------------------------------------
4-) You need to activate the sprite once ZM is infected:

Code: Select all

public ze_user_infected(iVictim, iInfector)
{
	WeaponList(iVictim, 1)
}
---------------------------------------------------
Don't forget to disable it for humans:

Code: Select all

public ze_user_humanized(id)
{
	WeaponList(id, 0)
}
---------------------------------------------------------------------------------------------------
5-) Activate your sprite by this stock:

Code: Select all

WeaponList(index, mode = 0)
{
	if (!is_user_alive(index))
		return
	
	message_begin(MSG_ONE, get_user_msgid("WeaponList"), {0, 0, 0}, index)
	write_string(mode ? "knife_zombie" : "weapon_knife")
	write_byte(-1)
	write_byte(-1)
	write_byte(-1)
	write_byte(-1)
	write_byte(2)
	write_byte(1)
	write_byte(29)
	write_byte(0)
	message_end()
}
---------------------------------------------------------------------------------------------------
Finally! Compile, add onto your server, change map/restart/start & HAVE FUN! :P :D

You can use this stock for anther guns (CSW_*) but you'll need to change this to the correct gun's information:

Code: Select all

write_string(mode ? "knife_zombie" : "weapon_knife")
write_byte(-1)
write_byte(-1)
write_byte(-1)
write_byte(-1)
write_byte(2)
write_byte(1)
write_byte(29)
write_byte(0)
As you see, this will work with this code only, if you wanna add it to (for example) ak47, replace weapon_knife with weapon_ak47 & don't forget to edit what i said.
---------------------------------------------------------------------------------------------------
Final code:
  1. #include <zombie_escape>   
  2.  
  3. new const WeaponList_Sprite[][] = { "sprites/knife_zombie.txt", "sprites/knife_zombie.spr" }
  4.  
  5. public plugin_precache()
  6. {
  7.     for(new i = 0; i < sizeof WeaponList_Sprite; i++)
  8.         precache_generic(WeaponList_Sprite[i])
  9.        
  10.     register_clcmd("knife_zombie", "hook")
  11. }
  12.  
  13. public hook(id)
  14. {
  15.     if(!is_user_alive(id))
  16.         return PLUGIN_CONTINUE
  17.  
  18.     engclient_cmd(id, "weapon_knife")
  19.     return PLUGIN_HANDLED
  20. }
  21.  
  22. public plugin_init()
  23. {
  24.     register_plugin("[ZE] Addons: Knife Hud", "1.0", "JaCk")
  25. }
  26.  
  27. public ze_user_infected(iVictim, iInfector)
  28. {
  29.     WeaponList(iVictim, 1)
  30. }
  31.  
  32. public ze_user_humanized(id)
  33. {
  34.     WeaponList(id, 0)
  35. }
  36.  
  37. WeaponList(index, mode = 0)
  38. {
  39.     if (!is_user_alive(index))
  40.         return
  41.    
  42.     message_begin(MSG_ONE, get_user_msgid("WeaponList"), {0, 0, 0}, index)
  43.     write_string(mode ? "knife_zombie" : "weapon_knife")
  44.     write_byte(-1)
  45.     write_byte(-1)
  46.     write_byte(-1)
  47.     write_byte(-1)
  48.     write_byte(2)
  49.     write_byte(1)
  50.     write_byte(29)
  51.     write_byte(0)
  52.     message_end()
  53. }
---------------------------------------------------------------------------------------------------
In the text file, you should have something like this:

Code: Select all

2 // This is sprites number
weapon			640 knife_zombie	0	180	170	45
weapon_s		640 knife_zombie	0	180	170	45
In text file, you need to enter those information correctly:

Code: Select all

numberOfSprites
<type> <resolution> <spriteFile> <shiftX> <shiftY> <width> <height>
You can get most of those from Paint.
---------------------------------------------------------------------------------------------------
Have a nice day! :D
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#2

Post by Raheem » 7 years ago

Very nice jack i'll try it :D.
He who fails to plan is planning to fail

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 5 guests