Raised This Month: $10 Target: $400
 2% 

VIP Plugin 3.0 question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
romeo72
Member
Join Date: Oct 2021
Old 10-20-2021 , 11:06   VIP Plugin 3.0 question
Reply With Quote #1

Hello everyone

I have a question. I successfully installed the vip plugin 3.0. I also installed vip models. so that you can see who is VIP.
I downloaded a weapon model pack. is it possible to add these weapon models? so that only the vips have it?

best regards !
romeo72 is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 10-20-2021 , 13:53   Re: VIP Plugin 3.0 question
Reply With Quote #2

Is this the vip plugin you're using? https://forums.alliedmods.net/showthread.php?p=675900
__________________




CrazY. is offline
romeo72
Member
Join Date: Oct 2021
Old 10-20-2021 , 13:56   Re: VIP Plugin 3.0 question
Reply With Quote #3

Hi CrazY.

Yes, that's exactly
romeo72 is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 10-20-2021 , 15:34   Re: VIP Plugin 3.0 question
Reply With Quote #4

There you go
Create a file named vip_models.ini in addons/amxmodx/configs/

The syntax is
Code:
"weapon name" "path to v_model" "path to p_model"
Example
Code:
"weapon_ak47" "models/v_ak47.mdl" "models/p_ak47.mdl"
Leave blank to use default model, example
Code:
"weapon_ak47" "" "models/p_ak47.mdl"
You can get the weapon names here https://wiki.alliedmods.net/Cs_weapons_information


Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>

enum _:weaponmodel_e
{
	WeaponVModel[64],
	WeaponPModel[64],
}

new Trie:g_models

public plugin_init()
{
	register_plugin("VIP Weapon Models", "1.0", "Ainsley Harriott")

	new TrieIter:iterator = TrieIterCreate(g_models)
	new weapon_name[32]

	while (!TrieIterEnded(iterator))
	{
		TrieIterGetKey(iterator, weapon_name, charsmax(weapon_name))
		TrieIterNext(iterator)

		if (get_weaponid(weapon_name) > 0)
		{
			RegisterHam(Ham_Item_Deploy, weapon_name, "OnItemDeployPost", 1)
		}
	}

	TrieIterDestroy(iterator)
}

public plugin_precache()
{
	g_models = TrieCreate()
	LoadConfigFile()
}

public plugin_end()
{
	TrieDestroy(g_models)
}

public OnItemDeployPost(weapon)
{
	new player = get_ent_data_entity(weapon, "CBasePlayerItem", "m_pPlayer")

	if (!(get_user_flags(player) & ADMIN_LEVEL_H))
	{
		return
	}

	new data[weaponmodel_e], weapon_name[32]
	pev(weapon, pev_classname, weapon_name, charsmax(weapon_name))

	if (!TrieGetArray(g_models, weapon_name, data, sizeof data))
	{
		return
	}

	if (data[WeaponVModel][0])
	{
		set_pev(player, pev_viewmodel2, data[WeaponVModel])
	}
	
	if (data[WeaponPModel][0])
	{
		set_pev(player, pev_weaponmodel2, data[WeaponPModel])
	}
}

LoadConfigFile()
{
	new filename[128]
	get_configsdir(filename, charsmax(filename))
	add(filename, charsmax(filename), "/vip_models.ini")

	new file = fopen(filename, "rt")

	if (!file)
	{
		return
	}

	new buffer[200], weapon_name[32], data[weaponmodel_e]

	while (fgets(file, buffer, charsmax(buffer)))
	{
		trim(buffer)

		if (!buffer[0] || buffer[0] == ';' || buffer[0] == '#')
		{
			continue
		}

		if (parse(buffer, weapon_name, charsmax(weapon_name), data[WeaponVModel], charsmax(data[WeaponVModel]), data[WeaponPModel], charsmax(data[WeaponPModel])) < 2)
		{
			continue
		}

		if (data[WeaponVModel][0])
		{
			if (!file_exists(data[WeaponVModel], true))
			{
				log_amx("Couldn't find file '%s'", data[WeaponVModel])
				data[WeaponVModel][0] = EOS
			}
			else
			{
				precache_model(data[WeaponVModel])
			}
		}

		if (data[WeaponPModel][0])
		{
			if (!file_exists(data[WeaponPModel], true))
			{
				log_amx("Couldn't find file '%s'", data[WeaponPModel])
				data[WeaponPModel][0] = EOS
			}
			else
			{
				precache_model(data[WeaponPModel])
			}
		}

		TrieSetArray(g_models, weapon_name, data, sizeof data)
	}

	fclose(file)
}
__________________





Last edited by CrazY.; 10-20-2021 at 16:10.
CrazY. is offline
romeo72
Member
Join Date: Oct 2021
Old 10-21-2021 , 05:22   Re: VIP Plugin 3.0 question
Reply With Quote #5

Hello CrazY.

many, many thanks for your effort and help!
I think I got it that far. nevertheless i still have a question?
I understand correctly when I write this line in the .ini:

Quote:
"weapon_ak47" "models/v_ak47.mdl" "models/p_ak47.mdl"
that the vip sees another model and the no vip sees the standard model?

can I also use this code:

Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>

enum _:weaponmodel_e
{
	WeaponVModel[64],
	WeaponPModel[64],
}

new Trie:g_models

public plugin_init()
{
	register_plugin("VIP Weapon Models", "1.0", "Ainsley Harriott")

	new TrieIter:iterator = TrieIterCreate(g_models)
	new weapon_name[32]

	while (!TrieIterEnded(iterator))
	{
		TrieIterGetKey(iterator, weapon_name, charsmax(weapon_name))
		TrieIterNext(iterator)

		if (get_weaponid(weapon_name) > 0)
		{
			RegisterHam(Ham_Item_Deploy, weapon_name, "OnItemDeployPost", 1)
		}
	}

	TrieIterDestroy(iterator)
}

public plugin_precache()
{
	g_models = TrieCreate()
	LoadConfigFile()
}

public plugin_end()
{
	TrieDestroy(g_models)
}

public OnItemDeployPost(weapon)
{
	new player = get_ent_data_entity(weapon, "CBasePlayerItem", "m_pPlayer")

	if (!(get_user_flags(player) & ADMIN_LEVEL_H))
	{
		return
	}

	new data[weaponmodel_e], weapon_name[32]
	pev(weapon, pev_classname, weapon_name, charsmax(weapon_name))

	if (!TrieGetArray(g_models, weapon_name, data, sizeof data))
	{
		return
	}

	if (data[WeaponVModel][0])
	{
		set_pev(player, pev_viewmodel2, data[WeaponVModel])
	}
	
	if (data[WeaponPModel][0])
	{
		set_pev(player, pev_weaponmodel2, data[WeaponPModel])
	}
}

LoadConfigFile()
{
	new filename[128]
	get_configsdir(filename, charsmax(filename))
	add(filename, charsmax(filename), "/vip_models.ini")

	new file = fopen(filename, "rt")

	if (!file)
	{
		return
	}

	new buffer[200], weapon_name[32], data[weaponmodel_e]

	while (fgets(file, buffer, charsmax(buffer)))
	{
		trim(buffer)

		if (!buffer[0] || buffer[0] == ';' || buffer[0] == '#')
		{
			continue
		}

		if (parse(buffer, weapon_name, charsmax(weapon_name), data[WeaponVModel], charsmax(data[WeaponVModel]), data[WeaponPModel], charsmax(data[WeaponPModel])) < 2)
		{
			continue
		}

		if (data[WeaponVModel][0])
		{
			if (!file_exists(data[WeaponVModel], true))
			{
				log_amx("Couldn't find file '%s'", data[WeaponVModel])
				data[WeaponVModel][0] = EOS
			}
			else
			{
				precache_model(data[WeaponVModel])
			}
		}

		if (data[WeaponPModel][0])
		{
			if (!file_exists(data[WeaponPModel], true))
			{
				log_amx("Couldn't find file '%s'", data[WeaponPModel])
				data[WeaponPModel][0] = EOS
			}
			else
			{
				precache_model(data[WeaponPModel])
			}
		}

		TrieSetArray(g_models, weapon_name, data, sizeof data)
	}

	fclose(file)
}
for other HE, Flash and smoke models for the VIPs?

Many thanks and best regards !!

edit:
I have tried to compile (.sma to .amxx) this code. unfortunately i get an error message:

Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

/tmp/textKVpGyx.sma(18) : error 017: undefined symbol "TrieIterCreate"
/tmp/textKVpGyx.sma(19) : warning 213: tag mismatch
/tmp/textKVpGyx.sma(21) : error 017: undefined symbol "TrieIterEnded"
/tmp/textKVpGyx.sma(23) : error 017: undefined symbol "TrieIterGetKey"
/tmp/textKVpGyx.sma(23) : error 088: number of arguments does not match definition
/tmp/textKVpGyx.sma(24) : error 017: undefined symbol "TrieIterNext"
/tmp/textKVpGyx.sma(32) : error 017: undefined symbol "TrieIterDestroy"
/tmp/textKVpGyx.sma(48) : error 017: undefined symbol "get_ent_data_entity"
/tmp/textKVpGyx.sma(105) : error 088: number of arguments does not match definition
/tmp/textKVpGyx.sma(118) : error 088: number of arguments does not match definition

9 Errors.
Could not locate output file /home/groups/amxmodx/public_html/websc3/textKVpGyx.amx (compile failed).

Last edited by romeo72; 10-21-2021 at 06:30. Reason: Compile error message
romeo72 is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 10-21-2021 , 09:30   Re: VIP Plugin 3.0 question
Reply With Quote #6

Yes exactly, if the player isn't vip he's going to see the default CS models. The first quote is the weapon name, the second is the view model, the one you see in your hands, almost always is the one that starts with v_ in the file name and the third quote is the weapon model, this is what other players will see when you're holding that weapon, this is almost always the model starting with p_ in the file name and yes, it will work with any weapon even with c4, except for shield. If you need it to work with shield I'll have to modify the plugin. Just make sure you enable the plugin after any other that also changes the weapon models. With that I mean just set it below other plugins in plugins.ini file

You're getting that error because of your amxmodx version. The code below will work with amxmodx 1.8.2, I guess this is the version you are using. You should consider updating amxmodx to 1.9 or later but this is more to a suggestion than a requirement.

Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>

enum _:weaponmodel_e
{
	WeaponVModel[64],
	WeaponPModel[64],
}

new Trie:g_models

const m_pPlayer = 41
const CBasePlayerItem = 4

public plugin_init()
{
	register_plugin("VIP Weapon Models", "1.0", "Ainsley Harriott")

	for (new i = CSW_P228, weapon_name[32]; i <= CSW_P90; i++)
	{
		get_weaponname(i, weapon_name, charsmax(weapon_name))
	
		if (!TrieKeyExists(g_models, weapon_name))
		{
			continue
		}

		RegisterHam(Ham_Item_Deploy, weapon_name, "OnItemDeployPost", 1)
	}
}

public plugin_precache()
{
	g_models = TrieCreate()
	LoadConfigFile()
}

public plugin_end()
{
	TrieDestroy(g_models)
}

public OnItemDeployPost(weapon)
{
	new player = get_pdata_cbase(weapon, m_pPlayer, CBasePlayerItem)

	if (!(get_user_flags(player) & ADMIN_LEVEL_H))
	{
		return
	}

	new data[weaponmodel_e], weapon_name[32]
	pev(weapon, pev_classname, weapon_name, charsmax(weapon_name))

	if (!TrieGetArray(g_models, weapon_name, data, sizeof data))
	{
		return
	}

	if (data[WeaponVModel][0])
	{
		set_pev(player, pev_viewmodel2, data[WeaponVModel])
	}
	
	if (data[WeaponPModel][0])
	{
		set_pev(player, pev_weaponmodel2, data[WeaponPModel])
	}
}

LoadConfigFile()
{
	new filename[128]
	get_configsdir(filename, charsmax(filename))
	add(filename, charsmax(filename), "/vip_models.ini")

	new file = fopen(filename, "rt")

	if (!file)
	{
		return
	}

	new buffer[200], weapon_name[32], data[weaponmodel_e]

	while (fgets(file, buffer, charsmax(buffer)))
	{
		trim(buffer)

		if (!buffer[0] || buffer[0] == ';' || buffer[0] == '#')
		{
			continue
		}

		if (parse(buffer, weapon_name, charsmax(weapon_name), data[WeaponVModel], charsmax(data[WeaponVModel]), data[WeaponPModel], charsmax(data[WeaponPModel])) < 2)
		{
			continue
		}

		if (data[WeaponVModel][0])
		{
			if (!file_exists(data[WeaponVModel]))
			{
				log_amx("Couldn't find file '%s'", data[WeaponVModel])
				data[WeaponVModel][0] = EOS
			}
			else
			{
				precache_model(data[WeaponVModel])
			}
		}

		if (data[WeaponPModel][0])
		{
			if (!file_exists(data[WeaponPModel]))
			{
				log_amx("Couldn't find file '%s'", data[WeaponPModel])
				data[WeaponPModel][0] = EOS
			}
			else
			{
				precache_model(data[WeaponPModel])
			}
		}

		TrieSetArray(g_models, weapon_name, data, sizeof data)
	}

	fclose(file)
}
__________________





Last edited by CrazY.; 10-21-2021 at 09:46.
CrazY. is offline
romeo72
Member
Join Date: Oct 2021
Old 10-21-2021 , 14:38   Re: VIP Plugin 3.0 question
Reply With Quote #7

Hello CrazY.

again many, many thanks for your help!

The new code from you can now be compiled into an .amxx.
I uploaded these to / addons / amxmodx / plugins.
I also added the entry (vip_models.amxx) in the plugins.ini in the last place.

I also created a vip_models.ini (addons/amxmodx/configs) the content is:
"weapon_ak47" "models / v_ak47.mdl" "models / p_ak47.mdl"
"weapon_awp" "models / v_awp.mdl" "models / p_awp.mdl"
"weapon_famas" "models / v_famas.mdl" "models / p_famas.mdl"
"weapon_galil" "models / v_galil.mdl" "models / p_galil.mdl"
"weapon_m4a1" "models / v_m4a1.mdl" "models / p_m4a1.mdl"
"weapon_scout" "models / v_scout.mdl" "models / p_scout.mdl"

I also uploaded the new weapon models to the cstrike / models folder:
v_ak47.mdl
v_awp.mdl
v_famas.mdl
v_galil.mdl
v_m4a1.mdl
v_scout.mdl

Unfortunately, as a VIP, I don't get any new weapon models in my hand.
am i doing something wrong? did I understand something quickly?
do I have to delete the .mdl files on my pc so that they have to be downloaded again from the server?

best regards

Last edited by romeo72; 10-21-2021 at 14:59.
romeo72 is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 10-21-2021 , 14:59   Re: VIP Plugin 3.0 question
Reply With Quote #8

You shouldn't replace the default CS files. Rename the custom models you're going to upload or you can create a folder in the models directory, call it vip and upload all custom models there, then in the ini you would set models/vip/filename.mdl instead of models/filename.mdl, where "filename" you would replace with the model names.

Also, the file path shouldn't contain spaces in the ini. This is how it should look:

Code:
"weapon_ak47" "models/v_ak47.mdl" "models/p_ak47.mdl"
"weapon_awp" "models/v_awp.mdl" "models/p_awp.mdl"
"weapon_famas" "models/v_famas.mdl" "models/p_famas.mdl"
"weapon_galil" "models/v_galil.mdl" "models/p_galil.mdl"
"weapon_m4a1" "models/v_m4a1.mdl" "models/p_m4a1.mdl"
"weapon_scout" "models/v_scout.mdl" "models/p_scout.mdl"
And if you upload the models to models/vip, it would look like this:
Code:
"weapon_ak47" "models/vip/v_ak47.mdl" "models/vip/p_ak47.mdl"
"weapon_awp" "models/vip/v_awp.mdl" "models/vip/p_awp.mdl"
"weapon_famas" "models/vip/v_famas.mdl" "models/vip/p_famas.mdl"
"weapon_galil" "models/vip/v_galil.mdl" "models/vip/p_galil.mdl"
"weapon_m4a1" "models/vip/v_m4a1.mdl" "models/vip/p_m4a1.mdl"
"weapon_scout" "models/vip/v_scout.mdl" "models/vip/p_scout.mdl"
__________________





Last edited by CrazY.; 10-21-2021 at 15:14.
CrazY. is offline
romeo72
Member
Join Date: Oct 2021
Old 10-22-2021 , 05:36   Re: VIP Plugin 3.0 question
Reply With Quote #9

Hello CrazY.

now it's going perfectly!
I did it the way you described it. created a vip folder in the models folder and added / uploaded the new weapon models there.

again, many, many thanks for the help!

a quick question about amxmod 1.9.0. if I were to switch to the current version, will my current add-ons continue to run normally? or can there be problems?

best regards
romeo72 is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 10-22-2021 , 09:52   Re: VIP Plugin 3.0 question
Reply With Quote #10

Cool, I'm happy to help

I forgot to mention that you can name the folder as you prefer, it doesn't need to be "vip", can be anything without spaces and could even be a folder of a sub-folder.

As for updating amxmodx, yes all plugins are supposed to work with later versions, you may get some warnings when compiling the plugins but you can simply ignore them. If you don't really want to bother with that don't worry, stick with 1.8.2 there won't be any problems at all, just with plugins that were made for later versions or if it ever happen of a later version becoming stable, what isn't the case currently, so don't worry.
__________________




CrazY. is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:42.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode