AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with compiling (https://forums.alliedmods.net/showthread.php?t=12558)

KyleD 04-18-2005 00:19

Problem with compiling
 
I try to compile it but it just says "Read the errors above. Your plugin failed to compile. Make sure it is has the correct #includes."

But THERE ARE NO ERRORS?!

Here is code.


Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #define class_default 0 #define class_human 1 #define class_covenant 2 #define MAXCLASSES 3 #define NUM_OF_LEVELS 5 new g_playerclass[33] new g_playerxp[33] new g_playerlevel[33] new const CLASSES[MAXCLASSES][] = {     "Default",     "Human"     "Covenant" } new const LEVELS[NUM_OF_LEVELS] = {     100, // Level 1     200, // Level 2     400, // Level 3     800, // Level 4     1600, // Level 5 } new msgtext public plugin_init() {     register_plugin("HaloMod","1.0","KyleD")     register_cvar("sv_halomod","1")     register_cvar("xp_for_kill","50")     register_event("DeathMsg","event_deathmsg","a")     register_event("ResetHUD", "ResetHud", "b")     register_menucmd(register_menuid("menu_ChooseClass"),1023,"do_chooseclass");     msgtext = get_user_msgid("StatusText")     register_clcmd("say /changeclass","changeclass")     register_clcmd("say_team /changeclass","changeclass") } public changeclass(id) {     new menu[256]     format(menu,255,"HaloMod: Choose Class^n^n1. Human^n2. Covenant^n^n3. Exit")     show_menu(id,(1<<0)|(1<<1),menu)     return PLUGIN_CONTINUE; } public do_chooseclass(id,key) {     switch(key) {         case 0: {             if(g_playerclass[id] == class_human) {                 client_print(id,print_chat,"[HaloMod] You're already a Human. Select a different class.")                 ChooseClass(id)                 return PLUGIN_HANDLED;             }             g_playerclass[id] = class_human {                 client_print(id,print_chat,"[HaloMod] You are now a Human.")             }             case 1: {                 if(g_playerclass[id] == class_covenant) {                     client_print(id,print_chat,"[HaloMod] You're already a Covenant. Select a different class.")                     ChooseClass(id)                     return PLUGIN_HANDLED;                 }                 ShowHud(id)                 return PLUGIN_HANDLED;             }         }     } } public ResetHud(id) {     if(get_cvar_num("sv_halomod") == 0) {         client_print(id,print_chat,"[HaloMod] Is currently off")         return PLUGIN_HANDLED;     }     if(g_playerclass[id] == class_default) {         ChooseClass(id)         return PLUGIN_HANDLED;     }     return PLUGIN_HANDLED; } public event_deathmsg() {     if(get_cvar_num("sv_halomod") == 0) {         return PLUGIN_HANDLED;     }     new attacker = read_data(1)     if(g_playerclass[attacker] == class_default) {         return PLUGIN_HANDLED;     }     if(g_playerlevel[attacker] == 5) {         return PLUGIN_HANDLED;     }     g_playerxp[attacker] += get_cvar_num("xp_for_kill")     if (g_playerxp[attacker] >= LEVELS[g_playerlevel[attacker]]) {         g_playerlevel[attacker] += 1         client_print(attacker,print_chat,"[HaloMod] Congratulations! You are now level %i!",g_playerlevel[attacker])         ShowHUD(attacker)     }     ShowHUD(attacker)     return PLUGIN_CONTINUE; } public ShowHUD(id) {     new HUD[61]     format(HUD,60,"[%s]Level: %i XP: %i",CLASSES[g_playerclass[id]],g_playerlevel[id],g_playerxp[id])     message_begin(MSG_ONE,msgtext,{0,0,0},id)     write_byte(0)     write_string(HUD)     message_end()     return PLUGIN_HANDLED; }

slurpycof 04-18-2005 00:57

Code:
new const CLASSES[MAXCLASSES][] = {     "Default",     "Human",     "Covenant" }

You forgot the , after human. You will get plenty of errors after you do that.

KyleD 04-18-2005 01:14

Well now errors come up.

Here is updated code.

Code:
// Credits  john-SPARTAN-117 #include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #define class_default 0 #define class_human 1 #define class_covenant 2 #define MAXCLASSES 3 #define NUM_OF_LEVELS 5 new g_playerclass[33] new g_playerxp[33] new g_playerlevel[33] new const CLASSES[MAXCLASSES][] = {     "Default",     "Human",     "Covenant" } new const LEVELS[NUM_OF_LEVELS] = {     100, // Level 1     200, // Level 2     400, // Level 3     800, // Level 4     1600, // Level 5 } new msgtext public plugin_init() {     register_plugin("HaloMod","1.0","KyleD")     register_cvar("sv_halomod","1")     register_cvar("xp_for_kill","50")     register_event("DeathMsg","event_deathmsg","a")     register_event("ResetHUD", "ResetHud", "b")     register_menucmd(register_menuid("menu_ChooseClass"),1023,"do_chooseclass");     msgtext = get_user_msgid("StatusText")     register_clcmd("say /changeclass","changeclass")     register_clcmd("say_team /changeclass","changeclass") } public changeclass(id) {     new menu[256]     format(menu,255,"HaloMod: Choose Class^n^n1. Human^n2. Covenant^n^n3. Exit")     show_menu(id,(1<<0)|(1<<1),menu)     return PLUGIN_CONTINUE; } public do_chooseclass(id,key) {     switch(key) {         case 0: {             if(g_playerclass[id] == class_human) {                 client_print(id,print_chat,"[HaloMod] You're already a Human. Select a different class.")                 changeclass(id)                 return PLUGIN_HANDLED;             }             if (g_playerclass[id] = class_human) {                 client_print(id,print_chat,"[HaloMod] You are now Human.")             }         case 1: {             if(g_playerclass[id] == class_covenant) {                 client_print(id,print_chat,"[HaloMod] You're already a Covenant. Select a different class.")                 changeclass(id)                 return PLUGIN_HANDLED;             }                 if(g_playerclass[id] = class_covenant) {                 client_print(id,print_chat,"[HaloMod] You are now Covenant.                 }                 ShowHud(id)                 return PLUGIN_HANDLED;             }         }     } } public ResetHud(id) {     if(get_cvar_num("sv_halomod") == 0) {         client_print(id,print_chat,"[HaloMod] Is currently off")         return PLUGIN_HANDLED;     }     if(g_playerclass[id] == class_default) {         changeclass(id)         return PLUGIN_HANDLED;     }     return PLUGIN_HANDLED; } public event_deathmsg() {     if(get_cvar_num("sv_halomod") == 0) {         return PLUGIN_HANDLED;     }     new attacker = read_data(1)     if(g_playerclass[attacker] == class_default) {         return PLUGIN_HANDLED;     }     if(g_playerlevel[attacker] == 5) {         return PLUGIN_HANDLED;     }     g_playerxp[attacker] += get_cvar_num("xp_for_kill")     if (g_playerxp[attacker] >= LEVELS[g_playerlevel[attacker]]) {         g_playerlevel[attacker] += 1         client_print(attacker,print_chat,"[HaloMod] Congratulations! You are now level %i!",g_playerlevel[attacker])         ShowHUD(attacker)     }     ShowHUD(attacker)     return PLUGIN_CONTINUE; } public ShowHUD(id) {     new HUD[61]     format(HUD,60,"[%s]Level: %i XP: %i",CLASSES[g_playerclass[id]],g_playerlevel[id],g_playerxp[id])     message_begin(MSG_ONE,msgtext,{0,0,0},id)     write_byte(0)     write_string(HUD)     message_end()     return PLUGIN_HANDLED; }

4 errors..
/home/groups/amxmodx/tmp/phpwfvD7v.sma(63) : warning 211: possibly unintended assignment
/home/groups/amxmodx/tmp/phpwfvD7v.sma(66) : warning 217: loose indentation
/home/groups/amxmodx/tmp/phpwfvD7v.sma(66) : error 014: invalid statement; not in switch
/home/groups/amxmodx/tmp/phpwfvD7v.sma(66) : warning 215: expression has no effect
/home/groups/amxmodx/tmp/phpwfvD7v.sma(66) : error 001: expected token: ";", but found ":"
/home/groups/amxmodx/tmp/phpwfvD7v.sma(66) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp/phpwfvD7v.sma(66) : fatal error 107: too many error messages on one line

{NM}Jason 04-18-2005 01:20

i'm taking a look at it now BB in a sec ...

KyleD 04-18-2005 01:27

Thanks.

{NM}Jason 04-18-2005 02:00

humm its odd .. i can't figure out whats going on it compiles to an extent ...but the axmm is no good :-/ i'll look at it tomarrow . need sleep...

KyleD 04-18-2005 02:29

Ah HA! It has no errors now. I shall go test it.

I had to change the keys.

KyleD 04-18-2005 02:44

Ok now I have another problem..it wont let me select "Covenant". When I do choose it, it exits the menu.

Current code..

Code:
#include <amxmodx>  #include <amxmisc>  #include <cstrike>  #include <fun>  #define class_default 0  #define class_human 1  #define class_covenant 2  #define MAXCLASSES 3  #define NUM_OF_LEVELS 5  new g_playerclass[33]  new g_playerxp[33]  new g_playerlevel[33]  new const CLASSES[MAXCLASSES][] = {     "Default",     "Human",     "Covenant"  }  new const LEVELS[5] = {     100, // Level 1     200, // Level 2     400, // Level 3     800, // Level 4     1600 // Level 5  }  new msgtext  public plugin_init() {     register_plugin("HaloMod","1.0","KyleD")     register_cvar("sv_halomod","1")     register_cvar("xp_for_kill","50")     register_event("DeathMsg","event_deathmsg","a")     register_event("ResetHUD", "ResetHud", "b")     register_menucmd(register_menuid("menu_ChooseClass"),1023,"do_chooseclass");     msgtext = get_user_msgid("StatusText")     register_clcmd("say /changeclass","changeclass")     register_clcmd("say_team /changeclass","changeclass")  }  public chooseclass(id)  {     new menu[256]     new keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_0;     format(menu,255,"HaloMod: Choose Class^n^n1. Human^n2. Covenant^n^n0. Exit")     show_menu(id,keys,menu,-1,"menu_ChooseClass")     return PLUGIN_CONTINUE;  }  public do_chooseclass(id,key)  {     if(key == 0) {         if(g_playerclass[id] == class_human) {             client_print(id,print_chat,"[HaloMod] You're already a Human. Select a different class.")             changeclass(id)             return PLUGIN_HANDLED;             } else {             (g_playerclass[id] = class_human)             client_print(id,print_chat,"[HaloMod] You are now Human.")         }         if (key == 1) {             if(g_playerclass[id] == class_covenant) {                 client_print(id,print_chat,"[HaloMod] You're already a Covenant. Select a different class.")                 changeclass(id)                 return PLUGIN_HANDLED;                 } else {                 (g_playerclass[id] = class_covenant)                 client_print(id,print_chat,"[HaloMod] You are now Covenant.")             }             ShowHUD(id)             return PLUGIN_HANDLED;         }     }     return PLUGIN_HANDLED;  }  public ResetHud(id)  {     if(get_cvar_num("sv_halomod") == 0) {         client_print(id,print_chat,"[HaloMod] Is currently off")         return PLUGIN_HANDLED;     }     if(g_playerclass[id] == class_default) {         changeclass(id)         return PLUGIN_HANDLED;     }     return PLUGIN_HANDLED;  }  public event_deathmsg()  {     if(get_cvar_num("sv_halomod") == 0) {         return PLUGIN_HANDLED;     }     new attacker = read_data(1)     if(g_playerclass[attacker] == class_default) {         return PLUGIN_HANDLED;     }     if(g_playerlevel[attacker] == 5) {         return PLUGIN_HANDLED;     }     g_playerxp[attacker] += get_cvar_num("xp_for_kill")     if (g_playerxp[attacker] >= LEVELS[g_playerlevel[attacker]]) {         g_playerlevel[attacker] += 1         client_print(attacker,print_chat,"[HaloMod] Congratulations! You are now level %i!",g_playerlevel[attacker])         ShowHUD(attacker)     }     ShowHUD(attacker)     return PLUGIN_CONTINUE;  }  public ShowHUD(id)  {     new HUD[61]     format(HUD,60,"[%s]Level: %i XP: %i",CLASSES[g_playerclass[id]],g_playerlevel[id],g_playerxp[id])     message_begin(MSG_ONE,msgtext,{0,0,0},id)     write_byte(0)     write_string(HUD)     message_end()     return PLUGIN_HANDLED;  }

teame06 04-18-2005 03:02

i try to compile your last version. i come up with changeclass undefine..

changeclass(id) points to no were. From what i see in your code isn't it suppose to be chooseclass(id) ?

slurpycof 04-18-2005 06:42

You had couple of } in the wrong place

Code:
  public do_chooseclass(id,key)  {     if(key == 0) {         if(g_playerclass[id] == class_human) {             client_print(id,print_chat,"[HaloMod] You're already a Human. Select a different class.")             chooseclass(id)             return PLUGIN_HANDLED;             } else {             (g_playerclass[id] = class_human)             client_print(id,print_chat,"[HaloMod] You are now Human.")         }     }     if (key == 1) {         if(g_playerclass[id] == class_covenant) {             client_print(id,print_chat,"[HaloMod] You're already a Covenant. Select a different class.")             chooseclass(id)             return PLUGIN_HANDLED;             } else {             (g_playerclass[id] = class_covenant)             client_print(id,print_chat,"[HaloMod] You are now Covenant.")         }     }     ShowHUD(id)     return PLUGIN_HANDLED;      }

Also, with the plugin handled, whay happens when a new person joins? They will not get a menu to choose like the first one does.


All times are GMT -4. The time now is 10:03.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.