Resolved UC VIPS (BUG)

Unpaid Requests, Public Plugins
Post Reply
User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 633
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 7 times
Age: 19
Contact:

UC VIPS (BUG)

#1

Post by Spir0x » 1 Year Ago

hey everyone i'm making unlimited clip only for vips. i face a problem when i'm vip and i have Flag "A" i cant buy Unlimited clip and when i haven't any acess to vip i can buy it like a normal player. lol i need to make it work for vips not for normal players

Here i'm normal player without any vip or admin acess i can buy it.
Image


Here i have flag "A" and i cant buy it.
Image

Code:

Code: Select all

#include <ze_vip>

new const g_item_name[] = {"Unlimited Clip \d(VIP)"}
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] 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
	
    // Player not VIP
    if (ze_get_vip_flags(id) & VIP_A)
        return PLUGIN_HANDLED
   
    return ZE_ITEM_AVAILABLE
}

// Player buys our upgrade, set the unlimited ammo flag
public ze_select_item_post(player, itemid)
{
    if (itemid != g_itemid_infammo)
        return
	ze_colored_print(player, "!tUnlimited Clip for one round is ON!y!")
	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);
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1036{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/
I trynna make money, not friends.

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

#2

Post by Raheem » 1 Year Ago

Chage:
    1.     // Player not VIP
    2.     if (ze_get_vip_flags(id) & VIP_A)
    3.         return PLUGIN_HANDLED
To:
    1.     // Player not VIP
    2.     if (!(ze_get_vip_flags(id) & VIP_A))
    3.         return ZE_ITEM_DONT_SHOW
Zombie Escape have it's own return values, You MUST use these return values in it's correct forwards.
Last edited by Raheem on 25 Jun 2018, 16:10, edited 1 time in total.
Reason: Forget not (!)
You don't know? Learn and you will know.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 633
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 7 times
Age: 19
Contact:

#3

Post by Spir0x » 1 Year Ago

Lol and if i want to show it to player ? i dont want to hide it what return can i use ?

Then i tested it now. normal players can see it and buy it. and vips can't see it on extra-items LOL !
I trynna make money, not friends.

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

#4

Post by Raheem » 1 Year Ago

See now bro
You don't know? Learn and you will know.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 633
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 7 times
Age: 19
Contact:

#5

Post by Spir0x » 1 Year Ago

done bro.
I trynna make money, not friends.

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

#6

Post by Raheem » 1 Year Ago

What you already need is:
    1. public ze_select_item_pre(id, itemid)
    2. {
    3.     // Return Available and we will block it in Post, So it dosen't affect other plugins
    4.     if (itemid != g_itemid_infammo)
    5.         return ZE_ITEM_AVAILABLE
    6.    
    7.     // Available for Humans only, So don't show it for zombies
    8.     if (ze_is_user_zombie(id))
    9.         return ZE_ITEM_DONT_SHOW
    10.    
    11.     // Format extra text to be added beside our item
    12.     new szText[32]
    13.     formatex(szText, charsmax(szText), "  \w(\rV.I.P\w)")
    14.    
    15.     // Add the text
    16.     ze_add_text_to_item(szText)
    17.    
    18.     if (!(ze_get_vip_flags(id) & VIP_A))
    19.         return ZE_ITEM_UNAVAILABLE
    20.    
    21.     return ZE_ITEM_AVAILABLE
    22. }
The item will appear for all but only VIPs with acces A will have access to it.
You don't know? Learn and you will know.

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:

#7

Post by johnnysins2000 » 1 Year Ago

Spir0x wrote:
1 Year Ago
done bro.
so problem solved ?
Nobody Is That Busy If They Make Time :roll:

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 633
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 7 times
Age: 19
Contact:

#8

Post by Spir0x » 1 Year Ago

Raheem bro why when i type \w[\rVIP\w] i see very much lines on ze_extraitems.ini like this.

[Unlimited Clip \w[\rVIP\w]
NAME = Unlimited Clip \w[\rVIP\w]
COST = 150
LIMIT = 0
[Unlimited Clip \w[\rVIP\w]
NAME = Unlimited Clip \w[\rVIP\w]
COST = 150
LIMIT = 0
[Unlimited Clip \w[\rVIP\w]
NAME = Unlimited Clip \w[\rVIP\w]
COST = 150
LIMIT = 0

can i change it from this line not from code ? :
NAME = Unlimited Clip \w[\rVIP\w]

when i use
NAME = Unlimited Clip \w(\rVIP\w) still normal no spam.
I trynna make money, not friends.

User avatar
Mohamed Alaa
Mod Developer
Mod Developer
Egypt
Posts: 586
Joined: 2 Years Ago
Location: Egypt
Has thanked: 34 times
Been thanked: 48 times
Age: 19
Contact:

#9

Post by Mohamed Alaa » 1 Year Ago

Spir0x wrote:
1 Year Ago
Raheem bro why when i type \w[\rVIP\w] i see very much lines on ze_extraitems.ini like this.

[Unlimited Clip \w[\rVIP\w]
NAME = Unlimited Clip \w[\rVIP\w]
COST = 150
LIMIT = 0
[Unlimited Clip \w[\rVIP\w]
NAME = Unlimited Clip \w[\rVIP\w]
COST = 150
LIMIT = 0
[Unlimited Clip \w[\rVIP\w]
NAME = Unlimited Clip \w[\rVIP\w]
COST = 150
LIMIT = 0

can i change it from this line not from code ? :
NAME = Unlimited Clip \w[\rVIP\w]

when i use
NAME = Unlimited Clip \w(\rVIP\w) still normal no spam.
I didn't understand.
Not interested in CS/Pawn anymore.
Accepting web projects.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 633
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 7 times
Age: 19
Contact:

#10

Post by Spir0x » 1 Year Ago

Bro read it's clear. i just said when i type it like this : \w[\rVIP\w] i face bug on ze_extraitems.ini
i see too many lines of unlimited clip.
I trynna make money, not friends.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest