Approved Custom Weapons Menu

Gameplay Addons
User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1951
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

Custom Weapons Menu

#1

Post by Raheem » 1 Year Ago

Golden Weapons

Description:
  • This plugin add custom weapons for higher level, it's an upgrade for Level Weapons Menu.
    1. Level 15 - Unlock Golden M3
    2. Level 20 - Unlock Golden MP5
    3. Level 25 - Unlock Golden M4A1
    4. Level 30 - Unlock Golden AK-47
    Thanks for Spir0x he suggested these guns in this order.
Information:
  • You will find the golden guns cvars inside each .sma file, change it as you need.
  • This will work on Zombie Escape Mod version >= 1.3
Screenshots:
  • ImageImageImageImageImage
Downloads:
These users thanked the author Raheem for the post:
Spir0x (1 Year Ago)
You don't know? Learn and you will know.

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 508
Joined: 2 Years Ago
Has thanked: 19 times
Been thanked: 1 time
Contact:

#2

Post by czirimbolo » 1 Year Ago

L 08/10/2018 - 19:13:10: Invalid CVAR pointer
L 08/10/2018 - 19:13:10: [AMXX] Displaying debug trace (plugin "ze_golden_m3.amxx", version "1.0")
L 08/10/2018 - 19:13:10: [AMXX] Run time error 10: native error (native "get_pcvar_num")
L 08/10/2018 - 19:13:10: [AMXX] [0] ze_golden_m3.sma::make_tracer (line 209)
Image

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1951
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#3

Post by Raheem » 1 Year Ago

Fixed.
You don't know? Learn and you will know.

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 192
Joined: 2 Years Ago
Has thanked: 14 times
Been thanked: 7 times
Age: 20
Contact:

#4

Post by sPe3doN » 1 Year Ago

Code: Select all

expected at least 6, real 1
L 08/11/2018 - 22:51:39: [AMXX] Run time error 1 (plugin "ze_golden_m4a1.amxx") - forced exit
L 08/11/2018 - 22:51:39: [AMXX] Plugin ("ze_golden_mp5.amxx") is setting itself as failed.
L 08/11/2018 - 22:51:39: [AMXX] Plugin says: [ReAPI]: Api minor version mismatch; expected at least 6, real 1
L 08/11/2018 - 22:51:39: [AMXX] Run time error 1 (plugin "ze_golden_mp5.amxx") - forced exit
L 08/11/2018 - 22:51:39: [AMXX] Plugin ("ze_goldenak.amxx") is setting itself as failed.
L 08/11/2018 - 22:51:39: [AMXX] Plugin says: [ReAPI]: Api minor version mismatch; expected at least 6, real 1
L 08/11/2018 - 22:51:39: [AMXX] Run time error 1 (plugin "ze_goldenak.amxx") - forced exit
L 08/11/2018 - 22:51:53: Called dynanative into a paused plugin.
L 08/11/2018 - 22:51:53: [AMXX] Run time error 10 (plugin "ze_weapon_menu.amxx") (native "give_golden_mp5") - debug not enabled!

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1951
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#5

Post by Raheem » 1 Year Ago

Compile these plugins with your compiler and make sure that reapi includes match reapi version you are using on your server.
You don't know? Learn and you will know.

User avatar
Prekrasnoe Daleko
Member
Member
Russia
Posts: 32
Joined: 1 Year Ago
Location: Россия,Крым
Has thanked: 11 times
Been thanked: 1 time
Age: 20
Contact:

#6

Post by Prekrasnoe Daleko » 1 Year Ago

Raheem , help.
L 08/13/2018 - 12:18:35: Invalid index 13 (count: 13
L 08/13/2018 - 12:18:35: [AMXX] Displaying debug trace (plugin "ze_weapon_menu.amxx", version "1.1")
L 08/13/2018 - 12:18:35: [AMXX] Run time error 10: native error (native "ArrayGetString")
L 08/13/2018 - 12:18:35: [AMXX] [0] ze_weapon_menu.sma::Show_Menu_Buy_Primary (line 446)
L 08/13/2018 - 12:18:35: [AMXX] [1] ze_weapon_menu.sma::Menu_Buy_Primary (line 598)
L 08/13/2018 - 12:18:38: Invalid index 13 (count: 13)
L 08/13/2018 - 12:18:38: [AMXX] Displaying debug trace (plugin "ze_weapon_menu.amxx", version "1.1")
L 08/13/2018 - 12:18:38: [AMXX] Run time error 10: native error (native "ArrayGetString")
L 08/13/2018 - 12:18:38: [AMXX] [0] ze_weapon_menu.sma::Show_Menu_Buy_Primary (line 446)
L 08/13/2018 - 12:18:38: [AMXX] [1] ze_weapon_menu.sma::Show_Available_Buy_Menus (line 324)
L 08/13/2018 - 12:18:38: [AMXX] [2] ze_weapon_menu.sma::Cmd_Buy (line 249)
L 08/13/2018 - 12:18:39: Invalid index 13 (count: 13)
L 08/13/2018 - 12:18:39: [AMXX] Displaying debug trace (plugin "ze_weapon_menu.amxx", version "1.1")
L 08/13/2018 - 12:18:39: [AMXX] Run time error 10: native error (native "ArrayGetString")
L 08/13/2018 - 12:18:39: [AMXX] [0] ze_weapon_menu.sma::Show_Menu_Buy_Primary (line 446)
L 08/13/2018 - 12:18:39: [AMXX] [1] ze_weapon_menu.sma::Show_Available_Buy_Menus (line 324)
L 08/13/2018 - 12:18:39: [AMXX] [2] ze_weapon_menu.sma::Cmd_Buy (line 249)

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1951
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#7

Post by Raheem » 1 Year Ago

In zombie_escape.ini you should have these weapons:
  • Code: Select all

    PRIMARY = weapon_xm1014 , weapon_ump45 , weapon_m3 , weapon_mp5navy , weapon_p90 , weapon_galil , weapon_famas , weapon_sg550 , weapon_g3sg1 , weapon_m249 , weapon_sg552 , weapon_aug , weapon_m4a1 , weapon_ak47
In case you removed any of them you will get this error, they should be 14 weapon not less/more. If you need to remove weapons you can tell me which you don't need and in this case i will need to edit the plugin for you.
These users thanked the author Raheem for the post:
Prekrasnoe Daleko (1 Year Ago)
You don't know? Learn and you will know.

User avatar
Prekrasnoe Daleko
Member
Member
Russia
Posts: 32
Joined: 1 Year Ago
Location: Россия,Крым
Has thanked: 11 times
Been thanked: 1 time
Age: 20
Contact:

#8

Post by Prekrasnoe Daleko » 1 Year Ago

Raheem wrote:
1 Year Ago
In zombie_escape.ini you should have these weapons:
  • Code: Select all

    PRIMARY = weapon_xm1014 , weapon_ump45 , weapon_m3 , weapon_mp5navy , weapon_p90 , weapon_galil , weapon_famas , weapon_sg550 , weapon_g3sg1 , weapon_m249 , weapon_sg552 , weapon_aug , weapon_m4a1 , weapon_ak47
In case you removed any of them you will get this error, they should be 14 weapon not less/more. If you need to remove weapons you can tell me which you don't need and in this case i will need to edit the plugin for you.
thanks Raheem all work

User avatar
Prekrasnoe Daleko
Member
Member
Russia
Posts: 32
Joined: 1 Year Ago
Location: Россия,Крым
Has thanked: 11 times
Been thanked: 1 time
Age: 20
Contact:

#9

Post by Prekrasnoe Daleko » 1 Year Ago

Raheem, gold weapons very little patrons 1 magazine

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1951
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#10

Post by Raheem » 1 Year Ago

Issue from the weapons itself OK here it's just compile them using our ZE compiler.

1. M3
  • Code: Select all

    /*
    [ZP] Extra Item: Golden M3
    Team: Humans
    
    Description: This plugin adds a new weapon for Human Teams.
    Weapon Cost: 30
    
    Features:
    - This weapon do more damage
    - This weapon has zoom
    - Launch Lasers
    - This weapon has unlimited bullets
    
    Cvars:
    
    
    - ze_goldenm3_dmg <5> - Damage Multiplier for Golden M3
    - ze_goldenm3_custom_model <1|0> - Golden M3 Custom Model
    - ze_goldenm3_unlimited_clip <1|0> - Golden M3 Unlimited Clip 
    
    */
    
    
    
    #include <zombie_escape>
    #include <engine>
    #include <fun>
    #include <cstrike>
    
    #define is_valid_player(%1) (1 <= %1 <= 32)
    #define ENG_NULLENT		-1
    #define EV_INT_WEAPONKEY	EV_INT_impulse
    #define GAK_WEAPONKEY	666
    new const g_GAKEnt[] = "weapon_m3"
    
    new M3_V_MODEL[64] = "models/zombie_escape/v_golden_m3.mdl"
    new M3_P_MODEL[64] = "models/p_m3.mdl"
    new M3_W_MODEL[64] = "models/zombie_escape/w_golden_m3.mdl"
    
    /* Pcvars */
    new cvar_dmgmultiplier, cvar_custommodel, cvar_uclip, cvar_goldbullets
    
    new bool:g_HasM3[33]
    
    new g_hasZoom[ 33 ]
    new bullets[ 33 ]
    
    // Sprite
    new m_spriteTexture
    
    const Wep_M3 = ((1<<CSW_M3))
    
    public plugin_init()
    {
    	
    	/* CVARS */
    	cvar_dmgmultiplier = register_cvar("ze_goldenm3_dmg", "2")
    	cvar_custommodel = register_cvar("ze_goldenm3_custom_model", "1")
    	cvar_uclip = register_cvar("ze_goldenm3_unlimited_clip", "0")
    	cvar_goldbullets = 	cvar_uclip = register_cvar("ze_goldenm3_goldbullets", "1")
    	
    	// Register The Plugin
    	register_plugin("[ZP] Extra: Golden M3", "1.0", "TheArmagedon")
    	register_cvar("Shidla", "[ZP] Golden M3", FCVAR_SERVER|FCVAR_SPONLY)
    
    	// Death Msg
    	register_event("DeathMsg", "Death", "a")
    	// Weapon Pick Up
    	register_event("WeapPickup","checkModel","b","1=19")
    	// Current Weapon Event
    	register_event("CurWeapon","checkWeapon","be","1=1")
    	register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
    	// Ham TakeDamage
    	RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
    	register_forward( FM_CmdStart, "fw_CmdStart" )
    	RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
    	RegisterHam(Ham_Item_AddToPlayer, g_GAKEnt, "fw_GAK47AddToPlayer")
    	
    	register_forward(FM_SetModel, "fw_SetModel")
    	
    }
    
    public plugin_natives()
    {
    	register_native("give_golden_m3", "native_give_golden_m3", 1)
    }
    
    public client_connect(id)
    {
    	g_HasM3[id] = false
    }
    
    public client_disconnected(id)
    {
    	g_HasM3[id] = false
    }
    
    public Death()
    {
    	g_HasM3[read_data(2)] = false
    }
    
    public fwHamPlayerSpawnPost(id)
    {
    	g_HasM3[id] = false
    }
    
    public plugin_precache()
    {
    	precache_model(M3_V_MODEL)
    	precache_model(M3_P_MODEL)
    	precache_model(M3_W_MODEL)
    	m_spriteTexture = precache_model("sprites/dot.spr")
    	precache_sound("weapons/zoom.wav")
    }
    
    public zp_user_infected_post(id)
    {
    	if (ze_is_user_zombie(id))
    	{
    		g_HasM3[id] = false
    	}
    }
    
    public checkModel(id)
    {
    	if ( ze_is_user_zombie(id) )
    		return PLUGIN_HANDLED
    	
    	new szWeapID = read_data(2)
    	
    	if ( szWeapID == CSW_M3 && g_HasM3[id] == true && get_pcvar_num(cvar_custommodel) )
    	{
    		set_pev(id, pev_viewmodel2, M3_V_MODEL)
    		set_pev(id, pev_weaponmodel2, M3_P_MODEL)
    	}
    	return PLUGIN_HANDLED
    }
    
    public checkWeapon(id)
    {
    	new plrClip, plrAmmo, plrWeap[32]
    	new plrWeapId
    	
    	plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
    	
    	if (plrWeapId == CSW_M3 && g_HasM3[id])
    	{
    		checkModel(id)
    	}
    	else 
    	{
    		return PLUGIN_CONTINUE
    	}
    	
    	if (plrClip == 0 && get_pcvar_num(cvar_uclip))
    	{
    		// If the user is out of ammo..
    		get_weaponname(plrWeapId, plrWeap, 31)
    		// Get the name of their weapon
    		give_item(id, plrWeap)
    		engclient_cmd(id, plrWeap) 
    		engclient_cmd(id, plrWeap)
    		engclient_cmd(id, plrWeap)
    	}
    	return PLUGIN_HANDLED
    }
    
    
    
    public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
    {
        if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_M3 && g_HasM3[attacker] )
        {
            SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
        }
    }
    
    public fw_CmdStart( id, uc_handle, seed )
    {
    	if( !is_user_alive( id ) ) 
    		return PLUGIN_HANDLED
    	
    	if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) )
    	{
    		new szClip, szAmmo
    		new szWeapID = get_user_weapon( id, szClip, szAmmo )
    		
    		if( szWeapID == CSW_M3 && g_HasM3[id] == true && !g_hasZoom[id] == true)
    		{
    			g_hasZoom[id] = true
    			cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 0 )
    			emit_sound( id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100 )
    		}
    		
    		else if ( szWeapID == CSW_M3 && g_HasM3[id] == true && g_hasZoom[id])
    		{
    			g_hasZoom[ id ] = false
    			cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
    			
    		}
    		
    	}
    	return PLUGIN_HANDLED
    }
    
    
    public make_tracer(id)
    {
    	if (get_pcvar_num(cvar_goldbullets))
    	{
    		new clip,ammo
    		new wpnid = get_user_weapon(id,clip,ammo)
    		new pteam[16]
    		
    		get_user_team(id, pteam, 15)
    		
    		if ((bullets[id] > clip) && (wpnid == CSW_M3) && g_HasM3[id]) 
    		{
    			new vec1[3], vec2[3]
    			get_user_origin(id, vec1, 1) // origin; your camera point.
    			get_user_origin(id, vec2, 4) // termina; where your bullet goes (4 is cs-only)
    			
    			
    			//BEAMENTPOINTS
    			message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
    			write_byte (0)     //TE_BEAMENTPOINTS 0
    			write_coord(vec1[0])
    			write_coord(vec1[1])
    			write_coord(vec1[2])
    			write_coord(vec2[0])
    			write_coord(vec2[1])
    			write_coord(vec2[2])
    			write_short( m_spriteTexture )
    			write_byte(1) // framestart
    			write_byte(5) // framerate
    			write_byte(2) // life
    			write_byte(10) // width
    			write_byte(0) // noise
    			write_byte( 255 )     // r, g, b
    			write_byte( 215 )       // r, g, b
    			write_byte( 0 )       // r, g, b
    			write_byte(200) // brightness
    			write_byte(150) // speed
    			message_end()
    		}
    	
    		bullets[id] = clip
    	}
    	
    }
    
    public native_give_golden_m3(player)
    {
    	if ( user_has_weapon(player, CSW_M3) )
    	{
    		drop_prim(player)
    	}
    	
    	give_item(player, "weapon_m3")
    	cs_set_user_bpammo(player, CSW_M3, 32)
    	
    	g_HasM3[player] = true;
    }
    
    // Set Model
    public fw_SetModel(entity, model[])
    {
    	// Entity is not valid
    	if(!is_valid_ent(entity))
    		return FMRES_IGNORED;
    		
    	// Entity model is not w_ak47
    	if(!equal(model, "models/w_m3.mdl")) 
    		return FMRES_IGNORED;
    		
    	// Get classname
    	static szClassName[33]
    	entity_get_string(entity, EV_SZ_classname, szClassName, charsmax(szClassName))
    		
    	// Not a Weapon box
    	if(!equal(szClassName, "weaponbox"))
    		return FMRES_IGNORED
    	
    	// Some vars
    	static iOwner, iStoredGalilID
    	
    	// Get owner
    	iOwner = entity_get_edict(entity, EV_ENT_owner)
    	
    	// Get drop weapon index (galil) to use in fw_Galil_AddToPlayer forward
    	iStoredGalilID = find_ent_by_owner(ENG_NULLENT, "weapon_ak47", entity)
    	
    	// Entity classname is weaponbox, and galil has founded
    	if(g_HasM3[iOwner] && is_valid_ent(iStoredGalilID))
    	{
    		// Setting weapon options
    		entity_set_int(iStoredGalilID, EV_INT_WEAPONKEY, GAK_WEAPONKEY)
    
    		// Reset user vars
    		g_HasM3[iOwner] = false
    		
    		// Set weaponbox new model
    		entity_set_model(entity, M3_W_MODEL)
    		
    		return FMRES_SUPERCEDE
    	}
    
    	return FMRES_IGNORED
    }
    
    // Give
    public fw_GAK47AddToPlayer (GAK47, id)
    {
    	// Make sure that this is M79
    	if( is_valid_ent(GAK47) && is_user_connected(id) && entity_get_int(GAK47, EV_INT_WEAPONKEY) == GAK_WEAPONKEY)
    	{
    		// Update
    		g_HasM3[id] = true
    
    		// Reset weapon options
    		entity_set_int(GAK47, EV_INT_WEAPONKEY, 0)
    
    		return HAM_HANDLED
    	}
    
    	return HAM_IGNORED
    }
    
    stock drop_prim(id) 
    {
    	new weapons[32], num
    	get_user_weapons(id, weapons, num)
    	for (new i = 0; i < num; i++) {
    		if (Wep_M3 & (1<<weapons[i])) 
    		{
    			static wname[32]
    			get_weaponname(weapons[i], wname, sizeof wname - 1)
    			engclient_cmd(id, "drop", wname)
    		}
    	}
    }
2. MP5
  • Code: Select all

    #include <zombie_escape>
    #include <cstrike>
    #include <fun>
    
    #define is_valid_player(%1) (1 <= %1 <= 32)
    
    new gmp5_V_MODEL[64] = "models/zombie_escape/v_mp5navygold.mdl"
    new gmp5_P_MODEL[64] = "models/zombie_escape/p_mp5navygold.mdl"
    
    /* Pcvars */
    new cvar_dmgmultiplier, cvar_goldbullets,  cvar_custommodel, cvar_uclip
    new bool:g_Hasmp5navy[33], g_hasZoom[ 33 ], bullets[ 33 ]
    // Sprite
    new m_spriteTexture
    
    const Wep_mp5navy = ((1<<CSW_MP5NAVY))
    
    public plugin_init()
    {
    	/* CVARS */
    	cvar_dmgmultiplier = register_cvar("gmp5_dmg_multiplier", "3")
    	cvar_custommodel = register_cvar("gmp5_custom_model", "1")
    	cvar_goldbullets = register_cvar("gmp5_gold_bullets", "1")
    	cvar_uclip = register_cvar("gmp5_unlimited_clip", "0")
    	
    	// Register The Plugin
    	register_plugin("Golden MP5", "1.1", "Wisam187 : JaCk")
    
    	// Events
    	register_event("DeathMsg", "Death", "a")
    	register_event("WeapPickup","checkModel","b","1=19")
    	register_event("CurWeapon","checkWeapon","be","1=1")
    	register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
    	// Hams
    	RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
    	register_forward( FM_CmdStart, "fw_CmdStart" )
    	RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
    	
    }
    
    public client_connect(id)
    {
    	g_Hasmp5navy[id] = false
    }
    
    public client_disconnected(id)
    {
    	g_Hasmp5navy[id] = false
    }
    
    public Death()
    {
    	g_Hasmp5navy[read_data(2)] = false
    }
    
    public fwHamPlayerSpawnPost(id)
    {
    	g_Hasmp5navy[id] = false
    }
    
    public plugin_precache()
    {
    	precache_model(gmp5_V_MODEL)
    	precache_model(gmp5_P_MODEL)
    	m_spriteTexture = precache_model("sprites/dot.spr")
    	precache_sound("weapons/zoom.wav")
    }
    
    public ze_user_infected(id)
    {
    	g_Hasmp5navy[id] = false
    }
    
    public checkModel(id)
    {
    	if ( ze_is_user_zombie(id) )
    		return PLUGIN_HANDLED
    	
    	new szWeapID = read_data(2)
    	
    	if ( szWeapID == CSW_MP5NAVY && g_Hasmp5navy[id] == true && get_pcvar_num(cvar_custommodel) )
    	{
    		set_pev(id, pev_viewmodel2, gmp5_V_MODEL)
    		set_pev(id, pev_weaponmodel2, gmp5_P_MODEL)
    	}
    	return PLUGIN_HANDLED
    }
    
    public checkWeapon(id)
    {
    	new plrClip, plrAmmo, plrWeap[32]
    	new plrWeapId
    	
    	plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
    	
    	if (plrWeapId == CSW_MP5NAVY && g_Hasmp5navy[id])
    	{
    		checkModel(id)
    	}
    	else 
    	{
    		return PLUGIN_CONTINUE
    	}
    	
    	if (plrClip == 0 && get_pcvar_num(cvar_uclip))
    	{
    		// If the user is out of ammo..
    		get_weaponname(plrWeapId, plrWeap, 31)
    		// Get the name of their weapon
    		give_item(id, plrWeap)
    		engclient_cmd(id, plrWeap) 
    		engclient_cmd(id, plrWeap)
    		engclient_cmd(id, plrWeap)
    	}
    	return PLUGIN_HANDLED
    }
    
    
    
    public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
    {
        if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_MP5NAVY && g_Hasmp5navy[attacker] )
        {
            SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
        }
    }
    
    public fw_CmdStart( id, uc_handle, seed )
    {
    	if( !is_user_alive( id ) ) 
    		return PLUGIN_HANDLED
    	
    	if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) )
    	{
    		new szClip, szAmmo
    		new szWeapID = get_user_weapon( id, szClip, szAmmo )
    		
    		if( szWeapID == CSW_MP5NAVY && g_Hasmp5navy[id] == true && !g_hasZoom[id] == true)
    		{
    			g_hasZoom[id] = true
    			cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 0 )
    			emit_sound( id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100 )
    		}
    		
    		else if ( szWeapID == CSW_MP5NAVY && g_Hasmp5navy[id] == true && g_hasZoom[id])
    		{
    			g_hasZoom[ id ] = false
    			cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
    			
    		}
    		
    	}
    	return PLUGIN_HANDLED
    }
    
    
    public make_tracer(id)
    {
    	if (get_pcvar_num(cvar_goldbullets))
    	{
    		new clip,ammo
    		new wpnid = get_user_weapon(id,clip,ammo)
    		new pteam[16]
    		
    		get_user_team(id, pteam, 15)
    		
    		if ((bullets[id] > clip) && (wpnid == CSW_MP5NAVY) && g_Hasmp5navy[id]) 
    		{
    			new vec1[3], vec2[3]
    			get_user_origin(id, vec1, 1) // origin; your camera point.
    			get_user_origin(id, vec2, 3) // termina; where your bullet goes (4 is cs-only)
    			
    			
    			//BEAMENTPOINTS
    			message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
    			write_byte (0)     //TE_BEAMENTPOINTS 0
    			write_coord(vec1[0])
    			write_coord(vec1[1])
    			write_coord(vec1[2])
    			write_coord(vec2[0])
    			write_coord(vec2[1])
    			write_coord(vec2[2])
    			write_short( m_spriteTexture )
    			write_byte(1) // framestart
    			write_byte(5) // framerate
    			write_byte(2) // life
    			write_byte(10) // width
    			write_byte(0) // noise
    			write_byte( random(256) )     // r, g, b
    			write_byte( random(256) )       // r, g, b
    			write_byte( random(256) )       // r, g, b
    			write_byte(200) // brightness
    			write_byte(150) // speed
    			message_end()
    		}
    	
    		bullets[id] = clip
    	}
    	
    }
    
    public plugin_natives()
    {
    	register_native("give_golden_mp5", "native_give_golden_mp5", 1)
    }
    
    public native_give_golden_mp5(id)
    {
    	g_Hasmp5navy[id] = true
    	rg_give_item(id, "weapon_mp5navy", GT_REPLACE)
    	cs_set_user_bpammo(id, CSW_MP5NAVY, 120)
    }
3. M4A1
  • Code: Select all

    #include <zombie_escape>
    #include <fun>
    #include <cstrike>
     
    #define is_valid_player(%1) (1 <= %1 <= 32)
     
    new M4_V_MODEL[64] = "models/zombie_escape/v_golden_m4a1.mdl"
    new M4_P_MODEL[64] = "models/zombie_escape/p_golden_m4a1.mdl"
    new M4_W_MODEL[64] = "models/zombie_escape/w_golden_m4a1.mdl"
     
    /* Pcvars */
    new cvar_dmgmultiplier, cvar_goldbullets,  cvar_custommodel, cvar_uclip
     
    new bool:g_HasM4[33]
    
    new bullets[ 33 ]
     
    // Sprite
    new m_spriteTexture
     
    const Wep_m4a1 = ((1<<CSW_M4A1))
     
    public plugin_init()
    {
       
        /* CVARS */
        cvar_dmgmultiplier = register_cvar("zp_goldenm4_dmg_multiplier", "4")
        cvar_custommodel = register_cvar("zp_goldenm4_custom_model", "1")
        cvar_goldbullets = register_cvar("zp_goldenm4_gold_bullets", "1")
        cvar_uclip = register_cvar("zp_goldenm4_unlimited_clip", "0")
       
        // Register The Plugin
        register_plugin("Golden M4A1", "1.1", "SPIR0X")
    
        // Death Msg
        register_event("DeathMsg", "Death", "a")
        // Weapon Pick Up
        register_event("WeapPickup","checkModel","b","1=19")
        // Current Weapon Event
        register_event("CurWeapon","checkWeapon","be","1=1")
        register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
        // Ham TakeDamage
        RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
        RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
       
    }
    
    public plugin_natives()
    {
    	register_native("give_golden_m4a1", "native_give_golden_m4a1", 1)
    }
     
    public client_connect(id)
    {
        g_HasM4[id] = false
    }
     
    public client_disconnected(id)
    {
        g_HasM4[id] = false
    }
     
    public Death()
    {
        g_HasM4[read_data(2)] = false
    }
     
    public fwHamPlayerSpawnPost(id)
    {
        g_HasM4[id] = false
    }
     
    public plugin_precache()
    {
        precache_model(M4_V_MODEL)
        precache_model(M4_P_MODEL)
        precache_model(M4_W_MODEL)
        m_spriteTexture = precache_model("sprites/dot.spr")
        precache_sound("weapons/zoom.wav")
    }
     
    public ze_user_infected(id, iInfector)
    {
        if (ze_is_user_zombie(id))
        {
            g_HasM4[id] = false
        }
    }
     
    public checkModel(id)
    {
        if (ze_is_user_zombie(id))
            return PLUGIN_HANDLED
       
        new szWeapID = read_data(2)
       
        if ( szWeapID == CSW_M4A1 && g_HasM4[id] == true && get_pcvar_num(cvar_custommodel) )
        {
            set_pev(id, pev_viewmodel2, M4_V_MODEL)
            set_pev(id, pev_weaponmodel2, M4_P_MODEL)
            set_pev(id, pev_weaponmodel2, M4_W_MODEL)
        }
        return PLUGIN_HANDLED
    }
     
    public checkWeapon(id)
    {
        new plrClip, plrAmmo, plrWeap[32]
        new plrWeapId
       
        plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
       
        if (plrWeapId == CSW_M4A1 && g_HasM4[id])
        {
            checkModel(id)
        }
        else
        {
            return PLUGIN_CONTINUE
        }
       
        if (plrClip == 0 && get_pcvar_num(cvar_uclip))
        {
            // If the user is out of ammo..
            get_weaponname(plrWeapId, plrWeap, 31)
            // Get the name of their weapon
            rg_give_item(id, plrWeap)
            engclient_cmd(id, plrWeap)
            engclient_cmd(id, plrWeap)
            engclient_cmd(id, plrWeap)
        }
        return PLUGIN_HANDLED
    }
     
     
     
    public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
    {
        if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_M4A1 && g_HasM4[attacker] )
        {
            SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
        }
    }
    
    public make_tracer(id)
    {
        if (get_pcvar_num(cvar_goldbullets))
        {
            new clip,ammo
            new wpnid = get_user_weapon(id,clip,ammo)
            new pteam[16]
           
            get_user_team(id, pteam, 15)
           
            if ((bullets[id] > clip) && (wpnid == CSW_M4A1) && g_HasM4[id])
            {
                new vec1[3], vec2[3]
                get_user_origin(id, vec1, 1) // origin; your camera point.
                get_user_origin(id, vec2, 4) // termina; where your bullet goes (4 is cs-only)
               
               
                //BEAMENTPOINTS
                message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
                write_byte (0)     //TE_BEAMENTPOINTS 0
                write_coord(vec1[0])
                write_coord(vec1[1])
                write_coord(vec1[2])
                write_coord(vec2[0])
                write_coord(vec2[1])
                write_coord(vec2[2])
                write_short( m_spriteTexture )
                write_byte(1) // framestart
                write_byte(5) // framerate
                write_byte(2) // life
                write_byte(10) // width
                write_byte(0) // noise
                write_byte( 255 )     // r, g, b
                write_byte( 215 )       // r, g, b
                write_byte( 0 )       // r, g, b
                write_byte(200) // brightness
                write_byte(150) // speed
                message_end()
            }
       
            bullets[id] = clip
        }
       
    }
     
    public native_give_golden_m4a1(player)
    {
        if (user_has_weapon(player, CSW_M4A1))
        {
            drop_prim(player)
        }
           
        give_item(player, "weapon_m4a1")
    	cs_set_user_bpammo(player, CSW_M4A1, 90)
    	
        g_HasM4[player] = true;
    }
     
    stock drop_prim(id)
    {
        new weapons[32], num
        get_user_weapons(id, weapons, num)
        for (new i = 0; i < num; i++) {
            if (Wep_m4a1 & (1<<weapons[i]))
            {
                static wname[32]
                get_weaponname(weapons[i], wname, sizeof wname - 1)
                engclient_cmd(id, "drop", wname)
            }
        }
    }
4. AK47
  • Code: Select all

    #include <zombie_escape>
    #include <cstrike>
    #include <fun>
    #include <engine>
    
    #define NAME "Golden Ak 47"
    #define COST 30
    #define LIMIT 0
    #define is_valid_player(%1) (1 <= %1 <= get_maxplayers())
    new const g_GAKEnt[] = "weapon_ak47"
    
    new AK_V_MODEL[64] = "models/zombie_escape/v_golden_ak47.mdl"
    new AK_P_MODEL[64] = "models/zombie_escape/p_golden_ak47.mdl"
    new AK_W_MODEL[64] = "models/zombie_escape/w_golden_ak47.mdl"
    
    /* Pcvars */
    new cvar_dmgmultiplier, cvar_goldbullets,  cvar_custommodel, cvar_uclip
    new bool:g_HasAk[33], g_hasZoom[33], bullets[33]
    // Sprite
    new m_spriteTexture
    const Wep_ak47 = ((1<<CSW_AK47))
    
    public plugin_init()
    {
    	// Register The Plugin
    	register_plugin("Golden Ak 47", "1.1", "AlejandroSk / JaCk")
    	register_cvar("JaCk", "Golden AK47", FCVAR_SERVER|FCVAR_SPONLY)
    
    	// Event
    	register_event("DeathMsg", "Death", "a")
    	register_event("WeapPickup","checkModel","b","1=19")
    	register_event("CurWeapon","checkWeapon","be","1=1")
    	register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
    	// Ham TakeDamage
    	RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
    	RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
    	RegisterHam(Ham_Item_AddToPlayer, g_GAKEnt, "fw_GAK47AddToPlayer")
    	// Forwards
    	register_forward(FM_SetModel, "fw_SetModel")
    	register_forward( FM_CmdStart, "fw_CmdStart" )
    	/* CVARS */
    	cvar_dmgmultiplier = register_cvar("goldenak_dmg_multiplier", "5")
    	cvar_custommodel = register_cvar("goldenak_custom_model", "1")
    	cvar_goldbullets = register_cvar("goldenak_gold_bullets", "1")
    	cvar_uclip = register_cvar("goldenak_unlimited_clip", "0")
    }
    
    public plugin_natives()
    {
    	register_native("give_golden_ak47", "native_give_golden_ak47", 1)
    }
    
    public native_give_golden_ak47(id)
    {
    	g_HasAk[id] = true
    	rg_give_item(id, "weapon_ak47", GT_REPLACE)
    	cs_set_user_bpammo(id, CSW_AK47, 90)
    }
    
    public client_connect(id)
    {
    	g_HasAk[id] = false
    }
    
    public client_disconnected(id)
    {
    	g_HasAk[id] = false
    }
    
    public Death()
    {
    	g_HasAk[read_data(2)] = false
    }
    
    public fwHamPlayerSpawnPost(id)
    {
    	g_HasAk[id] = false
    }
    
    public plugin_precache()
    {
    	precache_model(AK_V_MODEL)
    	precache_model(AK_P_MODEL)
    	precache_model(AK_W_MODEL)
    	m_spriteTexture = precache_model("sprites/dot.spr")
    	precache_sound("weapons/zoom.wav")
    }
    
    public ze_user_infected(id)
    {
    	g_HasAk[id] = false
    }
    
    public checkModel(id)
    {
    	if ( ze_is_user_zombie(id) )
    		return PLUGIN_HANDLED
    	
    	new szWeapID = read_data(2)
    	
    	if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && get_pcvar_num(cvar_custommodel) )
    	{
    		set_pev(id, pev_viewmodel2, AK_V_MODEL)
    		set_pev(id, pev_weaponmodel2, AK_P_MODEL)
    	}
    	return PLUGIN_HANDLED
    }
    
    public checkWeapon(id)
    {
    	new plrClip, plrAmmo, plrWeap[32]
    	new plrWeapId
    	
    	plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
    	
    	if (plrWeapId == CSW_AK47 && g_HasAk[id])
    	{
    		checkModel(id)
    	}
    	else 
    	{
    		return PLUGIN_CONTINUE
    	}
    	
    	if (plrClip == 0 && get_pcvar_num(cvar_uclip))
    	{
    		// If the user is out of ammo..
    		get_weaponname(plrWeapId, plrWeap, 31)
    		// Get the name of their weapon
    		give_item(id, plrWeap)
    		engclient_cmd(id, plrWeap) 
    		engclient_cmd(id, plrWeap)
    		engclient_cmd(id, plrWeap)
    	}
    	return PLUGIN_HANDLED
    }
    
    public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
    {
        if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_AK47 && g_HasAk[attacker] )
        {
            SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
        }
    }
    
    public fw_CmdStart( id, uc_handle, seed )
    {
    	if( !is_user_alive( id ) ) 
    		return PLUGIN_HANDLED
    	
    	if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) )
    	{
    		new szClip, szAmmo
    		new szWeapID = get_user_weapon( id, szClip, szAmmo )
    		
    		if( szWeapID == CSW_AK47 && g_HasAk[id] == true && !g_hasZoom[id] == true)
    		{
    			g_hasZoom[id] = true
    			cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 0 )
    			emit_sound( id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100 )
    		}
    		
    		else if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && g_hasZoom[id])
    		{
    			g_hasZoom[ id ] = false
    			cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
    			
    		}
    		
    	}
    	return PLUGIN_HANDLED
    }
    
    
    public make_tracer(id)
    {
    	if (get_pcvar_num(cvar_goldbullets))
    	{
    		new clip,ammo
    		new wpnid = get_user_weapon(id,clip,ammo)
    		new pteam[16]
    		
    		get_user_team(id, pteam, 15)
    		
    		if ((bullets[id] > clip) && (wpnid == CSW_AK47) && g_HasAk[id]) 
    		{
    			new vec1[3], vec2[3]
    			get_user_origin(id, vec1, 1) // origin; your camera point.
    			get_user_origin(id, vec2, 3) // termina; where your bullet goes (4 is cs-only)
    			
    			
    			//BEAMENTPOINTS
    			message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
    			write_byte (0)     //TE_BEAMENTPOINTS 0
    			write_coord(vec1[0])
    			write_coord(vec1[1])
    			write_coord(vec1[2])
    			write_coord(vec2[0])
    			write_coord(vec2[1])
    			write_coord(vec2[2])
    			write_short( m_spriteTexture )
    			write_byte(1) // framestart
    			write_byte(5) // framerate
    			write_byte(2) // life
    			write_byte(10) // width
    			write_byte(0) // noise
    			write_byte( 255 )     // R
    			write_byte( 215 )       // G
    			write_byte( 0 )       // B
    			write_byte(200) // Alpha
    			write_byte(150) // speed
    			message_end()
    		}
    	
    		bullets[id] = clip
    	}
    	
    }
    
    public fw_SetModel(entity, model[])
    {
    	if(!is_valid_ent(entity)) // Entity is not valid
    		return FMRES_IGNORED;
    		
    	if(!equal(model, "models/w_ak47.mdl")) // Entity model is not w_ak47
    		return FMRES_IGNORED;
    		
    	static szClassName[33] // Get classname
    	entity_get_string(entity, EV_SZ_classname, szClassName, charsmax(szClassName))
    		
    	if(!equal(szClassName, "weaponbox")) // Not a Weapon box
    		return FMRES_IGNORED
    	
    	static iOwner, iStoredGalilID // Some vars
    	
    	iOwner = entity_get_edict(entity, EV_ENT_owner) // Get owner
    	
    	iStoredGalilID = find_ent_by_owner(-1, "weapon_ak47", entity) // Get drop weapon index (galil) to use in fw_Galil_AddToPlayer forward
    	
    	if(g_HasAk[iOwner] && is_valid_ent(iStoredGalilID)) // Entity classname is weaponbox, and galil has founded
    	{
    		entity_set_int(iStoredGalilID, EV_INT_impulse, 666) // Setting weapon options
    		g_HasAk[iOwner] = false // Reset user vars
    		entity_set_model(entity, AK_W_MODEL) // Set weaponbox new model
    		return FMRES_SUPERCEDE
    	}
    	return FMRES_IGNORED
    }
    
    public fw_GAK47AddToPlayer(GAK47, id)
    {
    	if( is_valid_ent(GAK47) && is_user_connected(id) && entity_get_int(GAK47, EV_INT_impulse) == 666) // Make sure that this is our gun
    	{
    		g_HasAk[id] = true
    		entity_set_int(GAK47, EV_INT_impulse, 0)
    		return HAM_HANDLED
    	}
    	return HAM_IGNORED
    }
These users thanked the author Raheem for the post:
Prekrasnoe Daleko (1 Year Ago)
You don't know? Learn and you will know.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 0 guests