Raised This Month: $ Target: $400
 0% 

Topcolor problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hzqst
Senior Member
Join Date: Jul 2008
Old 05-19-2010 , 10:42   Topcolor problem
Reply With Quote #1

PHP Code:
new const mdl_scout[] = { "tf2_scout_1"}
new const 
mdl_heavy[] = { "tf2_heavy_1"}
enum{
 
CS_TEAM_UNASSIGNED 0,
 
CS_TEAM_T,
 
CS_TEAM_CT,
 
CS_TEAM_SPECTATOR
}
#define COLOR_RED   0
#define COLOR_BLU   150
 
new g_model[33][48]
new 
g_modelcolor[33][8]
public 
plugin_init(){
 
RegisterHam(Ham_Spawn"player""fw_Spawn_Post"1)
 
register_forward(FM_SetClientKeyValue"fw_SetClientKeyValue")
 
register_forward(FM_ClientUserInfoChanged"fw_ClientUserInfoChanged")
 
server_cmd("sv_restart 5")
}
public 
plugin_precache(){
 
formatex(playermodelsizeof playermodel 1"models/player/%s/%s.mdl"mdl_scoutmdl_scout)
 
engfunc(EngFunc_PrecacheModelplayermodel)
 
formatex(playermodelsizeof playermodel 1"models/player/%s/%s.mdl"mdl_heavymdl_heavy)
 
engfunc(EngFunc_PrecacheModelplayermodel)
}
public 
fw_Spawn_Post(id){
 
format(g_model[id], sizeof g_model[] - 1"%s", (random_num(0,1)) ? mdl_heavy mdl_scout)
 
fm_set_user_model(idg_model[id])
 if(
get_user_team(id) == CS_TEAM_Tformat(g_modelcolor[id], sizeof g_modelcolor[] - 1"%d"COLOR_RED)
 else 
format(g_modelcolor[id], sizeof g_modelcolor[] - 1"%d"COLOR_BLU)
 
engfunc(EngFunc_SetClientKeyValueidengfunc(EngFunc_GetInfoKeyBufferid), "topcolor"g_modelcolor[id])
}
stock fm_set_user_model(id, const modelname[]){
 
engfunc(EngFunc_SetClientKeyValueidengfunc(EngFunc_GetInfoKeyBufferid), "model"modelname)
}
public 
fw_SetClientKeyValue(id, const infobuffer[], const key[]){
 if (
equal(key"model"))
  return 
FMRES_SUPERCEDE;
 if (
equal(key"topcolor"))
  return 
FMRES_SUPERCEDE;
 return 
FMRES_IGNORED;
}
public 
fw_ClientUserInfoChanged(id){
 if(
get_user_team(id) == CS_TEAM_Tformat(g_modelcolor[id], sizeof g_modelcolor[] - 1"%d"0)
 else 
format(g_modelcolor[id], sizeof g_modelcolor[] - 1"%d"150)
 
engfunc(EngFunc_SetClientKeyValueidengfunc(EngFunc_GetInfoKeyBufferid), "topcolor"g_modelcolor[id])
 new 
text[32]
 
get_user_info(id"model"textsizeof text 1)
 if(!
equal(textg_model[id])){
  
fm_set_user_model(idg_model[id])
  return 
FMRES_SUPERCEDE;
 }
 return 
FMRES_IGNORED;

All includes needed were put in
It works with some bugs, when I sometimes spawned as a CT I was in red ,as a T I was in blue ,like so,
I was not able to set topcolor in console and I don't think the engine itself could set topcolor because i blocked it

Last edited by hzqst; 05-19-2010 at 11:00.
hzqst is offline
Old 05-20-2010, 09:20
hzqst
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
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 03:32.


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