Raised This Month: $51 Target: $400
 12% 

Animal Xp with changing model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NiGHTFiRE
Senior Member
Join Date: Dec 2004
Location: Sweden
Old 04-18-2005 , 14:26   Animal Xp with changing model
Reply With Quote #1

I'm trying to do Xuntrics animal xp plugin. I'm trying to do so if you choose the the animal dog you get to be a model that looks like a dog. here is my code:
Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #define CLASS_NOTHING 0 #define CLASS_DOG 1 #define CLASS_CAT 2 #define CLASS_HORSE 3 #define CLASS_COW 4 #define MAXCLASSES 5 new PlayerClass[33] new PlayerXP[33] new PlayerLevel[33] new const CLASSES[MAXCLASSES][] = {     "None",     "Dog",     "Cat",     "Horse",     "Cow" } new msgtext new const LEVELS[6] = {     100,     200,     400,     800,     1600,     3200 } public plugin_precache() {    PlayerClass[id] = CLASS_DOG;    precache_model("models/animals/dog.mdl"); } public plugin_init() {     register_plugin("Animal Mod", "1.0", "XunTric")         register_cvar("sv_animalmod", "1")         register_event("DeathMsg", "DeathMsg", "a")         register_cvar("XP_per_kill", "20")         register_menucmd(register_menuid("menu_ChooseAnimal"),1023,"DoChooseAnimal");         register_event("ResetHUD", "ResetHud", "b")         msgtext = get_user_msgid("StatusText")     register_clcmd("say /changeanimal", "ChangeAnimal")     register_clcmd("say_team /changeanimal", "ChangeAnimal") } stock ChooseAnimal(id) {     new menu[192]     new keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_0;         format(menu, 191, "Animal Mod: Choose Animal^n^n1. Dog^n2. Cat^n3. Horse^n4. Cow^n^n0. Exit")     show_menu(id, keys, menu, -1, "menu_ChooseAnimal")        return PLUGIN_CONTINUE } public DoChooseAnimal(id, key) {     if(key == 0) {                  if(PlayerClass[id] == CLASS_DOG) {                         client_print(id, print_chat, "[Animal Mod] You are allready a Dog! Choose something else!")               ChooseAnimal(id)                          return PLUGIN_HANDLED          }                 PlayerClass[id] = CLASS_DOG                   client_print(id, print_chat, "[Animal Mod] You are now a Dog!")               }                      if(key == 1) {                    if(PlayerClass[id] == CLASS_CAT) {                             client_print(id, print_chat, "[Animal Mod] You are allready a Cat! Choose something else!")               ChooseAnimal(id)               return PLUGIN_HANDLED          }                              PlayerClass[id] = CLASS_CAT          client_print(id, print_chat, "[Animal Mod] You are now a Cat!")     }         if(key == 2) {                    if(PlayerClass[id] == CLASS_HORSE) {                             client_print(id, print_chat, "[Animal Mod] You are allready a Horse! Choose something else!")               ChooseAnimal(id)               return PLUGIN_HANDLED          }                              PlayerClass[id] = CLASS_HORSE          client_print(id, print_chat, "[Animal Mod] You are now a Horse!")     }        if(key == 3) {                    if(PlayerClass[id] == CLASS_COW) {                             client_print(id, print_chat, "[Animal Mod] You are allready a Cow! Choose something else!")               ChooseAnimal(id)               return PLUGIN_HANDLED          }                              PlayerClass[id] = CLASS_COW          client_print(id, print_chat, "[Animal Mod] You are now a Cow!")     }           ShowHUD(id)         return PLUGIN_HANDLED } public ResetHUD(id) {     if(PlayerClass[id] == CLASS_NOTHING) {              ChooseAnimal(id)          return PLUGIN_HANDLED     }         return PLUGIN_HANDLED } public DeathMsg() {     if(get_cvar_num("sv_animalmod") == 0) {          return PLUGIN_HANDLED     }         new attacker = read_data(1)         if(PlayerClass[attacker] == CLASS_NOTHING) {          return PLUGIN_HANDLED     }         if(PlayerLevel[attacker] == 6) {          return PLUGIN_HANDLED     }                 PlayerXP[attacker] += get_cvar_num("XP_per_kill")         if(PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]]) {                PlayerLevel[attacker] += 1                    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 }

I get this error: Error 017: Undefined symbol "id"
NiGHTFiRE is offline
Send a message via AIM to NiGHTFiRE Send a message via MSN to NiGHTFiRE
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 04-18-2005 , 15:12  
Reply With Quote #2

This might work...
Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #define CLASS_NOTHING 0 #define CLASS_DOG 1 #define CLASS_CAT 2 #define CLASS_HORSE 3 #define CLASS_COW 4 #define MAXCLASSES 5 new PlayerClass[33] new PlayerXP[33] new PlayerLevel[33] new const CLASSES[MAXCLASSES][] = {     "None",     "Dog",     "Cat",     "Horse",     "Cow" } new msgtext new const LEVELS[6] = {     100,     200,     400,     800,     1600,     3200 } public plugin_precache() {    precache_model("models/animals/dog.mdl") } public plugin_init() {     register_plugin("Animal Mod", "1.0", "XunTric")           register_cvar("sv_animalmod", "1")           register_event("DeathMsg", "DeathMsg", "a")           register_cvar("XP_per_kill", "20")           register_menucmd(register_menuid("menu_ChooseAnimal"),1023,"DoChooseAnimal");           register_event("ResetHUD", "ResetHud", "b")           msgtext = get_user_msgid("StatusText")     register_clcmd("say /changeanimal", "ChangeAnimal")     register_clcmd("say_team /changeanimal", "ChangeAnimal") } stock ChooseAnimal(id) {     new menu[192]     new keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_0;           format(menu, 191, "Animal Mod: Choose Animal^n^n1. Dog^n2. Cat^n3. Horse^n4. Cow^n^n0. Exit")     show_menu(id, keys, menu, -1, "menu_ChooseAnimal")          return PLUGIN_CONTINUE } public DoChooseAnimal(id, key) {     if(key == 0) {                  if(PlayerClass[id] == CLASS_DOG) {                         client_print(id, print_chat, "[Animal Mod] You are allready a Dog! Choose something else!")               ChooseAnimal(id)                          return PLUGIN_HANDLED          }                   PlayerClass[id] = CLASS_DOG                   client_print(id, print_chat, "[Animal Mod] You are now a Dog!")               }                        if(key == 1) {                    if(PlayerClass[id] == CLASS_CAT) {                               client_print(id, print_chat, "[Animal Mod] You are allready a Cat! Choose something else!")               ChooseAnimal(id)               return PLUGIN_HANDLED          }                              PlayerClass[id] = CLASS_CAT          client_print(id, print_chat, "[Animal Mod] You are now a Cat!")     }           if(key == 2) {                    if(PlayerClass[id] == CLASS_HORSE) {                               client_print(id, print_chat, "[Animal Mod] You are allready a Horse! Choose something else!")               ChooseAnimal(id)               return PLUGIN_HANDLED          }                              PlayerClass[id] = CLASS_HORSE          client_print(id, print_chat, "[Animal Mod] You are now a Horse!")     }          if(key == 3) {                    if(PlayerClass[id] == CLASS_COW) {                               client_print(id, print_chat, "[Animal Mod] You are allready a Cow! Choose something else!")               ChooseAnimal(id)               return PLUGIN_HANDLED          }                              PlayerClass[id] = CLASS_COW          client_print(id, print_chat, "[Animal Mod] You are now a Cow!")     }             ShowHUD(id)           return PLUGIN_HANDLED } public ResetHUD(id) {     if(PlayerClass[id] == CLASS_NOTHING) {                ChooseAnimal(id)          return PLUGIN_HANDLED     }         if(is_user_alive(id) == 1) {          if(PlayerClass[id] == CLASS_DOG) {                   cs_set_user_model (id, "models/animals/dog.mdl")          }     }                    return PLUGIN_HANDLED } public DeathMsg() {     if(get_cvar_num("sv_animalmod") == 0) {          return PLUGIN_HANDLED     }           new attacker = read_data(1)           if(PlayerClass[attacker] == CLASS_NOTHING) {          return PLUGIN_HANDLED     }           if(PlayerLevel[attacker] == 6) {          return PLUGIN_HANDLED     }                   PlayerXP[attacker] += get_cvar_num("XP_per_kill")           if(PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]]) {                PlayerLevel[attacker] += 1                    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 }

Heres what I did:
Code:
public ResetHUD(id) {     if(PlayerClass[id] == CLASS_NOTHING) {                ChooseAnimal(id)          return PLUGIN_HANDLED     }         if(is_user_alive(id) == 1) {          if(PlayerClass[id] == CLASS_DOG) {                   cs_set_user_model (id, "models/animals/dog.mdl")          }     }                    return PLUGIN_HANDLED }
XunTric is offline
NiGHTFiRE
Senior Member
Join Date: Dec 2004
Location: Sweden
Old 04-18-2005 , 15:15  
Reply With Quote #3

I got it to work when i did this:
Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #define CLASS_NOTHING 0 #define CLASS_DOG 1 #define CLASS_CAT 2 #define CLASS_HORSE 3 #define CLASS_COW 4 #define MAXCLASSES 5 new PlayerClass[33] new PlayerXP[33] new PlayerLevel[33] new const CLASSES[MAXCLASSES][] = {     "None",     "Dog",     "Cat",     "Horse",     "Cow" } new msgtext new const LEVELS[6] = {     100,     200,     400,     800,     1600,     3200 } public plugin_init() { //registers important things     register_plugin("Animal Mod", "1.0", "XunTric")     register_cvar("sv_animalmod", "1")     register_event("DeathMsg", "DeathMsg", "a")     register_cvar("XP_per_kill", "20")     register_menucmd(register_menuid("menu_ChooseAnimal"),1023,"DoChooseAnimal");     register_event("ResetHUD", "ResetHud", "b")     msgtext = get_user_msgid("StatusText")     register_clcmd("say /changeanimal", "ChangeAnimal")     register_clcmd("say_team /changeanimal", "ChangeAnimal") } stock ChooseAnimal(id) {     new menu[192]     new keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_0;         format(menu, 191, "Animal Mod: Choose Animal^n^n1. Dog^n2. Cat^n3. Horse^n4. Cow^n^n0. Exit")     show_menu(id, keys, menu, -1, "menu_ChooseAnimal")        return PLUGIN_CONTINUE } public DoChooseAnimal(id, key) {     if(key == 0) {                  if(PlayerClass[id] == CLASS_DOG) {                         client_print(id, print_chat, "[Animal Mod] You are allready a Dog! Choose something else!")               ChooseAnimal(id)                          return PLUGIN_HANDLED          }                 PlayerClass[id] = CLASS_DOG                   client_print(id, print_chat, "[Animal Mod] You are now a Dog!")          precache_model("models/animals/dog.mdl");     }                      if(key == 1) {                    if(PlayerClass[id] == CLASS_CAT) {                             client_print(id, print_chat, "[Animal Mod] You are allready a Cat! Choose something else!")               ChooseAnimal(id)               return PLUGIN_HANDLED          }                              PlayerClass[id] = CLASS_CAT          client_print(id, print_chat, "[Animal Mod] You are now a Cat!")     }         if(key == 2) {                    if(PlayerClass[id] == CLASS_HORSE) {                             client_print(id, print_chat, "[Animal Mod] You are allready a Horse! Choose something else!")               ChooseAnimal(id)               return PLUGIN_HANDLED          }                              PlayerClass[id] = CLASS_HORSE          client_print(id, print_chat, "[Animal Mod] You are now a Horse!")     }        if(key == 3) {                    if(PlayerClass[id] == CLASS_COW) {                             client_print(id, print_chat, "[Animal Mod] You are allready a Cow! Choose something else!")               ChooseAnimal(id)               return PLUGIN_HANDLED          }                              PlayerClass[id] = CLASS_COW          client_print(id, print_chat, "[Animal Mod] You are now a Cow!")     }           ShowHUD(id)         return PLUGIN_HANDLED } public ResetHUD(id) {     if(PlayerClass[id] == CLASS_NOTHING) {              ChooseAnimal(id)          return PLUGIN_HANDLED     }         return PLUGIN_HANDLED } public DeathMsg() {     if(get_cvar_num("sv_animalmod") == 0) {          return PLUGIN_HANDLED     }         new attacker = read_data(1)         if(PlayerClass[attacker] == CLASS_NOTHING) {          return PLUGIN_HANDLED     }         if(PlayerLevel[attacker] == 6) {          return PLUGIN_HANDLED     }                 PlayerXP[attacker] += get_cvar_num("XP_per_kill")         if(PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]]) {                PlayerLevel[attacker] += 1                    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 }
I don't know if it will change model though bc I haven't tested the plugin i just got it to compile.

Xuntric is it ok if i add multilanguage and sql or vault and such things and make it a plugin. I will of course give you credits.
NiGHTFiRE is offline
Send a message via AIM to NiGHTFiRE Send a message via MSN to NiGHTFiRE
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 04-18-2005 , 15:18  
Reply With Quote #4

Copy and paste the code I told ya...
My code compiles.

You cant precache the model inside the menu?
You gotta do it in the plugin_precache()...


And yeh just make a animal plugin if you want.
XunTric is offline
NiGHTFiRE
Senior Member
Join Date: Dec 2004
Location: Sweden
Old 04-18-2005 , 15:21  
Reply With Quote #5

Code:
public DoChooseAnimal(id, key) {     if(key == 0) {                  if(PlayerClass[id] == CLASS_DOG) {                         client_print(id, print_chat, "[Animal Mod] You are allready a Dog! Choose something else!")               ChooseAnimal(id)                          return PLUGIN_HANDLED          }                 PlayerClass[id] = CLASS_DOG                   client_print(id, print_chat, "[Animal Mod] You are now a Dog!")          precache_model("models/animals/dog.mdl");     }
NiGHTFiRE is offline
Send a message via AIM to NiGHTFiRE Send a message via MSN to NiGHTFiRE
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 04-18-2005 , 15:23  
Reply With Quote #6

You cant precache models inside a menu.
You have to do it in the plugin_precache as you had in the first code.

And that only downloads the model (wont work where you placed it anyway), and does not change peoples models.

Copy and paste the code I said. That one compiles and should work.
XunTric is offline
n0obie4life
Veteran Member
Join Date: Dec 2004
Old 04-19-2005 , 09:35  
Reply With Quote #7

remember to credit me . i thought of that idea .
n0obie4life is offline
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 04-19-2005 , 09:44  
Reply With Quote #8

I only used the animal idea for a example on my tutorial...

Btw I added save XP now, but I cant have more small tags :S

Gotta get admins to help me...
XunTric is offline
NiGHTFiRE
Senior Member
Join Date: Dec 2004
Location: Sweden
Old 04-19-2005 , 10:09  
Reply With Quote #9

Ok cool, I'll look at your updated tutorial and I won't use the animals idea. I will use some thing else, noobie I'll give you credits too
NiGHTFiRE is offline
Send a message via AIM to NiGHTFiRE Send a message via MSN to NiGHTFiRE
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 04-19-2005 , 11:00  
Reply With Quote #10

Meh, he only gave a idea of a animal mod in a post where v3x asked for ideas of new mods...

I was allready making a tutorial, and saw that post and just used the animal mod as a example.

He didnt code anything...
XunTric is offline
Reply



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 17:45.


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