Raised This Month: $ Target: $400
 0% 

help with xp


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Belsebub
Senior Member
Join Date: Feb 2005
Location: Sweden
Old 04-18-2005 , 10:39   help with xp
Reply With Quote #1

i made this plugin of the xp tutorial but it doesn't seem to change the class because when i kill if i have any class it prints the

client_print(0,print_chat,"* [DEBUG] %i dont get any xp because he has no class",attacker)

and the /changeanimal command dont works either


my code:
Code:
 #include <amxmodx>  #include <amxmisc>  #include <engine>  #include <cstrike>  #include <fun>  //----------------------------------------------------------------------------------------------  #define NONE           0  #define DOG             1  #define CAT           2  #define HORSE         3  #define COW           4  new PlayerClass[33]  new PlayerXP[33]  new PlayerLevel[33]  new const classes[5][] = {     "None",     "Dog",     "Cat",     "Horse",     "Cow"  }  new msgtext  new const levels[10] = {     100,     200,     400,     800,     1600,     3200,     6400,     12800,     25600,     51200  }  //----------------------------------------------------------------------------------------------  public plugin_init()  {     register_plugin("Animal Mod", "1.0", "XunTric")     register_cvar("XP_per_kill", "20")     register_event("DeathMsg", "DeathMsg", "a")     register_event("ResetHUD", "ResetHud", "b")     msgtext = get_user_msgid("StatusText")     register_menucmd(register_menuid("menu_ChooseAnimal"),1023,"DoChooseAnimal")     register_clcmd("say /changeanimal","ChooseAnimal")     register_clcmd("say_team /changeanimal", "ChooseAnimal")  }  //----------------------------------------------------------------------------------------------  public ChooseAnimal(id)  {       new menu[] = "Animal Mod: Choose Animal^n^n1. Dog^n2. Cat^n3. Horse^n4. Cow"     new keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4           show_menu(id, keys, menu, -1, "menu_ChooseAnimal")     }  //--------------------------------------------------------------------------------------------  public DoChooseAnimal(id,key) {     if(key == 0) {             if(PlayerClass[id] == DOG) {                 client_print(id, print_chat, "[Animal Mod] You are already a Dog! Choose something else!")                 ChooseAnimal(id)                 return PLUGIN_CONTINUE             }             PlayerClass[id] = DOG             client_print(id, print_chat, "[Animal Mod] You are now a Dog!")         }     if(key == 1) {             if(PlayerClass[id] == CAT) {                 client_print(id, print_chat, "[Animal Mod] You are already a Cat! Choose something else!")                 ChooseAnimal(id)                 return PLUGIN_CONTINUE             }             PlayerClass[id] = CAT             client_print(id, print_chat, "[Animal Mod] You are now a Cat!")         }     if(key == 2) {             if(PlayerClass[id] == HORSE) {                 client_print(id, print_chat, "[Animal Mod] You are already a Horse! Choose something else!")                 ChooseAnimal(id)                 return PLUGIN_CONTINUE             }             PlayerClass[id] = HORSE             client_print(id, print_chat, "[Animal Mod] You are now a Horse!")         }     if(key == 3) {             if(PlayerClass[id] == COW) {                 client_print(id, print_chat, "[Animal Mod] You are already a Cow! Choose something else!")                 ChooseAnimal(id)                 return PLUGIN_CONTINUE             }             PlayerClass[id] = COW             client_print(id, print_chat, "[Animal Mod] You are now a Cow!")         }     ShowHUD(id)     return PLUGIN_HANDLED  }  //----------------------------------------------------------------------------------------------  public ResetHUD(id)  {     if(PlayerClass[id] == NONE) {         ChooseAnimal(id)         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED }  //----------------------------------------------------------------------------------------------  public DeathMsg()  {     new attacker = read_data(1)     new victim = read_data(2)     client_print(0,print_chat,"* [DEBUG] %i killed %i",attacker,victim)     if(PlayerClass[attacker] == NONE) {         client_print(0,print_chat,"* [DEBUG] %i dont get any xp because he has no class",attacker)         return PLUGIN_CONTINUE     }     if(!is_user_connected(attacker) || attacker == victim) {         return PLUGIN_CONTINUE     }     PlayerXP[attacker] += get_cvar_num("XP_per_kill")     client_print(0,print_chat,"* [DEBUG] %i receives %i XP, now has %i",attacker, get_cvar_num("XP_per_kill"), PlayerXP[attacker])     if(PlayerXP[attacker] >= levels[PlayerLevel[attacker]]) {         ++PlayerLevel[attacker]         client_print(attacker, print_chat, "[Animal Mod] Congratulations! You are now level %i!", PlayerLevel[attacker])         ShowHUD(attacker)     }     ShowHUD(attacker)     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public ShowHUD(id)  {     new HUD[51]     format(HUD, 50, "[%s]Level: %i XP: %i ", classes[PlayerClass[id]], PlayerLevel[id], PlayerXP[id])     message_begin(MSG_ONE, msgtext, {0,0,0}, id)     write_byte(0)     write_string(HUD)     message_end()     return  }  //----------------------------------------------------------------------------------------------  public client_connect(id)  {     PlayerClass[id] = NONE     PlayerXP[id] = 0     PlayerLevel[id] = 0  }  //----------------------------------------------------------------------------------------------  public client_putinserver(id)  {     set_task(1.0, "ChooseAnimal", id)  }
Belsebub is offline
 


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 09:59.


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