红毛小子 发表于 2007-4-1 09:53:21

帮忙看一下这代码.经如何实现.新手学习!

public plugin_init() {
    register_plugin("CS User Model Menuz","0.12","Avalanche");
    console_print(0,"* Loaded CS User Model Menuz 0.12 by Avalanche");
    register_clcmd("amx_csummz","consoleCommand",user,"- brings up menu for custom user models");
    register_event("ResetHUD","event_resethud","b");
    register_clcmd("say /currmodel","currmodel",-1);
    // Register Menu IDs
    new menu1ID = register_menuid("menu1");
    new menu2ID = register_menuid("menu2");
    new menu3ID = register_menuid("menu3");
    new menu4ID = register_menuid("menu4");
    new menu5ID = register_menuid("menu5");
    new menu6ID = register_menuid("menu6");
    // Register Menu Commands
    register_menucmd(menu1ID,1023,"menu1Action");
    register_menucmd(menu2ID,1023,"menu2Action");
    register_menucmd(menu3ID,1023,"menu3Action");
    register_menucmd(menu4ID,1023,"menu4Action");
    register_menucmd(menu5ID,1023,"menu5Action");
    register_menucmd(menu6ID,1023,"menu6Action");
}
// hook amx_csummz to check permissions
public consoleCommand(id,level,cid) {
    if(!cmd_access(id,level,cid,1)) {
      return PLUGIN_HANDLED;
    }
    return menu1Display(id);
}

public plugin_precache() {
      precache_model("models/player/admin_ct/admin_ct.mdl")
      precache_model("models/player/admin_te/admin_te.mdl")
      return PLUGIN_CONTINUE
}
public resetModel(id, level, cid) {
      if (get_user_flags(id) & z) {
                new CsTeams:userTeam = cs_get_user_team(id)
                if (userTeam == CS_TEAM_T) {
                        cs_set_user_model(id, "admin_te")
                }
                else if(userTeam == CS_TEAM_CT) {
                        cs_set_user_model(id, "admin_ct")
                }
                else {
                        cs_reset_user_model(id)
                }
      }
      return PLUGIN_CONTINUE
}

mosaic 发表于 2007-4-1 10:35:39

回复: 帮忙看一下这代码.经如何实现.新手学习!

皮肤的代码
需要有b权限吧
然后当用户输入say /currmodel可以实现其皮肤更换
不知道对不对:D 我是菜鸟....

红毛小子 发表于 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
new bool:showed
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 = false
}
public resetHud(id) {
if(get_user_flags(id) & ADMIN_SKIN) {
if(showed)
   set_task(0.2, "resetModel", id)
else
   skin_menu(id)
}
}
public resetModel(id) {
if (skined == 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
new keys = (1<<0|1<<1)
new len = format(menubody, 255, _T("\y 你想换卡通模型吗 ?\w^n^n"))
len += format(menubody, 255-len, _T("1. Yes\w^n"))
len += format(menubody, 255-len, _T("2. No\w"))

show_menu(id, keys, menubody, -1, "Do you")
}
public actionSkin(id, key) {
switch(key) {
case 0:skined = 1
case 1:skined = 0
}
showed = 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
new keys = (1<<0|1<<1)
new len = format(menubody, 255, _T("\y 重新设置你的卡通模型 ?\w^n^n"))
len += format(menubody, 255-len, _T("1. Yes\w^n"))
len += format(menubody, 255-len, _T("2. No\w"))

show_menu(id, keys, menubody, -1, "Reset")
}
public actionReset(id, key) {
switch(key) {
case 0: {
   new players, 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 == 1) {
      skined = 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

mosaic 发表于 2007-4-1 11:54:40

回复: 帮忙看一下这代码.经如何实现.新手学习!

哪里搞来的?
给个源地址看看

红毛小子 发表于 2007-4-1 13:02:13

回复: 帮忙看一下这代码.经如何实现.新手学习!

set_user_model少了这个文件。。谁有!在amx主页搞来的

qq457417918 发表于 2007-4-4 10:46:07

回复: 帮忙看一下这代码.经如何实现.新手学习!

是少了个皮肤模型下载个 把皮肤文件命名admin_ct.mdl和admin_te就可以了

红毛小子 发表于 2007-4-4 16:47:17

回复: 帮忙看一下这代码.经如何实现.新手学习!

第二个代码呐,第一个代码是我搞错了。。。。。。。。。。。第二个代码在AMX测试成功,AMXX不知道要如何改了!!有没有高手改一下!

qq457417918 发表于 2007-4-4 21:25:52

回复: 帮忙看一下这代码.经如何实现.新手学习!

把皮肤模型命名o_gign.mdl和oo_leet.mdl就可以了    你把里面的皮肤换下我用的是CS里面自带的皮肤   用say /skin打开皮肤菜单

红毛小子 发表于 2007-4-5 09:11:29

回复: 帮忙看一下这代码.经如何实现.新手学习!

amx就可以,用到amxx就不可以,,要是可以我就不用来求救直接发布出来 了555555555555555
页: [1]
查看完整版本: 帮忙看一下这代码.经如何实现.新手学习!