Raised This Month: $ Target: $400
 0% 

Problem with compiling


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KyleD
Member
Join Date: Mar 2005
Location: Anchorage, AK
Old 04-18-2005 , 00:19   Problem with compiling
Reply With Quote #1

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; }
__________________
KyleD is offline
Send a message via MSN to KyleD
slurpycof
Senior Member
Join Date: Nov 2004
Old 04-18-2005 , 00:57  
Reply With Quote #2

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

You forgot the , after human. You will get plenty of errors after you do that.
slurpycof is offline
KyleD
Member
Join Date: Mar 2005
Location: Anchorage, AK
Old 04-18-2005 , 01:14  
Reply With Quote #3

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
__________________
KyleD is offline
Send a message via MSN to KyleD
{NM}Jason
AMX Mod X Beta Tester
Join Date: Mar 2004
Location: Texas
Old 04-18-2005 , 01:20  
Reply With Quote #4

i'm taking a look at it now BB in a sec ...
__________________
http://forums.alliedmods.net/showthr...396#post451396
Quote:
Originally Posted by BAILOPAN View Post
Shortly after posting that image, Jason crushed the truck into a ball with his hands, and tossed it over his shoulder.
{NM}Jason is offline
Send a message via ICQ to {NM}Jason Send a message via AIM to {NM}Jason Send a message via MSN to {NM}Jason Send a message via Yahoo to {NM}Jason
KyleD
Member
Join Date: Mar 2005
Location: Anchorage, AK
Old 04-18-2005 , 01:27  
Reply With Quote #5

Thanks.
__________________
KyleD is offline
Send a message via MSN to KyleD
{NM}Jason
AMX Mod X Beta Tester
Join Date: Mar 2004
Location: Texas
Old 04-18-2005 , 02:00  
Reply With Quote #6

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...
__________________
http://forums.alliedmods.net/showthr...396#post451396
Quote:
Originally Posted by BAILOPAN View Post
Shortly after posting that image, Jason crushed the truck into a ball with his hands, and tossed it over his shoulder.
{NM}Jason is offline
Send a message via ICQ to {NM}Jason Send a message via AIM to {NM}Jason Send a message via MSN to {NM}Jason Send a message via Yahoo to {NM}Jason
KyleD
Member
Join Date: Mar 2005
Location: Anchorage, AK
Old 04-18-2005 , 02:29  
Reply With Quote #7

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

I had to change the keys.
__________________
KyleD is offline
Send a message via MSN to KyleD
KyleD
Member
Join Date: Mar 2005
Location: Anchorage, AK
Old 04-18-2005 , 02:44  
Reply With Quote #8

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;  }
__________________
KyleD is offline
Send a message via MSN to KyleD
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 04-18-2005 , 03:02  
Reply With Quote #9

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) ?
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
slurpycof
Senior Member
Join Date: Nov 2004
Old 04-18-2005 , 06:42  
Reply With Quote #10

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.
slurpycof is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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