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

Cs 1.6 V.I.P/Admin model Plugin !


Post New Thread Reply   
 
Thread Tools Display Modes
alilp
Junior Member
Join Date: Aug 2017
Old 08-08-2017 , 08:57   Re: Cs 1.6 V.I.P/Admin model Plugin !
Reply With Quote #11

last code worked fine thanks
__________________
Never Learned any scripting lang completely but always got what I wanted by editing and learning the things I need from others scripts !
So please be kind with me and dont see me as a pro .

Last edited by alilp; 08-08-2017 at 09:47.
alilp is offline
Usama Ali
Member
Join Date: Apr 2020
Old 04-14-2022 , 21:40   Re: Cs 1.6 V.I.P/Admin model Plugin !
Reply With Quote #12

can someone edit this code and only keep it for CT not T..
Usama Ali is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 04-15-2022 , 15:10   Re: Cs 1.6 V.I.P/Admin model Plugin !
Reply With Quote #13

Quote:
Originally Posted by Usama Ali View Post
can someone edit this code and only keep it for CT not T..
How to use: Go to addons\amxmodx\configs and create config file with this name CustomModels.ini.
How to create a model: "Model Name" "Model Flags" "Model Team" for example
"T_model" "abcde" "1" -> T team model for flags 'abcde'
"CT_model" "fl" "2" -> CT team model for flags 'fl'
"model" -> model for all players

Code:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <amxmisc>
#include <vip>

new const g_szModelFile[ ] = "CustomModels.ini";

enum _:ModelData
{ 
	Model_Name[ 64 ],
	Model_Flag[ 32 ],
	CsTeams:Model_Team
}

new Array:g_aModels, eModel[ ModelData ]

public plugin_init( ) 
{
	register_plugin( "VIP: Custom Models", "1.0.2", "Supremache" );
	RegisterHam( Ham_Spawn, "player", "CBasePlayer_Spawn", 1 )
    
	if( ArraySize( g_aModels ) )
	{
		server_print( "[Custom Models] Loaded %d models", ArraySize( g_aModels ) )
	}
}

public plugin_precache() 
{
	g_aModels = ArrayCreate( ModelData );
	ReadFile( );
}
    
public CBasePlayer_Spawn( id )
{
	if( is_user_alive( id ) )
	{
		for( new CsTeams:iTeam = cs_get_user_team( id ), i; i < ArraySize( g_aModels ); i++ )
		{
			ArrayGetArray( g_aModels, i, eModel )
			
			if( ( !eModel[ Model_Team ] || iTeam == eModel[ Model_Team ] ) && has_all_flags( id , eModel[ Model_Flag ] ) )
			{
				cs_set_user_model( id, eModel[ Model_Name ] )
				break;
			}
			else cs_reset_user_model( id );
		}
	}
}

ReadFile( )
{
	new g_szFile[ 128 ], g_szConfigs[ 64 ];
	get_configsdir( g_szConfigs, charsmax( g_szConfigs ) )
	formatex( g_szFile, charsmax( g_szFile ), "%s/%s", g_szConfigs, g_szModelFile )
    
	new iFile = fopen( g_szFile, "rt" );
    
	if( iFile )
	{
		new szData[ 512 ], szModel[ 64 ], szTeam[ 32 ];
        
		while( fgets( iFile, szData, charsmax( szData ) ) )
		{    
			trim( szData );
            
			switch( szData[ 0 ] )
			{
				case EOS, ';',  '#', '/': continue;

				default:
				{
					eModel[ Model_Flag ][ 0 ] = EOS;
					szTeam[ 0 ] = EOS;
                    
					parse ( szData, szModel, charsmax( szModel ), eModel[ Model_Flag ], charsmax( eModel[ Model_Flag ] ), szTeam, charsmax( szTeam ) )
                    
					trim( szModel ); trim( szTeam ); trim( eModel[ Model_Flag ] );

					precache_player_model( szModel )
					copy( eModel[ Model_Name ], charsmax( eModel[ Model_Name ] ), szModel );
					
					eModel[ Model_Team ] = CsTeams:clamp( str_to_num( szTeam ), _:CS_TEAM_UNASSIGNED, _:CS_TEAM_SPECTATOR );
					
					ArrayPushArray( g_aModels, eModel );
				}
			}
		}
		fclose( iFile );
	}
	else log_amx( "ERROR: ^"%s^" not found!", g_szFile )
} 

//Credits to OciXCrom
precache_player_model(const szModel[], &id = 0)
{
	new model[128]
	formatex(model, charsmax(model), "models/player/%s/%sT.mdl", szModel, szModel)

	if(file_exists(model))
	{
		id = precache_generic(model)
	}

	static const extension[] = "T.mdl"
	#pragma unused extension
	
	copy(model[strlen(model) - charsmax(extension)], charsmax(model), ".mdl")
    
	return precache_generic(model)
}
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache 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 07:19.


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