Converted Unlimited Clip

Zombies/Humans Extra-Items
Post Reply
User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1748
Joined: 2 Years Ago
Location: Egypt
Has thanked: 30 times
Been thanked: 87 times
Age: 21
Contact:

Unlimited Clip

#1

Post by Raheem » 1 Year Ago

Unlimited Clip

Description:
  • A new extra-item for Humans, It's Unlimited Clip. Original plugin Here.
Installation & Instructions:
  • Simply install it like any plugin.
Screenshots:
  • ImageImage
Downloads:
You don't know? Learn and you will know.

Luxurious
Member
Member
Egypt
Posts: 90
Joined: 1 Year Ago
Location: Egypt
Has thanked: 2 times
Been thanked: 1 time
Contact:

#2

Post by Luxurious » 9 Months Ago

I Want Make This Extra-Item For Vip .... can you learn me how do it ,,, or can u make it for me

johnnysins2000
Veteran Member
Veteran Member
Pakistan
Posts: 672
Joined: 2 Years Ago
Location: Lahore
Has thanked: 11 times
Been thanked: 10 times
Age: 22
Contact:

#3

Post by johnnysins2000 » 9 Months Ago

Luxurious wrote:
9 Months Ago
I Want Make This Extra-Item For Vip .... can you learn me how do it ,,, or can u make it for me
Turorial For making if for VIP is already there !

Go to tutorial section if u want to learn !

If u are unable to then sure

We will help u

But first try and show me the code
Nobody Is That Busy If They Make Time :roll:

Luxurious
Member
Member
Egypt
Posts: 90
Joined: 1 Year Ago
Location: Egypt
Has thanked: 2 times
Been thanked: 1 time
Contact:

#4

Post by Luxurious » 9 Months Ago

Code: Select all

#include <zombie_escape>

#define VIP_ACCESS ADMIN_LEVEL_H


new const g_item_name[] = {"Unlimited Clip \r(One Round)"}
const g_item_cost = 10

// CS Offsets
#if cellbits == 32
const OFFSET_CLIPAMMO = 51
#else
const OFFSET_CLIPAMMO = 65
#endif
const OFFSET_LINUX_WEAPONS = 4

// Max Clip for weapons
new const MAXCLIP[] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
			10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }

new g_itemid_infammo, g_has_unlimited_clip[33]

public plugin_init()
{
	register_plugin("[ZE] VIP Extra: Unlimited Clip", "1.0", "MeRcyLeZZ")
	
	g_itemid_infammo = ze_register_item(g_item_name, g_item_cost, 0)

	register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
}

public ze_select_item_pre(id, itemid)
{
    // Return Available and we will block it in Post, So it dosen't affect other plugins
    if (itemid != g_itemid_infammo)
        return ZE_ITEM_AVAILABLE
   
    // Available for Humans only, So don't show it for zombies
    if (ze_is_user_zombie(id))
        return ZE_ITEM_DONT_SHOW
   
    return ZE_ITEM_AVAILABLE
}
    // Player Not VIP?
    if (!(get_user_flags(id) & VIP_ACCESS))
        return ZE_ITEM_DONT_SHOW



// Player buys our upgrade, set the unlimited ammo flag
public ze_select_item_post(player, itemid)
{
    if (itemid != g_itemid_infammo)
        return
	
	g_has_unlimited_clip[player] = true
}

// Reset flags for all players on newround
public ze_user_humanized(id)
{
	g_has_unlimited_clip[id] = false;
}

// Unlimited clip code
public message_cur_weapon(msg_id, msg_dest, msg_entity)
{
	// Player doesn't have the unlimited clip upgrade
	if (!g_has_unlimited_clip[msg_entity])
		return;
	
	// Player not alive or not an active weapon
	if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
		return;
	
	static weapon, clip
	weapon = get_msg_arg_int(2) // get weapon ID
	clip = get_msg_arg_int(3) // get weapon clip
	
	// Unlimited Clip Ammo
	if (MAXCLIP[weapon] > 2) // skip grenades
	{
		set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon]) // HUD should show full clip all the time
		
		if (clip < 2) // refill when clip is nearly empty
		{
			// Get the weapon entity
			static wname[32], weapon_ent
			get_weaponname(weapon, wname, sizeof wname - 1)
			weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
			
			// Set max clip on weapon
			fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
		}
	}
}

// Find entity by its owner (from fakemeta_util)
stock fm_find_ent_by_owner(entity, const classname[], owner)
{
	while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) {}
	
	return entity;
}

// Set Weapon Clip Ammo
stock fm_set_weapon_ammo(entity, amount)
{
	set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
}

LosT
Member
Member
Belgium
Posts: 13
Joined: 9 Months Ago
Has thanked: 0
Been thanked: 0
Contact:

#5

Post by LosT » 9 Months Ago

error:

Code: Select all

//// ze_Unlimited_Clip_VIP.sma
//
// C:\Users\rappe\Desktop\SCRIPTING-ZE1.2\ze_Unlimited_Clip_VIP.sma(47) : error 010: invalid function or declaration
// C:\Users\rappe\Desktop\SCRIPTING-ZE1.2\ze_Unlimited_Clip_VIP.sma(48) : error 010: invalid function or declaration
// C:\Users\rappe\Desktop\SCRIPTING-ZE1.2\ze_Unlimited_Clip_VIP.sma(58) : warning 217: loose indentation
//
// 2 Errors.
// Could not locate output file C:\Users\rappe\Desktop\SCRIPTING-ZE1.2\compiled\ze_Unlimited_Clip_VIP.amx (compile failed).
//
// Compilation Time: 1.42 sec

Post Reply

Who is online

Users browsing this forum: Mystic Viper and 1 guest