- 听众
- 收听
- 积分
- 296
- 主题
- 回帖
- 0
- 精华
注册时间2008-4-20
最后登录1970-1-1
该用户从未签到
|
发表于 2011-8-6 00:12:07
|
显示全部楼层
本帖最后由 badmonkey 于 2011-8-6 00:12 编辑
要么?给你改好了,自己编译去,去当然你还得搞2个模型,一个是MM.另一个就是ADMIN.
- #include <amxmodx>
- #include <cstrike>
- #include <fakemeta>
- #include <hamsandwich>
- enum
- {
- OTHERS,
- ADMIN,
- MM
-
- }
- #define TID 5354
- #define TID2 5999
- new model[9][32]
- new usertype[33]
- new bool:has_custom_model[33]
- new Float: interval_counter
- public plugin_init()
- {
- register_plugin("playermdl", "1.22", "nooby")
- RegisterHam(Ham_Spawn, "player", "fwdPlayerSpawn", 1)
- register_forward(FM_SetClientKeyValue,"fwdSetClientKeyValue")
- register_forward(FM_ClientUserInfoChanged,"fwdClientUserInfoChanged")
- register_logevent("eventRound_End", 2, "1=Round_End")
- return PLUGIN_CONTINUE
- }
- public eventRound_End()
- {
- interval_counter = 0.0
- }
- public client_putinserver(id)
- {
- client_cmd(id, "cl_minmodels 0")
- return PLUGIN_CONTINUE
- }
- public plugin_precache()
- {
- model[ADMIN] = "ADMIN"
- model[MM] = "MM"
- precache_model("models/player/ADMIN/ADMIN.mdl")
- precache_model("models/player/MM/MM.mdl")
-
- return PLUGIN_CONTINUE
- }
- stock get_usertype(id)
- {
- new uflag = get_user_flags(id)
- if (uflag & ADMIN_KICK)
- {
- return ADMIN
- }
- static name[32]
- get_user_info(id, "name", name, 31)
- if (contain(name, "MM") != -1)
- {
- return MM
- }
- return OTHERS
- }
- public fwdPlayerSpawn(id, level, cid)
- {
- if (task_exists(id + TID))
- {
- remove_task(id + TID)
- }
- if (is_user_bot(id) || is_user_hltv(id) || !is_user_connected(id))
- return
- new utype
- usertype[id] = utype = get_usertype(id)
- if (utype == OTHERS)
- fm_reset_user_model(id)
- else
- {
- new currentmodel[32]
- fm_get_user_model(id, currentmodel, sizeof currentmodel - 1)
-
- if(!equal(currentmodel, model[utype]))
- {
- set_task(1.0 + interval_counter, "task_set_model", id + TID)
- interval_counter += 0.2
- }
- }
- return
-
- }
- public client_disconnect(id)
- {
- if (task_exists(id + TID))
- {
- remove_task(id + TID)
- }
- if (task_exists(id + TID2))
- {
- remove_task(id + TID2)
- }
- has_custom_model[id] = false
- }
- public fwdClientUserInfoChanged(id, infobuffer)
- {
- if (!has_custom_model[id] || is_user_bot(id) || is_user_hltv(id))
- return FMRES_IGNORED
-
- new currentmodel[32]
- fm_get_user_model(id, currentmodel, sizeof currentmodel - 1)
-
- if (!equal(currentmodel, model[usertype[id]]))
- fm_set_user_model(id, model[usertype[id]])
-
- return FMRES_IGNORED
- }
- public fwdSetClientKeyValue(id, infobuffer, key[], value[])
- {
- if (has_custom_model[id] && equal(key, "model"))
- {
- return FMRES_SUPERCEDE
- }
- if (id && equal(key, "name") && is_user_connected(id))
- {
- if (task_exists(id + TID2))
- {
- remove_task(id + TID2)
- }
- set_task(0.2, "task_check_model", id + TID2)
- }
- return FMRES_IGNORED
- }
- public task_check_model(taskid)
- {
- new id = taskid - TID2
- if (!is_user_connected(id) || !is_user_alive(id))
- {
- return
- }
- new utype
- usertype[id] = utype = get_usertype(id)
- new currentmodel[32]
- fm_get_user_model(id, currentmodel, sizeof currentmodel - 1)
- if(!equal(currentmodel, model[utype]))
- {
- if (task_exists(id + TID))
- {
- remove_task(id + TID)
- }
- set_task(1.0 + interval_counter, "task_set_model", id + TID)
- interval_counter += 0.3
- }
- }
- public task_set_model(taskid)
- {
- if (interval_counter > 3.0)
- {
- interval_counter = 0.0
- }
- new id = taskid - TID
- fm_set_user_model(id, model[usertype[id]])
- }
- stock fm_set_user_model(player, modelname[])
- {
- engfunc(EngFunc_SetClientKeyValue, player, engfunc(EngFunc_GetInfoKeyBuffer, player), "model", modelname)
- has_custom_model[player] = true
- }
- stock fm_get_user_model(player, model[], len)
- {
- engfunc(EngFunc_InfoKeyValue, engfunc(EngFunc_GetInfoKeyBuffer, player), "model", model, len)
- }
- stock fm_reset_user_model(player)
- {
- dllfunc(DLLFunc_ClientUserInfoChanged, player, engfunc(EngFunc_GetInfoKeyBuffer, player))
- has_custom_model[player] = false
- }
复制代码
|
评分
-
查看全部评分
|