|
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
new g_bwEnt[33]
public plugin_init(){
register_plugin("HATS", "0.2", "HATS")
RegisterHam(Ham_Spawn, "player", "Spawn", 1);
register_event("DeathMsg","Death_Remove_Hat","a");
}
public plugin_precache(){
precache_model("models/Hat/dodgerscap.mdl")
precache_model("models/Hat/santahat.mdl")
}
public client_connect(id){
if(g_bwEnt[id] > 0) engfunc(EngFunc_RemoveEntity,g_bwEnt[id])
g_bwEnt[id] = 0
}
public client_disconnect(id){
if(g_bwEnt[id] > 0) engfunc(EngFunc_RemoveEntity,g_bwEnt[id])
g_bwEnt[id] = 0
}
public Spawn(id){
if( is_user_alive(id) ){
if( get_user_team(id)==1 ){
set_pev(g_bwEnt[id], pev_movetype, MOVETYPE_FOLLOW)
set_pev(g_bwEnt[id], pev_aiment, id)
set_pev(g_bwEnt[id], pev_rendermode, kRenderNormal)
set_pev(g_bwEnt[id], pev_renderamt, 0.0)
engfunc(EngFunc_SetModel, g_bwEnt[id], dodgerscap.mdl)
}
else if( get_user_team(id)==2 ){
set_pev(g_bwEnt[id], pev_movetype, MOVETYPE_FOLLOW)
set_pev(g_bwEnt[id], pev_aiment, id)
set_pev(g_bwEnt[id], pev_rendermode, kRenderNormal)
set_pev(g_bwEnt[id], pev_renderamt, 0.0)
engfunc(EngFunc_SetModel, g_bwEnt[id], santahat.mdl)
}
}
return PLUGIN_CONTINUE
}
public Death_Remove_Hat(){
new victim = read_data(2)
if(is_user_connected(victim)){
engfunc(EngFunc_RemoveEntity,g_bwEnt[victim])
g_bwEnt[victim] = 0
}
return PLUGIN_CONTINUE
} |
|