Raised This Month: $ Target: $400
 0% 

Player Models


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 11-09-2011 , 14:12   Player Models
Reply With Quote #1

I tried to make simple script using MeRcyLeZZ model tutorial, but i also used ConnorMcLeod's method with set_user_info.
Anyway this is the outcome, don't know is it working, didn't had time to test it.
My question is: "is there any better method than this?"
Will this result in SVC_BAD?
Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <hamsandwich>

new Ubrania_CT[4][]={"sas","gsg9","urban","gign"};
new Ubrania_Terro[4][]={"arctic","leet","guerilla","terror"};

new g_player_model[33][32];

public plugin_init()
{
	register_forward(FM_SetClientKeyValue, "SetClientKeyValue")
	register_forward(FM_ClientUserInfoChanged, "ClientUserInfoChanged")

	RegisterHam(Ham_Spawn, "player", "Ham_PlayerSpawn", 1)
}

public Ham_PlayerSpawn(id)
{
	if(is_user_alive(id))
		DefaultModel(id)
}

public DefaultModel(id)
{
	if (!is_user_connected(id))
		return PLUGIN_CONTINUE;
		
	new CsTeams:iTeam;
	iTeam = cs_get_user_team(id)
	switch(iTeam)
	{
		case CS_TEAM_T:fm_cs_set_user_model(id, Ubrania_Terro[random(sizeof(Ubrania_Terro))])
		case CS_TEAM_CT:fm_cs_set_user_model(id, Ubrania_CT[random(sizeof(Ubrania_CT))])
	}
	return PLUGIN_CONTINUE;
}

public fw_SetClientKeyValue(id, infobuffer[], key[], value[])
{   
	if(equal(key, "model") && !equal(value, g_player_model[id]))
		return FMRES_SUPERCEDE;
	
	return FMRES_IGNORED;
}

public fw_ClientUserInfoChanged( id )
{
	static currentmodel[32];
	fm_cs_get_user_model( id, currentmodel,  sizeof currentmodel - 1);
	
	if (!equal(currentmodel, g_player_model[id]))
		fm_cs_set_user_model( id, g_player_model[id]);
	
	return FMRES_IGNORED;
}

stock fm_cs_get_user_model(id, model[], len)
	get_user_info(id, "model", model, len)
		
stock fm_cs_set_user_model( player, const modelname[])
{
	copy(g_player_model[player], sizeof g_player_model[] - 1,modelname)
	set_user_info(player, "model", modelname)
}

Last edited by OvidiuS; 11-09-2011 at 14:19.
OvidiuS is offline
Send a message via Skype™ to OvidiuS
 


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 14:19.


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