Raised This Month: $51 Target: $400
 12% 

Changing weapon models (Extended)


Post New Thread Reply   
 
Thread Tools Display Modes
lqlqlq
Senior Member
Join Date: Jan 2008
Old 06-13-2013 , 03:37   Re: Changing weapon models (Extended)
Reply With Quote #81

Up again.
lqlqlq is offline
lqlqlq
Senior Member
Join Date: Jan 2008
Old 06-13-2013 , 07:11   Re: Changing weapon models (Extended)
Reply With Quote #82

Please, give me a fixed code.
lqlqlq is offline
XControlX
Junior Member
Join Date: May 2013
Old 06-13-2013 , 09:14   Re: Changing weapon models (Extended)
Reply With Quote #83

Hey, nice thread, but I think is better to change a model with Ham_Item_Deploy (if its just one/two weapons) because the CurWeapon event calling even when you shoot. Here is an example:
PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >

new const g_szViewKnife[ ] = "models/Weapons/v_knife.mdl";

new const 
g_szWeaponKnife[ ] = "models/Weapons/p_knife.mdl";

public 
plugin_init( )
{
    
RegisterHamHam_Item_Deploy"weapon_knife""FwdKnifeDeploy");
}

public 
plugin_precache( )
{
    
precache_modelg_szWeaponKnife );
    
    
precache_modelg_szViewKnife );
}

public 
FwdKnifeDeployiEntity )
{
    new 
client get_pdata_cbaseiEntity41);
    
    if ( ! 
is_user_connectedclient ) || ! is_user_aliveclient ) ) return 1;
    
    if ( 
get_user_weaponclient ) == CSW_KNIFE )
    {
        
set_pevclientpev_viewmodel2g_szViewKnife );
        
        
set_pevclientpev_weaponmodel2g_szWeaponKnife );
    }
    
    return 
1;

XControlX is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 06-13-2013 , 14:05   Re: Changing weapon models (Extended)
Reply With Quote #84

XControlX, Seriously? https://forums.alliedmods.net/showpo...8&postcount=61

And your code doesn't work. You need check cs_get_user_weapon.

+ remove is_user_connected,and you need check private data
__________________

Last edited by Bos93; 06-13-2013 at 14:06.
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
lqlqlq
Senior Member
Join Date: Jan 2008
Old 06-14-2013 , 05:21   Re: Changing weapon models (Extended)
Reply With Quote #85

@Bos93, can you fixed ConnorMcleod's code ?
lqlqlq is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 06-14-2013 , 05:35   Re: Changing weapon models (Extended)
Reply With Quote #86

show your latest version + debug and give me error
__________________

Last edited by Bos93; 06-14-2013 at 05:35.
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
lqlqlq
Senior Member
Join Date: Jan 2008
Old 06-14-2013 , 06:57   Re: Changing weapon models (Extended)
Reply With Quote #87

version:
Code:
/*	Formatright © 2009, ConnorMcLeod

	Players Models is free software;
	you can redistribute it and/or modify it under the terms of the
	GNU General Public License as published by the Free Software Foundation.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with Players Models; if not, write to the
	Free Software Foundation, Inc., 59 Temple Place - Suite 330,
	Boston, MA 02111-1307, USA.
*/

// #define SET_MODELINDEX

#include <amxmodx>
#include <fakemeta>

#define VERSION "1.3.1"

#define SetUserModeled(%1)		g_bModeled |= 1<<(%1 & 31)
#define SetUserNotModeled(%1)		g_bModeled &= ~( 1<<(%1 & 31) )
#define IsUserModeled(%1)		( g_bModeled &  1<<(%1 & 31) )

#define SetUserConnected(%1)		g_bConnected |= 1<<(%1 & 31)
#define SetUserNotConnected(%1)		g_bConnected &= ~( 1<<(%1 & 31) )
#define IsUserConnected(%1)		( g_bConnected &  1<<(%1 & 31) )

#define MAX_MODEL_LENGTH	16
#define MAX_AUTHID_LENGTH 25

#define MAX_PLAYERS	32

#define ClCorpse_ModelName 1
#define ClCorpse_PlayerID 12

#define m_iTeam 114
#define g_ulModelIndexPlayer 491
#define fm_cs_get_user_team_index(%1)	get_pdata_int(%1, m_iTeam)

new const MODEL[] = "model";
new g_bModeled;
new g_szCurrentModel[MAX_PLAYERS+1][MAX_MODEL_LENGTH];

new Trie:g_tTeamModels[2];
new Trie:g_tModelIndexes;
new Trie:g_tDefaultModels;

new g_szAuthid[MAX_PLAYERS+1][MAX_AUTHID_LENGTH];
new g_bPersonalModel[MAX_PLAYERS+1];

new g_bConnected;

public plugin_init()
{
	register_plugin("Players Models", VERSION, "ConnorMcLeod");

	register_forward(FM_SetClientKeyValue, "SetClientKeyValue");
	register_message(get_user_msgid("ClCorpse"), "Message_ClCorpse");
}

public plugin_precache()
{
	new szConfigFile[128];
	get_localinfo("amxx_configsdir", szConfigFile, charsmax(szConfigFile));
	format(szConfigFile, charsmax(szConfigFile), "%s/players_models.ini", szConfigFile);

	new iFile = fopen(szConfigFile, "rt");
	if( iFile )
	{
		new const szDefaultModels[][] = {"", "urban", "terror", "leet", "arctic", "gsg9", 
					"gign", "sas", "guerilla", "vip", "militia", "spetsnaz" };
		g_tDefaultModels = TrieCreate();
		for(new i=1; i<sizeof(szDefaultModels); i++)
		{
			TrieSetCell(g_tDefaultModels, szDefaultModels[i], i);
		}

		g_tModelIndexes = TrieCreate();

		g_tTeamModels[0] = TrieCreate();
		g_tTeamModels[1] = TrieCreate();

		new szDatas[70], szRest[40], szKey[MAX_AUTHID_LENGTH], szModel1[MAX_MODEL_LENGTH], szModel2[MAX_MODEL_LENGTH];
		while( !feof(iFile) )
		{
			fgets(iFile, szDatas, charsmax(szDatas));
			trim(szDatas);
			if(!szDatas[0] || szDatas[0] == ';' || szDatas[0] == '#' || (szDatas[0] == '/' && szDatas[1] == '/'))
			{
				continue;
			}

			parse(szDatas, szKey, charsmax(szKey), szModel1, charsmax(szModel1), szModel2, charsmax(szModel2));

			if( TrieKeyExists(g_tDefaultModels, szKey) )
			{
				if( szModel1[0] && !equal(szModel1, szKey) && PrecachePlayerModel(szModel1) )
				{
					TrieSetString(g_tDefaultModels, szKey, szModel1);
				}
			}
			else if( equal(szKey, "STEAM_", 6) || equal(szKey, "BOT") )
			{
				parse(szRest, szModel1, charsmax(szModel1), szModel2, charsmax(szModel2));
				if( szModel1[0] && PrecachePlayerModel(szModel1) )
				{
					TrieSetString(g_tTeamModels[1], szKey, szModel1);
				}
				if( szModel2[0] && PrecachePlayerModel(szModel2) )
				{
					TrieSetString(g_tTeamModels[0], szKey, szModel2);
				}
			}
		}
		fclose( iFile );
	}
}

PrecachePlayerModel( const szModel[] )
{
	if( TrieKeyExists(g_tModelIndexes, szModel) )
	{
		return 1;
	}

	new szFileToPrecache[64];
	formatex(szFileToPrecache, charsmax(szFileToPrecache), "models/player/%s/%s.mdl", szModel, szModel);
	if( !file_exists( szFileToPrecache ) && !TrieKeyExists(g_tDefaultModels, szModel) )
	{
		return 0;
	}

	TrieSetCell(g_tModelIndexes, szModel, precache_model(szFileToPrecache));

	formatex(szFileToPrecache, charsmax(szFileToPrecache), "models/player/%s/%st.mdl", szModel, szModel);
	if( file_exists( szFileToPrecache ) )
	{
		precache_model(szFileToPrecache);
		return 1;
	}
	formatex(szFileToPrecache, charsmax(szFileToPrecache), "models/player/%s/%sT.mdl", szModel, szModel);
	if( file_exists( szFileToPrecache ) )
	{
		precache_model(szFileToPrecache);
		return 1;
	}

	return 1;
}

public plugin_end()
{
	TrieDestroy(g_tTeamModels[0]);
	TrieDestroy(g_tTeamModels[1]);
	TrieDestroy(g_tModelIndexes);
	TrieDestroy(g_tDefaultModels);
}

public client_authorized( id )
{
	get_user_authid(id, g_szAuthid[id], MAX_AUTHID_LENGTH-1);

	for(new i=1; i<=2; i++)
	{
		if( TrieKeyExists(g_tTeamModels[2-i], g_szAuthid[id]) )
		{
			g_bPersonalModel[id] |= i;
		}
		else
		{
			g_bPersonalModel[id] &= ~i;
		}
	}
}

public client_putinserver(id)
{
	if( !is_user_hltv(id) )
	{
		SetUserConnected(id);
	}
}

public client_disconnect(id)
{
	g_bPersonalModel[id] = 0;
	SetUserNotModeled(id);
	SetUserNotConnected(id);
}

public SetClientKeyValue(id, const szInfoBuffer[], const szKey[], const szValue[])
{
	if( equal(szKey, MODEL) && IsUserConnected(id) )
	{
		new iTeam = fm_cs_get_user_team_index(id);
		if( 1 <= iTeam <= 2 )
		{
			new szSupposedModel[MAX_MODEL_LENGTH];

			if( g_bPersonalModel[id] & iTeam )
			{
				TrieGetString(g_tTeamModels[2-iTeam], g_szAuthid[id], szSupposedModel, charsmax(szSupposedModel));
			}
			else
			{
				TrieGetString(g_tDefaultModels, szValue, szSupposedModel, charsmax(szSupposedModel));
			}

			if( szSupposedModel[0] )
			{
				if(	!IsUserModeled(id)
				||	!equal(g_szCurrentModel[id], szSupposedModel)
				||	!equal(szValue, szSupposedModel)	)
				{
					copy(g_szCurrentModel[id], MAX_MODEL_LENGTH-1, szSupposedModel);
					SetUserModeled(id);
					set_user_info(id, MODEL, szSupposedModel);
				#if defined SET_MODELINDEX
					new iModelIndex;
					TrieGetCell(g_tModelIndexes, szSupposedModel, iModelIndex);
				//	set_pev(id, pev_modelindex, iModelIndex); // is this needed ?
					set_pdata_int(id, g_ulModelIndexPlayer, iModelIndex);
				#endif
					return FMRES_SUPERCEDE;
				}
			}

			if( IsUserModeled(id) )
			{
				SetUserNotModeled(id);
				g_szCurrentModel[id][0] = 0;
			}
		}
	}
	return FMRES_IGNORED;
}

public Message_ClCorpse()
{
	new id = get_msg_arg_int(ClCorpse_PlayerID);
	if( IsUserModeled(id) )
	{
		set_msg_arg_string(ClCorpse_ModelName, g_szCurrentModel[id]);
	}
}
Errors (2):
Code:
L 04/17/2013 - 17:30:32: [HAMSANDWICH] Invalid player 1 (not in-game)
L 04/17/2013 - 17:30:32: [AMXX] Run time error 10 (plugin "weapons_models.amxx") (native "get_pdata_cbase") - debug not enabled!
L 04/17/2013 - 17:30:32: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
I not have debuged version of the error. Maybe it will means to have a check for the player live/not live.

second:
FATAL ERROR (shutting down): SV_ModelIndex: model models/v_glock18.mdl not precached
lqlqlq is offline
Old 06-14-2013, 07:24
Bos93
This message has been deleted by Bos93.
lqlqlq
Senior Member
Join Date: Jan 2008
Old 06-14-2013 , 07:27   Re: Changing weapon models (Extended)
Reply With Quote #88

here:
Code:
"models/v_ak47.mdl" "models/css/v_ak47.mdl"
"models/v_aug.mdl" "models/css/v_aug.mdl"
"models/v_awp.mdl" "models/css/v_awp.mdl"
"models/v_c4.mdl" "models/css/v_c4.mdl"
"models/v_deagle.mdl" "models/css/v_deagle.mdl"
"models/v_elite.mdl" "models/css/v_elite.mdl"
"models/v_famas.mdl" "models/css/v_famas.mdl"
"models/v_fiveseven.mdl" "models/css/v_fiveseven.mdl"
"models/v_flashbang.mdl" "models/css/v_flashbang.mdl"
"models/v_g3sg1.mdl" "models/css/v_g3sg1.mdl"
"models/v_galil.mdl" "models/css/v_galil.mdl"
"models/v_glock18.mdl" "models/css/v_glock18.mdl"
"models/v_hegrenade.mdl" "models/css/v_hegrenade.mdl"
"models/v_knife.mdl" "models/css/v_knife.mdl"
"models/v_m3.mdl" "models/css/v_m3.mdl"
"models/v_m4a1.mdl" "models/css/v_m4a1.mdl"
"models/v_m249.mdl" "models/css/v_m249.mdl"
"models/v_mac10.mdl" "models/css/v_mac10.mdl"
"models/v_mp5.mdl" "models/css/v_mp5.mdl"
"models/v_p90.mdl" "models/css/v_p90.mdl"
"models/v_p228.mdl" "models/css/v_p228.mdl"
"models/v_scout.mdl" "models/css/v_scout.mdl"
"models/v_sg550.mdl" "models/css/v_sg550.mdl"
"models/v_sg552.mdl" "models/css/v_sg552.mdl"
"models/v_smokegrenade.mdl" "models/css/v_smokegrenade.mdl"
"models/v_tmp.mdl" "models/css/v_tmp.mdl"
"models/v_ump45.mdl" "models/css/v_ump45.mdl"
"models/v_usp.mdl" "models/css/v_usp.mdl"
"models/v_xm1014.mdl" "models/css/v_xm1014.mdl"
The errors happens on every 4-5 retry's from players.
lqlqlq is offline
Old 06-14-2013, 07:31
Bos93
This message has been deleted by Bos93.
Bos93
Veteran Member
Join Date: Jul 2010
Old 06-14-2013 , 07:39   Re: Changing weapon models (Extended)
Reply With Quote #89

this plugin http://forums.alliedmods.net/showpos...8&postcount=87 for change player models,but your config for weapon models.

?
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
lqlqlq
Senior Member
Join Date: Jan 2008
Old 06-14-2013 , 07:49   Re: Changing weapon models (Extended)
Reply With Quote #90

awww...Sorry.
here is:
Code:
/*    Formatright © 2012, ConnorMcLeod

    Weapons Models is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Weapons Models; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#define VERSION "0.2.2"

/* ChangeLog
 *
 * v0.2.2
 * - Fixed bad formating that was preventing default models from being detected
 * 
 * v0.2.1
 * - Fixed "Invalid trie handle provided" error
 * 
 * v0.2.0
 * - Check viewmodel and weaponmodel instead of weapon type, so it now supports shield models
 * 
 * v0.1.7
 * - Adjustments
 * 
 * v0.1.6
 * - Remove FreeEntPrivateData, was causing player from not being reconnected to server
 * 
 * v0.1.5
 * - Don't need to precache backpack model anymore
 * 
 * v0.1.4
 * - Store allocated view and weapon models in arrays instead of Trie
 * - Fixed w_backpack.mdl was not precached (bad string name was passed...)
 * 
 * v0.1.3
 * - Store precache returns values into a trie instead of checking trie and resend precache
 * - Only store world new models strings in a trie
 *
 * v0.1.2
 * - Moved  backpack model precache from precache hook to plugin_precache
 * 
 * v0.1.1
 * - Fixed first map where weapons were not registering
 * 
 * v0.1.0
 * - Hook Ham_Item_Deploy and set models there instead of hooking FM_ModelIndex that was intensive
 * 
 * v0.0.1 First Shot 
 */

#include <amxmodx>
#include <fakemeta_stocks>
#include <hamsandwich>

const MAX_MODEL_LENGTH = 64

new const m_rgpPlayerItems_CBasePlayer[6] = {367,368,...}
const m_pActiveItem = 373

const XO_WEAPON = 4
const m_pPlayer = 41

new Trie:g_tszWorldModels // handles new models strings (all excepted v_ and w_ models)
new Trie:g_tiPrecacheReturns // handles all new models precache returns integers
new Trie:g_tiszViewModels
new Trie:g_tiszWeaponModels

public plugin_precache()
{
	new szModelsFile[128]
	get_localinfo("amxx_configsdir", szModelsFile, charsmax(szModelsFile))
	add(szModelsFile, charsmax(szModelsFile), "/weapons_models.ini")

	new iFile = fopen(szModelsFile, "rt")
	if(!iFile)
	{
		return
	}

	new szDatas[192], szOldModel[MAX_MODEL_LENGTH], szNewModel[MAX_MODEL_LENGTH]
	new szWeaponClass[32], Trie:tRegisterWeaponDeploy = TrieCreate(), iId

	new Trie:tWeaponsIds = TrieCreate()
	TrieSetCell(tWeaponsIds, "p228", CSW_P228)
	TrieSetCell(tWeaponsIds, "scout", CSW_SCOUT)
	TrieSetCell(tWeaponsIds, "hegrenade", CSW_HEGRENADE)
	TrieSetCell(tWeaponsIds, "xm1014", CSW_XM1014)
	TrieSetCell(tWeaponsIds, "c4", CSW_C4)
	TrieSetCell(tWeaponsIds, "mac10", CSW_MAC10)
	TrieSetCell(tWeaponsIds, "aug", CSW_AUG)
	TrieSetCell(tWeaponsIds, "smokegrenade", CSW_SMOKEGRENADE)
	TrieSetCell(tWeaponsIds, "elite", CSW_ELITE)
	TrieSetCell(tWeaponsIds, "fiveseven", CSW_FIVESEVEN)
	TrieSetCell(tWeaponsIds, "ump45", CSW_UMP45)
	TrieSetCell(tWeaponsIds, "sg550", CSW_SG550)
	TrieSetCell(tWeaponsIds, "galil", CSW_GALIL)
	TrieSetCell(tWeaponsIds, "famas", CSW_FAMAS)
	TrieSetCell(tWeaponsIds, "usp", CSW_USP)
	TrieSetCell(tWeaponsIds, "glock18", CSW_GLOCK18)
	TrieSetCell(tWeaponsIds, "awp", CSW_AWP)
	TrieSetCell(tWeaponsIds, "mp5navy", CSW_MP5NAVY)
	TrieSetCell(tWeaponsIds, "m249", CSW_M249)
	TrieSetCell(tWeaponsIds, "m3", CSW_M3)
	TrieSetCell(tWeaponsIds, "m4a1", CSW_M4A1)
	TrieSetCell(tWeaponsIds, "tmp", CSW_TMP)
	TrieSetCell(tWeaponsIds, "g3sg1", CSW_G3SG1)
	TrieSetCell(tWeaponsIds, "flashbang", CSW_FLASHBANG)
	TrieSetCell(tWeaponsIds, "deagle", CSW_DEAGLE)
	TrieSetCell(tWeaponsIds, "sg552", CSW_SG552)
	TrieSetCell(tWeaponsIds, "ak47", CSW_AK47)
	TrieSetCell(tWeaponsIds, "knife", CSW_KNIFE)
	TrieSetCell(tWeaponsIds, "p90", CSW_P90)

	new c, bool:bServerDeactivateRegistered, iExtPos
	while(!feof(iFile))
	{
		fgets(iFile, szDatas, charsmax(szDatas))
		trim(szDatas)
		if(!(c=szDatas[0]) || c == ';' || c == '#' || (c == '/' && szDatas[1] == '/'))
		{
			continue
		}

		if(		parse(szDatas, szOldModel, charsmax(szOldModel), szNewModel, charsmax(szNewModel)) == 2
		&&	file_exists(szNewModel)	)
		{
			if( ( (c=szOldModel[7]) == 'p' || c == 'v' ) && szOldModel[8] == '_' )
			{
				if( equal(szOldModel[9], "mp5", 3 ) )
				{
					copy(szWeaponClass, charsmax(szWeaponClass), "weapon_mp5navy")
				}
				else
				{
					iExtPos = strlen(szOldModel) - 4
					szOldModel[ iExtPos ] = EOS
					formatex(szWeaponClass, charsmax(szWeaponClass), "weapon_%s", szOldModel[9])
					szOldModel[ iExtPos ] = '.'
				}
				
				if( !TrieGetCell(tWeaponsIds, szWeaponClass[7], iId) )
				{
					continue
				}

				if( c == 'v' )
				{
					if( !g_tiszViewModels )
					{
						g_tiszViewModels = TrieCreate()
					}

					TrieSetCell(g_tiszViewModels, szOldModel, EF_AllocString( szNewModel ) )
				}
				else
				{
					if( !g_tiszWeaponModels )
					{
						g_tiszWeaponModels = TrieCreate()
					}
					
					TrieSetCell(g_tiszWeaponModels, szOldModel, EF_AllocString( szNewModel ) )
				}
				
				if( !TrieKeyExists(tRegisterWeaponDeploy, szWeaponClass) )
				{
					TrieSetCell
					(
						tRegisterWeaponDeploy,
						szWeaponClass,
						RegisterHam(Ham_Item_Deploy, szWeaponClass, "MiscWeapon_Deploy_Post", true)
					)
				}
			}
			else
			{
				if( !bServerDeactivateRegistered && equal(szOldModel, "models/w_backpack.mdl") )
				{
					bServerDeactivateRegistered = true
					register_forward(FM_ServerDeactivate, "ServerDeactivate")
				}

				if( !g_tszWorldModels )
				{
					g_tszWorldModels = TrieCreate()
				}
				else if( TrieKeyExists(g_tszWorldModels, szOldModel) )
				{
					new szModel[MAX_MODEL_LENGTH]
					TrieGetString(g_tszWorldModels, szOldModel, szModel, charsmax(szModel))
					log_amx("%s world model is already set to %s, can't set it to %s !!", szWeaponClass, szModel, szNewModel)
					continue
				}
				TrieSetString(g_tszWorldModels, szOldModel, szNewModel)
			}

			if( !g_tiPrecacheReturns )
			{
				g_tiPrecacheReturns = TrieCreate()
			}
			TrieSetCell(g_tiPrecacheReturns, szOldModel, EF_PrecacheModel(szNewModel))
		}
	}
	fclose(iFile)

	TrieDestroy(tRegisterWeaponDeploy)
	TrieDestroy(tWeaponsIds)

	if( g_tiPrecacheReturns )
	{
		register_forward(FM_PrecacheModel, "PrecacheModel")

		if( g_tszWorldModels )
		{
			register_forward(FM_SetModel, "SetModel")
		}
	}
}

public plugin_init()
{
	register_plugin("Weapons Models", VERSION, "ConnorMcLeod")
}

public ServerDeactivate()
{
	static bool:bDontPassThisTwice = false
	if( bDontPassThisTwice ) // unregister this would be waste of time
	{
		return
	}
	bDontPassThisTwice = true

	new id, c4 = FM_NULLENT
	while( (c4 = EF_FindEntityByString(c4, "classname", "weapon_c4")) > 0 )
	{
		id = get_pdata_cbase(c4, m_pPlayer)
		if( id > 0 )
		{
			// can't use set_pdata_cbase on players at this point
			set_pdata_int(id, m_rgpPlayerItems_CBasePlayer[5], 0)
			set_pdata_int(id, m_pActiveItem, 0)
			// tried to remove c4 entity but server just stucks
		}
	}
}

public PrecacheModel(const szModel[])
{
	static iReturn
	if( TrieGetCell(g_tiPrecacheReturns, szModel, iReturn) )
	{
		forward_return(FMV_CELL, iReturn)
		return FMRES_SUPERCEDE
	}
	return FMRES_IGNORED
}

public MiscWeapon_Deploy_Post( iWeapon )
{
	new id = get_pdata_cbase(iWeapon, m_pPlayer, XO_WEAPON)
	if( !is_user_alive(id) ) 
    	{ 
        return 
    	} 
	if( get_pdata_cbase(id, m_pActiveItem) == iWeapon )
	{
		new iszNewModel, szOldModel[MAX_MODEL_LENGTH]
		pev(id, pev_viewmodel2, szOldModel, charsmax(szOldModel))
		if( g_tiszViewModels && TrieGetCell(g_tiszViewModels, szOldModel, iszNewModel) )
		{
			set_pev(id, pev_viewmodel, iszNewModel)
		}
		if( g_tiszWeaponModels && TrieGetCell(g_tiszWeaponModels, szOldModel, iszNewModel) )
		{
			set_pev(id, pev_weaponmodel, iszNewModel)
		}
	}
}

public SetModel(const iEnt, const szModel[])
{
	new szNewModel[MAX_MODEL_LENGTH]
	if( TrieGetString(g_tszWorldModels, szModel, szNewModel, charsmax(szNewModel)) )
	{
		EF_SetModel(iEnt, szNewModel)
		return FMRES_SUPERCEDE
	}
	return FMRES_IGNORED
}
Im confuse in speed ...
lqlqlq is offline
Reply



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 02:03.


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