Quote:
Originally Posted by DruGzOG
PHP Code:
#include <amxmodx> #include <cstrike> #include <hamsandwich> public plugin_init() { register_plugin( "Team Model", "1.0", "LeviN" ); RegisterHam( Ham_Spawn, "player", "set_players_models", 1 ); } public plugin_precache() { precache_model("models/player/smith/smith.mdl"); } public set_players_models(){ new i; new players[32], ingame; get_players(players,ingame); for(i=1;i<=ingame;i++){ if(cs_get_user_team(i) == CS_TEAM_CT){ cs_set_user_model(i,"smith"); } } return PLUGIN_CONTINUE; }
try that
|
Okay, gross.
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
new const g_szModelName[] = "smith";
public plugin_precache()
{
new szModelFilename[128];
formatex(szModelFilename, 127, "models/player/%s/%s.mdl",\
g_szModelName, g_szModelName);
precache_model(szModelFilename);
}
public plugin_init()
{
register_plugin("CT Model", "0.1", "Exolent");
RegisterHam(Ham_Spawn, "player", "FwdPlayerSpawn", 1);
}
public FwdPlayerSpawn(iPlayer)
{
if( is_user_alive(iPlayer) )
{
if( cs_get_user_team(iPlayer) == CS_TEAM_CT )
{
cs_set_user_model(iPlayer, g_szModelName);
}
}
}
This still isn't the best way.
The best and most efficient way is hooking forwards to block the model from being changed and other complicated stuff.
However, I was lazy and since this is only the CT's, it shouldn't cause SVC_BAD.
__________________