First of all, the number of arguments didn't match because you didn't set the name to a variable. But after that, i don't see anywhere you would use it in that function. That's why i commented that part out.
Actually i just removed all errors, But you have to look at the tfc_set_model, because it has 3 arguments (index,model,skin). I've filled in skin as "", so that might be wrong ingame.
Code:
#include <amxmodx>
#include <amxmisc>
#include <tfcx>
#define MENUTIME 30 // how long menus stay up
// Key Defines (for ease of use and readability)
#define KEY1 (1<<0)
#define KEY2 (1<<1)
#define KEY3 (1<<2)
#define KEY4 (1<<3)
#define KEY5 (1<<4)
#define KEY6 (1<<5)
#define KEY7 (1<<6)
#define KEY8 (1<<7)
#define KEY9 (1<<8)
#define KEY0 (1<<9)
// Temporary Menu Variables
new page[33] = { 1, ...}, choices[33][9][33], target[33][33];
// A user's assigned model
new setmodel[33][33];
// ------------------------------------------------------------------------------------------
// --MENU DISPLAYS--------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
// Here are all of our functions for displaying the menus themselves
// --MENU 1 DISPLAY--------------------------------------------------------------------------
public menu1Display(id) {
// choose who to perform actions on
new menubody[256];
format(menubody,255,"\yChange Model For:^n^n");
// add(menubody,255,"\w1. Terrorists^n");
// add(menubody,255,"\w2. Counter-Terrorists^n");
add(menubody,255,"\w3. Specific Player^n");
add(menubody,255,"\w4. All Players^n");
add(menubody,255,"\w5. Yourself^n");
add(menubody,255,"\w^n0. Exit");
show_menu(id,KEY1|KEY2|KEY3|KEY4|KEY5|KEY0,menubody,MENUTIME,"menu1");
return PLUGIN_HANDLED;
}
// --Menu 7 DISPLAY-----Public Model Menu -------------------------------------------------------
public menu7Display(id){
new menubody[256];
format(menubody,255,"TFM Custom Model's^n^n");
add(menubody,255,"\w1. Change Model^n");
add(menubody,255,"\w2. Reset Model^n");
add(menubody,255,"\w^n0. Exit");
show_menu(id,KEY1|KEY2|KEY0,menubody,MENUTIME,"menu7");
return PLUGIN_HANDLED;
}
// --MENU 2 DISPLAY-----Specific PLAYER----------------------------------------------------------
public menu2Display(id) {
// our list of players
// clear choices
for(new n=0;n<9;n++) {
choices[id][n] = "";
}
new menubody[256];
format(menubody,255,"\yChange Model For (Specific Player, Page %d):^n^n",page[id]);
// get players
new players[32], num;
get_players(players,num);
// if too many for one page
new loopamt = num-((page[id]-1)*8);
if(num-((page[id]-1)*8) > 8) {
loopamt = 8;
}
new offset = (page[id] * 8) - 8; // starting offset
// loop through players
for(new i=offset;i<loopamt+offset;i++) {
// get name
new username[33];
get_user_name(players[i],username,32);
// get user's team
new team[5];
if(get_user_team(players[i]) == 1) { team = "T"; }
else if(get_user_team(players[i]) == 2) { team = "CT"; }
else { team = "SPEC"; }
// our string to add
new string[256];
format(string,255,"\w%d. %s (%s%s)^n",i+1-offset,username,team,is_user_admin(players[i]) ? ",@" : "");
// get string value of player's id
new idstr[33];
num_to_str(players[i],idstr,32);
// save player's id for easy access
choices[id][i-offset] = idstr;
// add it to menu
add(menubody,255,string);
}
// if another page
if(num-((page[id]-1)*8) > 8) {
choices[id][8] = "Next";
add(menubody,255,"\w^n9. Next");
}
add(menubody,255,"\w^n0. Back");
show_menu(id,KEY1|KEY2|KEY3|KEY4|KEY5|KEY6|KEY7|KEY8|KEY9|KEY0,menubody,MENUTIME,"menu2");
return PLUGIN_HANDLED;
}
// --MENU 3 DISPLAY-----all players------------------------------------------------------
public menu3Display(id) {
// choose what model category to browse in
new menubody[256];
format(menubody,255,"\yChange Model To (Select A Category):^n^n");
// add(menubody,255,"\w1. T Models^n");
// add(menubody,255,"\w2. CT Models^n");
add(menubody,255,"\w3. Custom Models^n");
add(menubody,255,"\w4. Reset Models^n");
add(menubody,255,"\w^n0. Back");
show_menu(id,KEY1|KEY2|KEY3|KEY4|KEY0,menubody,MENUTIME,"menu3");
return PLUGIN_HANDLED;
}
// --MENU 4 DISPLAY----CT AND T MODELS-------------------------------------------------------
/*public menu4Display(id) {
// terrorist model list
new menubody[256];
format(menubody,255,"\yChange Model To (T Models):^n^n");
add(menubody,255,"\w1. Phoenix Connexion^n");
add(menubody,255,"\w2. 1337 Krew^n");
add(menubody,255,"\w3. Arctic Avengers^n");
add(menubody,255,"\w4. Guerilla Warfare^n");
add(menubody,255,"\w^n0. Back");
show_menu(id,KEY1|KEY2|KEY3|KEY4|KEY0,menubody,MENUTIME,"menu4");
return PLUGIN_HANDLED;
}
// --MENU 5 DISPLAY--------------------------------------------------------------------------
public menu5Display(id) {
// counter-terrorist model list
new menubody[256];
format(menubody,255,"\yChange Model To (CT Models):^n^n");
add(menubody,255,"\w1. US Seal Team 6^n");
add(menubody,255,"\w2. German GSG-9^n");
add(menubody,255,"\w3. UK Special Air Service^n");
add(menubody,255,"\w4. French GIGN^n");
add(menubody,255,"\w5. VIP^n");
add(menubody,255,"\w^n0. Back");
show_menu(id,KEY1|KEY2|KEY3|KEY4|KEY5|KEY0,menubody,MENUTIME,"menu5");
return PLUGIN_HANDLED;
}
*/
// --MENU 6 DISPLAY CUSTOM MODELS-------------------------------------------------------------
public menu6Display(id) {
// our list of custom models
// clear choices
for(new i=0;i<9;i++) {
choices[id][i] = "";
}
new menubody[256];
format(menubody,255,"\yChange Model To (Custom Models, Page %d):^n^n",page[id]);
// get custom models
new models[32][33], num;
num = get_models(models,32);
// if too many for one page
new loopamt = num-((page[id]-1)*8);
if(num-((page[id]-1)*8) > 8) {
loopamt = 8;
}
new offset = (page[id] * 8) - 8; // starting offset
// loop through players
for(new i=offset;i<loopamt+offset;i++) {
// our string to add
new string[256];
format(string,255,"\w%d. %s^n",i+1-offset,models[i]);
// save model's name for easy access
choices[id][i-offset] = models[i];
// add it to menu
add(menubody,255,string);
}
// if another page
if(num-((page[id]-1)*8) > 8) {
choices[id][8] = "Next";
add(menubody,255,"\w^n9. Next");
}
add(menubody,255,"\w^n0. Back");
show_menu(id,KEY1|KEY2|KEY3|KEY4|KEY5|KEY6|KEY7|KEY8|KEY9|KEY0,menubody,MENUTIME,"menu6");
return PLUGIN_HANDLED;
}
// --MENU 8 DISPLAY CUSTOM MODELS (USER)-------------------------------------------------------------
public menu8Display(id) {
// our list of custom models
// clear choices
for(new i=0;i<9;i++) {
choices[id][i] = "";
}
new menubody[256];
format(menubody,255,"\yChange Model To (Custom Models, Page %d):^n^n",page[id]);
// get custom models
new models[32][33], num;
num = get_models(models,32);
// if too many for one page
new loopamt = num-((page[id]-1)*8);
if(num-((page[id]-1)*8) > 8) {
loopamt = 8;
}
new offset = (page[id] * 8) - 8; // starting offset
// loop through players
for(new i=offset;i<loopamt+offset;i++) {
// our string to add
new string[256];
format(string,255,"\w%d. %s^n",i+1-offset,models[i]);
// save model's name for easy access
choices[id][i-offset] = models[i];
// add it to menu
add(menubody,255,string);
}
// if another page
if(num-((page[id]-1)*8) > 8) {
choices[id][8] = "Next";
add(menubody,255,"\w^n9. Next");
}
add(menubody,255,"\w^n0. Back");
show_menu(id,KEY1|KEY2|KEY3|KEY4|KEY5|KEY6|KEY7|KEY8|KEY9|KEY0,menubody,MENUTIME,"menu6");
return PLUGIN_HANDLED;
}
// ------------------------------------------------------------------------------------------
// --MENU ACTIONS---------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
// This handles the actions of all of our menus
//--Menu 7 Action --------------------------------------------------------------------------
public menu7Action(id,key){
// 1 Change Model
if(key == 0){
new idstr[33];
num_to_str(id,idstr,32);
target[id] = idstr;
menu8Display(id);
return 1;
}
// 2 Reset Model
if(key == 1){
modelActionb(id,target[id],".reset");
}
// 0 Being Exit
// NO CODE TIME OUT TO BLANK SCREEN
return 1;
}
// --MENU 1 ACTION---------------------------------------------------------------------------
public menu1Action(id,key) {
// 1. Terrorist
if(key == 0) {
target[id] = "@T";
menu3Display(id);
return 1;
}
// 2. Counter-Terrorist
if(key == 1) {
target[id] = "@CT";
menu3Display(id);
return 1;
}
// 3. Specific Player
if(key == 2) {
menu2Display(id);
return 1;
}
// 4. All Players
if(key == 3) {
target[id] = "*";
menu3Display(id);
return 1;
}
// 5. Yourself
if(key == 4) {
new idstr[33];
num_to_str(id,idstr,32);
target[id] = idstr;
menu3Display(id);
return 1;
}
// 0. Exit
// Nothing happens and the menu closes
return 1;
}
// --MENU 2 ACTION---------------------------------------------------------------------------
public menu2Action(id,key) {
// 0. Back
if(key == 9 && page[id] == 1) {
menu1Display(id);
return 1;
}
else if(key == 9 && page[id] > 1) {
page[id] -=1 ;
menu2Display(id);
return 1;
}
// if choice is blank
if(equal(choices[id][key],"")) {
menu2Display(id); // reset menu
return 1;
}
// 1-8. Varies
if(key < 8) {
target[id] = choices[id][key];
menu3Display(id);
return 1;
}
// 9. Next
if(key == 8 && equal(choices[id][key],"Next")) {
page[id] += 1;
menu2Display(id);
return 1;
}
return 1;
}
// --MENU 3 ACTION---------------------------------------------------------------------------
public menu3Action(id,key) {
// 1. T Models
/* if(key == 0) {
menu4Display(id);
return 1;
}
// 2. CT Models
if(key == 1) {
menu5Display(id);
return 1;
}
*/
// 3. Custom Models
if(key == 2) {
menu6Display(id);
return 1;
}
// 4. Reset Models
if(key == 3) {
modelAction(id,target[id],".reset");
return 1;
}
// 0. Back
if(key == 9) {
menu1Display(id);
return 1;
}
return 1;
}
// --MENU 4 ACTION---------------------------------------------------------------------------
/*public menu4Action(id,key) {
// 1. Phoenix Connexion
if(key == 0) {
modelAction(id,target[id],"terror");
return 1;
}
// 2. 1337 Krew
if(key == 1) {
modelAction(id,target[id],"leet");
return 1;
}
// 3. Arctic Avengers
if(key == 2) {
modelAction(id,target[id],"arctic");
return 1;
}
// 4. Guerilla Warfare
if(key == 3) {
modelAction(id,target[id],"guerilla");
return 1;
}
// 0. Back
if(key == 9) {
menu3Display(id);
return 1;
}
return 1;
}
// --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;
}
// --MENU 8 ACTION---------------------------------------------------------------------------
public menu8Action(id,key) {
// 0. Back
if(key == 9 && page[id] == 1) {
menu7Display(id);
return 1;
}
else if(key == 9 && page[id] > 1) {
page[id] -=1 ;
menu8Display(id);
return 1;
}
// if choice is blank
if(equal(choices[id][key],"")) {
menu6Display(id); // reset menu
return 1;
}
// 1-8. Varies
if(key < 8) {
modelActionb(id,target[id],choices[id][key]);
return 1;
}
// 9. Next
if(key == 8 && equal(choices[id][key],"Next")) {
page[id] += 1;
menu8Display(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,"ADMIN: reset model for %s%s",isdigit(target[0]) ? "#" : "",target);
case 2: client_print(0,print_chat,"ADMIN %s: reset model for %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,"ADMIN: set model %s on %s%s",model,isdigit(target[0]) ? "#" : "",target);
case 2: client_print(0,print_chat,"ADMIN %s: set model %s on %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";
// }
/* if(isdigit(target[0])) { // Specific Player or Yourself
flags = "f"; // name
get_user_name(str_to_num(target),32);
}
*/
// Otherwise this leaves us with nothing, which is All Players
// get targets
new players[32], num;
get_players(players,num,flags);
// loop through
for(new i=0;i<num;i++) {
new player = players[i]; // our player
if(equal(model,".reset")) { // if reset
tfc_setmodel(player,"",""); //no model or skin !?!
setmodel[player] = "";
}
else {
tfc_setmodel(player,model,""); //don't know what to fill in, at the skin argument.
setmodel[player] = model;
}
}
return 1;
}
// ------------------------------------------------------------------------------------------
// --SET MODEL ACTION B---------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
public modelActionb(id,target[33],model[33]) {
new username[33];
get_user_name(id,username,32);
// if clearing models
if(equal(model,".reset")) {
// log the command
// show activity
client_print(0,print_chat,"%s: reset there model",username);
} else { // if setting models
// log the command
// show activity
client_print(0,print_chat,"%s: set there model to %s",username,model);
}
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";
// }
/* if(isdigit(target[0])) { // Specific Player or Yourself
flags = "f"; // name
get_user_name(str_to_num(target),32);
}
*/
// Otherwise this leaves us with nothing, which is All Players
// get targets
new players[32], num;
get_players(players,num,flags);
// loop through
for(new i=0;i<num;i++) {
new player = players[i]; // our player
if(equal(model,".reset")) { // if reset
tfc_setmodel(player,"","");
setmodel[player] = "";
}
else {
tfc_setmodel(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],"")) {
tfc_setmodel(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) {
client_print(id,print_chat,"Out in Next Release");
return PLUGIN_HANDLED;
}
// ------------------------------------------------------------------------------------------
// --PLUGIN ININITATION---------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
public plugin_init() {
register_plugin("TFM Model Menu","0.1","Watch Your Back");
console_print(0,"* Loaded TFM Model Menu 0.1 by Watch Your Back *");
register_clcmd("amx_tfmmodel","consoleCommand",ADMIN_BAN,"- brings up menu for custom user models");
register_clcmd("say /setmodel","menu7Display");
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");
new menu7ID = register_menuid("menu7");
new menu8ID = register_menuid("menu8");
// 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");
register_menucmd(menu7ID,1023, "menu7Action");
register_menucmd(menu8ID,1023, "menu8Action");
}
// hook amx_csummz to check permissions
public consoleCommand(id,level,cid) {
if(!cmd_access(id,level,cid,1)) {
return PLUGIN_HANDLED;
}
return menu1Display(id);
}