|
楼主 |
发表于 2007-4-1 10:55:27
|
显示全部楼层
来自 中国–广东–揭阳
回复: 帮忙看一下这代码.经如何实现.新手学习!
#define ADMIN_SKIN ADMIN_KICK
#define ADMIN_RESET ADMIN_CFG
#include <translator>
#include <amxmod>
#include <amxmisc>
#include <vexdum>
new skined[33]
new bool:showed[33]
public plugin_precache() {
precache_model("models/player/o_gign/o_gign.mdl")
precache_model("models/player/o_leet/o_leet.mdl")
}
public plugin_init() {
register_plugin("AMX Admin Model", "1.1.2", "whitemike/DokTor")
load_translations("adminmodels")
register_event("ResetHUD", "resetHud", "z")
register_clcmd("say /skin","cmdSkin",ADMIN_SKIN,_T("- 显示卡通模型菜单"))
register_clcmd("skin","cmdSkin",ADMIN_SKIN,_T("- 显示卡通模型菜单"))
register_clcmd("/resetskin","cmdReset",ADMIN_RESET,_T("- 卡通模型失效"))
register_clcmd("resetskin","cmdReset",ADMIN_RESET,_T("- 卡通模型失效"))
register_menucmd(register_menuid("Do you"), 255, "actionSkin")
register_menucmd(register_menuid("Reset"), 255, "actionReset")
}
public client_putinserver(id) {
showed[id] = false
}
public resetHud(id) {
if(get_user_flags(id) & ADMIN_SKIN) {
if(showed[id])
set_task(0.2, "resetModel", id)
else
skin_menu(id)
}
}
public resetModel(id) {
if (skined[id] == 1) {
new userTeam = get_user_team(id)
if (userTeam == 1) {
set_user_model(id, "admin_te")
}
else if(userTeam == 2) {
set_user_model(id, "admin_ct")
}
else {
set_user_model(id)
}
}
else
set_user_model(id)
}
public cmdSkin(id,level,cid) {
if(!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
skin_menu(id)
return PLUGIN_HANDLED
}
skin_menu(id) {
new menubody[256]
new keys = (1<<0|1<<1)
new len = format(menubody, 255, _T("\y 你想换卡通模型吗 ?\w^n^n"))
len += format(menubody[len], 255-len, _T("1. Yes\w^n"))
len += format(menubody[len], 255-len, _T("2. No\w"))
show_menu(id, keys, menubody, -1, "Do you")
}
public actionSkin(id, key) {
switch(key) {
case 0:skined[id] = 1
case 1:skined[id] = 0
}
showed[id] = true
set_task(0.2, "resetModel", id)
}
public cmdReset(id,level,cid) {
if(!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
reset_menu(id)
return PLUGIN_HANDLED
}
reset_menu(id) {
new menubody[256]
new keys = (1<<0|1<<1)
new len = format(menubody, 255, _T("\y 重新设置你的卡通模型 ?\w^n^n"))
len += format(menubody[len], 255-len, _T("1. Yes\w^n"))
len += format(menubody[len], 255-len, _T("2. No\w"))
show_menu(id, keys, menubody, -1, "Reset")
}
public actionReset(id, key) {
switch(key) {
case 0: {
new players[32], inum, player
get_players(players, inum, "c")
for(new i=1; i<inum; i++) {
player = players
if(get_user_flags(player) & ADMIN_SKIN) {
if(skined[player] == 1) {
skined[player] = 0
set_user_model(player)
}
else
return PLUGIN_HANDLED
}
}
}
case 1: return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
这个少了个文件,
admin_models.amx" failed to load: Plugin uses an unknown function (name "set_user_model") - check your modules.ini |
|