|
楼主 |
发表于 2010-8-13 01:50:56
|
显示全部楼层
来自 中国–广东–佛山–南海区
- // --MENU 5 ACTION---------------------------------------------------------------------------
- public menu5Action(id,key) {
- // 6. Choose Random
- if(key == 5) {
- key = random_num(0,4);
- }
- // 1. US Seal Team 6
- if(key == 0) {
- modelAction(id,target[id],"urban");
- return 1;
- }
- // 2. German GSG-9
- if(key == 1) {
- modelAction(id,target[id],"gsg9");
- return 1;
- }
- // 3. UK Special Air Service
- if(key == 2) {
- modelAction(id,target[id],"sas");
- return 1;
- }
- // 4. French GIGN
- if(key == 3) {
- modelAction(id,target[id],"gign");
- return 1;
- }
- // 5. VIP
- if(key == 4) {
- modelAction(id,target[id],"vip");
- return 1;
- }
- // 0. Back
- if(key == 9) {
- menu3Display(id);
- return 1;
- }
- return 1;
- }
- // --MENU 6 ACTION---------------------------------------------------------------------------
- public menu6Action(id,key) {
- // 0. Back
- if(key == 9 && page[id] == 1) {
- menu3Display(id);
- return 1;
- }
- else if(key == 9 && page[id] > 1) {
- page[id] -=1 ;
- menu6Display(id);
- return 1;
- }
- // if choice is blank
- if(equal(choices[id][key],"")) {
- menu6Display(id); // reset menu
- return 1;
- }
- // 1-8. Varies
- if(key < 8) {
- modelAction(id,target[id],choices[id][key]);
- return 1;
- }
- // 9. Next
- if(key == 8 && equal(choices[id][key],"Next")) {
- page[id] += 1;
- menu6Display(id);
- return 1;
- }
- return 1;
- }
- // ------------------------------------------------------------------------------------------
- // --SET MODEL ACTION-----------------------------------------------------------------------
- // ------------------------------------------------------------------------------------------
- public modelAction(id,target[33],model[33]) {
- new username[33], authid[33];
- get_user_name(id,username,32);
- get_user_authid(id,authid,32);
- // if clearing models
- if(equal(model,".reset")) {
- // log the command
- log_amx("Cmd: ^"%s<%d><%s><>^" reset model for %s%s",username,get_user_userid(id),authid,isdigit(target[0]) ? "#" : "",target);
- // show activity
- switch(get_cvar_num("amx_show_activity")) {
- case 1: client_print(0,print_chat,"管理: 重新设定服饰为 %s%s",isdigit(target[0]) ? "#" : "",target);
- case 2: client_print(0,print_chat,"管理 %s: 重新设定服饰为 %s%s",username,isdigit(target[0]) ? "#" : "",target);
- }
- }
- else { // if setting models
- // log the command
- log_amx("Cmd: ^"%s<%d><%s><>^" set model %s on %s%s",username,get_user_userid(id),authid,model,isdigit(target[0]) ? "#" : "",target);
- // show activity
- switch(get_cvar_num("amx_show_activity")) {
- case 1: client_print(0,print_chat,"管理: 设定 %s 为 %s%s的服饰",model,isdigit(target[0]) ? "#" : "",target);
- case 2: client_print(0,print_chat,"管理 %s: 设定 %s 为 %s%s的服饰",username,model,isdigit(target[0]) ? "#" : "",target);
- }
- }
- new flags[2], team[33];
- if(equal(target,"@T")) { // All Terrorists
- flags = "e"; // team
- team = "TERRORIST";
- }
- else if(equal(target,"@CT")) { // All Counter-Terrorists
- flags = "e"; // team
- team = "CT";
- }
- else if(isdigit(target[0])) { // Specific Player or Yourself
- flags = "f"; // name
- get_user_name(str_to_num(target),team,32);
- }
- // Otherwise this leaves us with nothing, which is All Players
- // get targets
- new players[32], num;
- get_players(players,num,flags,team);
- // loop through
- for(new i=0;i<num;i++) {
- new player = players[i]; // our player
- if(equal(model,".reset")) { // if reset
- cs_reset_user_model(player);
- setmodel[player] = "";
- }
- else {
- cs_set_user_model(player,model);
- setmodel[player] = model;
- }
- }
- return 1;
- }
- // ------------------------------------------------------------------------------------------
- // --CUSTOM MODEL LIST----------------------------------------------------------------------
- // ------------------------------------------------------------------------------------------
- public get_models(array[32][],len) {
- // get a list of custom models
- new dirpos, output[64], outlen, filledamt;
- // go through custom models
- while((dirpos = read_dir("models/player",dirpos,output,255,outlen)) != 0) {
- if(containi(output,".") == -1) { // if not a file (but a directory)
- // check if model is actually there
- new modelfile[64];
- format(modelfile,63,"models/player/%s/%s.mdl",output,output);
- // if it exists
- if(file_exists(modelfile)) {
- format(array[filledamt],len,"%s",output);
- filledamt += 1;
- }
- // if we are out of array space now
- if(filledamt > 32) {
- return filledamt;
- }
- }
- }
- return filledamt;
- }
- // ------------------------------------------------------------------------------------------
- // --RESET MODEL ON RESPAWN-----------------------------------------------------------------
- // ------------------------------------------------------------------------------------------
- public event_resethud(id) {
- if(!equal(setmodel[id],"")) {
- cs_set_user_model(id,setmodel[id]);
- }
- }
- // ------------------------------------------------------------------------------------------
- // --CONNECTION AND DISCONNECTION-----------------------------------------------------------
- // ------------------------------------------------------------------------------------------
- public client_connect(id) {
- page[id] = 1;
- setmodel[id] = "";
- }
- public client_disconnect(id) {
- page[id] = 1;
- setmodel[id] = "";
- }
- // ------------------------------------------------------------------------------------------
- // --PLUGIN PRECACHE------------------------------------------------------------------------
- // ------------------------------------------------------------------------------------------
- public plugin_precache() {
- // get custom models
- new models[32][33], num;
- num = get_models(models,32);
- // loop through them
- for(new i=0;i<num;i++) {
- new modelstring[64];
- format(modelstring,63,"models/player/%s/%s.mdl",models[i],models[i]);
- precache_model(modelstring);
- }
- }
- public currmodel(id) {
- new model[33];
- cs_get_user_model(id,model,32);
- client_print(id,print_chat,"* 你的服饰是 %s",model);
- return PLUGIN_HANDLED;
- }
- // ------------------------------------------------------------------------------------------
- // --PLUGIN ININITATION---------------------------------------------------------------------
- // ------------------------------------------------------------------------------------------
- public plugin_init() {
- register_plugin("CS服饰管理系统CN","0.11","Avalanche AND btvsohu");
- console_print(0,"* Loaded CS User Model Menuz 0.11 by Avalanche");
- register_clcmd("amx_csummz","menu1Display",ADMIN_BAN,"- 管理服饰菜单");
- 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);
- }
复制代码 |
|