心静如水 发表于 2009-4-13 23:10:04

请教这个T/CT帽子插件怎么样改才正确呢?

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

new g_bwEnt

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 > 0) engfunc(EngFunc_RemoveEntity,g_bwEnt)
      g_bwEnt = 0
}

public client_disconnect(id){
      if(g_bwEnt > 0) engfunc(EngFunc_RemoveEntity,g_bwEnt)
      g_bwEnt = 0
}

public Spawn(id){
      if( is_user_alive(id) ){
            if( get_user_team(id)==1 ){
            set_pev(g_bwEnt, pev_movetype, MOVETYPE_FOLLOW)
            set_pev(g_bwEnt, pev_aiment, id)
            set_pev(g_bwEnt, pev_rendermode, kRenderNormal)
            set_pev(g_bwEnt, pev_renderamt, 0.0)
            engfunc(EngFunc_SetModel, g_bwEnt, dodgerscap.mdl)
            }
            else if( get_user_team(id)==2 ){
            set_pev(g_bwEnt, pev_movetype, MOVETYPE_FOLLOW)
            set_pev(g_bwEnt, pev_aiment, id)
            set_pev(g_bwEnt, pev_rendermode, kRenderNormal)
            set_pev(g_bwEnt, pev_renderamt, 0.0)
            engfunc(EngFunc_SetModel, g_bwEnt, santahat.mdl)
            }
            }
      return PLUGIN_CONTINUE
}

public Death_Remove_Hat(){
      new victim = read_data(2)
      if(is_user_connected(victim)){
             engfunc(EngFunc_RemoveEntity,g_bwEnt)
             g_bwEnt = 0
      }
      return PLUGIN_CONTINUE
}

jinhong0610 发表于 2009-4-15 07:59:59

学习一下了

zwfgdlc 发表于 2009-4-15 17:47:44

http://forums.alliedmods.net/showthread.php?t=69386

心静如水 发表于 2009-4-15 20:42:01

本帖最后由 心静如水 于 2009-4-15 21:28 编辑

谢谢W版主....不过太深奥了........原以为用两个事件就能解决了..........
主要是想知道戴帽子的命令....................

lili2009 发表于 2010-3-14 19:56:09

http://forums.alliedmods.net/showthread.php?t=67801

METALLICA 发表于 2010-3-17 18:09:09

额。插件应该有地方改的吧
页: [1]
查看完整版本: 请教这个T/CT帽子插件怎么样改才正确呢?