Raised This Month: $ Target: $400
 0% 

Nothing is displaying - HNS XP mod


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JProReTaRD
Member
Join Date: May 2009
Location: Denmark, KBH
Old 05-09-2009 , 11:27   Nothing is displaying - HNS XP mod
Reply With Quote #1

Hi, im currently developing a new xp mod for my hns server. However, I cannot make it display anything, but it is loaded though.
Not even the choose class menu is opening. :S

I hope one of you can tell me what i'm doing wrong.
This is the code:

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <vault>

#define CLASS_NOTHING 0
#define CLASS_JUMPER 1
#define CLASS_BHOPPER 2
#define CLASS_CHOPPER 3
#define CLASS_NOOB 4
// Etc... 
// Note: I made a "nothing" Jumper. This is the class that all new people will automaticly get.

#define MAXCLASSES 5
#define MAXLEVELS 15
// I set MAXCLASSES to 5, since we have 5 classes 

new PlayerClass[33];
new PlayerXP[33];
new PlayerLevel[33];

new const CLASSES[MAXCLASSES][] = {
     "None",
     "Jumper",
     "BHopper",
     "CHopper",
     "Noob" 
}

new msgtext;

new const LEVELS[MAXLEVELS] = {
    90,
    180,
    300,
    450,
    700,
    1200,
    1800,
    2800,
    4100,
    5200,
    6000,
    6800,
    8200,
    10200,
    12000
}; // Levels

public plugin_init() {
     register_plugin("HNS - XP", "1.0", "By [JPro] ReTaRD [ToY]");
     //I'll create a on/off cvar for the mod... You dont have to add this.
     register_cvar("sv_hnsxpmod", "1");
     //Now we register the DeathMsg event. This is where we can add XP when you kill somebody.
     register_event("DeathMsg", "DeathMsg", "a");
     //Note that i registered it as "a"; global event
     //Now we register a "XP Per Kill" cvar...
     //Now I made 20 xp per kill.
     register_cvar("xp_per_kill", "15");
     //Lets register a SaveXP toggle cvar.
     register_cvar("SaveXP", "1");
     //Lets register a menu to choose Jumper with...
     register_menucmd(register_menuid("menu_ChooseJumper"),1023,"DoChooseJumper");
     //ResetHUD event.(Check if user has no class)
     register_event("ResetHUD", "ResetHud", "b");
     //Something for ShowHUD... Will explain later.
     msgtext = get_user_msgid("StatusText");
     //Lets make a "Change Jumper" cmd for players.
     //I just lead it to the change Jumper menu.
     //Ill get back to the menu later.
     register_clcmd("say /changeJumper", "ChangeJumper");
     register_clcmd("say_team /changeJumper", "ChangeJumper");
}

public SaveXP(id) {
     new authid[32];
     get_user_authid(id,authid,31);
     new vaultkey[64], vaultdata[64];
     //Save their class
     format(vaultkey,63,"Jumper-%s-class",authid);
     format(vaultdata,63,"%d",PlayerClass[id]);
     set_vaultdata(vaultkey,vaultdata);
     //Save their XP
     format(vaultkey,63,"Jumper-%s-xp",authid);
     format(vaultdata,63,"%d",PlayerXP[id]);
     set_vaultdata(vaultkey,vaultdata);
     //Save their level
     format(vaultkey,63,"Jumper-%s-level",authid);
     format(vaultdata,63,"%d",PlayerLevel[id]);
     set_vaultdata(vaultkey,vaultdata);
}
  
public LoadXP(id)
{
    new authid[32]; 
    get_user_authid(id,authid,31); 

    new vaultkey[64], vaultdata[64]; 

    //Load their class
    format(vaultkey,63,"Jumper-%s-class",authid); 
    get_vaultdata(vaultkey,vaultdata,63); 
    PlayerClass[id] = str_to_num(vaultdata); 

     //Load their XP
    format(vaultkey,63,"Jumper-%s-xp",authid); 
    get_vaultdata(vaultkey,vaultdata,63); 
    PlayerXP[id] = str_to_num(vaultdata);   

    //Load their level
    format(vaultkey,63,"Jumper-%s-level",authid); 
    get_vaultdata(vaultkey,vaultdata,63);
    PlayerLevel[id] = str_to_num(vaultdata);  
}

public client_connect(id)
{
    //Only load their XP if our SaveXP cvar is 1.
    if(get_cvar_num("SaveXP") == 1) {
       
         LoadXP(id);

         //Add a message if you want....
         client_print(id, print_chat, "[HNS XP Mod] XP Loaded!");
         client_print(id, print_chat, "[HNS XP Mod] You are a %s with level %s and %s XP", PlayerClass[id], PlayerLevel[id], PlayerXP[id]);
    }
}
 
public client_disconnect(id)
{
    //Only save their XP if our SaveXP cvar is 1.
    if(get_cvar_num("SaveXP") == 1) {
    
         SaveXP(id);
    }
}
   
//Call it whatever you want...
stock ChooseJumper(id)
{
    new menu[192];
    
    //Add keys for how many classes you have + exit key.
    new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3;

    
    //Here we write the menu options..
    format(menu, 191, "HNS XP Mod: Choose a Jumper^n^n1. Jumper^n2. BHopper^n3. CHopper^n4. Noob^n^n0. Exit");
    
    //We created a menu in plugin_init() and now we make the plugin know that its this menu it has to show.
    show_menu(id, keys, menu, -1, "menu_ChooseJumper");
    
    return PLUGIN_CONTINUE;
}
  
public DoChooseJumper(id, key)
{
    // Remeber that the keys starts on 0...
    if(key == 0) {
       
         //Lets check if the player allready has Jumper...
         if(PlayerClass[id] == CLASS_JUMPER) {
         
              //Make a message here if you want...
              client_print(id, print_chat, "[HNS XP Mod] You are already a Jumper! Choose something else!");
              
              //Open the menu again...
              ChooseJumper(id);
              
              //Exit...
              return PLUGIN_HANDLED;
         }        

         //Now, if the player didnt have Jumper allready, we'll set his class to jumper.
         PlayerClass[id] = CLASS_JUMPER;
         
         //Make a message if you want...
         client_print(id, print_chat, "[HNS XP Mod] You are now a Jumper!");
    }        
    
    //Im doing the same on all other buttons...
         
    if(key == 1) {
         
         if(PlayerClass[id] == CLASS_BHOPPER) {
              
              client_print(id, print_chat, "[HNS XP Mod] You are already a BHopper! Choose something else!");
              ChooseJumper(id);
              return PLUGIN_HANDLED;
         }
                   
         PlayerClass[id] = CLASS_BHOPPER
         client_print(id, print_chat, "[HNS XP Mod] You are now a BHopper!");
    }
    
    if(key == 2) {
         
         if(PlayerClass[id] == CLASS_CHOPPER) {
              
              client_print(id, print_chat, "[HNS XP Mod] You are already a CHopper! Choose something else!");
              ChooseJumper(id);
              return PLUGIN_HANDLED;
         }
                   
         PlayerClass[id] = CLASS_CHOPPER;
         client_print(id, print_chat, "[HNS XP Mod] You are now a CHopper!");
    }    

    if(key == 3) {
         
         if(PlayerClass[id] == CLASS_NOOB) {
              
              client_print(id, print_chat, "[HNS XP Mod] You are already a Noob! Choose something else!");
              ChooseJumper(id);
              return PLUGIN_HANDLED;
         }
                   
         PlayerClass[id] = CLASS_NOOB;
         client_print(id, print_chat, "[HNS XP Mod] You are now a Noob!");
    }
      
    //Show new HUD after picking class.
    //Ill get back to this later...
    ShowHUD(id);
    
    return PLUGIN_HANDLED;
}

public ResetHUD(id) {
     //Lets check if "sv_hnsxpmod" is on. If its off, we'll stop the function.
     if(get_cvar_num("sv_hnsxpmod") == 0) {
    return PLUGIN_HANDLED;
     }
     //Lets check if the player has no Jumper.
     if(PlayerClass[id] == CLASS_NOTHING) {
    //If the player doesnt have a Jumper;
    //Open the choose Jumper menu for him.
    ChooseJumper(id);
    return PLUGIN_HANDLED;
     }
     return PLUGIN_HANDLED;
}
  
public DeathMsg() //Note that i only had (), and not (id)
{
    //Lets check if "sv_hnsxpmod" is on. If its off, we'll stop the function.
    if(get_cvar_num("sv_hnsxpmod") == 0) {
         return PLUGIN_HANDLED;
    }
    
    //Now we create a "attacker" varriable. So the XP will be given to the killer, and not all players on the server.
    new attacker = read_data(1);
    
    //Now the plugin will check if the attacker doesnt have a class, and if he doesnt, the function will stop.
    if(PlayerClass[attacker] == CLASS_NOTHING) {
         return PLUGIN_HANDLED;
    }
    
    //Now lets see if the attacker allready has level 6, and doesnt need more XP, and if he is, stop the function.
    //You can remove this if you want, and let the player get as much XP he want. But we wont get more than level 6 anyway.
    if(PlayerLevel[attacker] == 6) {
         return PLUGIN_HANDLED;
    }
    
    //Now we can add XP to the attacker.        
    PlayerXP[attacker] += get_cvar_num("XP_per_kill"); //Add the amout of XP you have on the "XP_per_kill" cvar.
    
    //Now we check if the attacker has enough XP for a new level. And if he has, we add it.
    if(PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]]) {
     
         //Add his level...
         PlayerLevel[attacker] += 1;
         
         //Now you can make a "congratualtions" message if you want...
         client_print(attacker, print_chat, "[HNS XP Mod] Congratulations! You are now level %i!", PlayerLevel[attacker]);
         
         //Lets save his XP every time he gets a level incase the server crashes or something. So they wont loose it all.
         if(get_cvar_num("SaveXP") == 1) {
 
              SaveXP(attacker);
         }


         //Show His New Level on the HUD message.
         //Ill get back to this later...
         ShowHUD(attacker);
    }   
    
    //Show new HUD if you didnt get level too. (To show the new XP)
    //Ill get back to this later...
    ShowHUD(attacker);
    
    return PLUGIN_CONTINUE;
}
  
public ShowHUD(id)    
{ 
    new HUD[51];
    
    //This is the stuff that will actually show in game.
    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;
}
Made with help from XunTric (banned)

Regards
[JPRO] ReTaRD [ToY]

Last edited by JProReTaRD; 05-09-2009 at 15:21.
JProReTaRD is offline
Old 05-09-2009, 14:26
JProReTaRD
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
JProReTaRD
Member
Join Date: May 2009
Location: Denmark, KBH
Old 05-09-2009 , 15:31   Re: Nothing is displaying - HNS XP mod - Trash please
Reply With Quote #2

NVM, I fixed it myself
JProReTaRD is offline
roeey77
Member
Join Date: Sep 2008
Old 10-14-2009 , 07:51   Re: Nothing is displaying - HNS XP mod
Reply With Quote #3

Can u give me the plugin?
roeey77 is offline
Redfalcon
BANNED
Join Date: Sep 2009
Location: Prison Break
Old 10-15-2009 , 07:01   Re: Nothing is displaying - HNS XP mod
Reply With Quote #4

You got the code there just fix it
Redfalcon is offline
Send a message via MSN to Redfalcon
roeey77
Member
Join Date: Sep 2008
Old 10-28-2009 , 09:45   Re: Nothing is displaying - HNS XP mod
Reply With Quote #5

yea but i dont know so u can fix for me?
roeey77 is offline
2reason2kill
Senior Member
Join Date: Feb 2011
Old 05-29-2011 , 07:17   Re: Nothing is displaying - HNS XP mod
Reply With Quote #6

Quote:
Originally Posted by roeey77 View Post
yea but i dont know so u can fix for me?
try to download AMX MOD X Then copy the code and put it in AMX MOD X

And U need To complie it.
2reason2kill is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-29-2011 , 12:26   Re: Nothing is displaying - HNS XP mod
Reply With Quote #7

I think you're a bit too late last post was in 2009.
__________________
Hunter-Digital is offline
2reason2kill
Senior Member
Join Date: Feb 2011
Old 05-29-2011 , 17:09   Re: Nothing is displaying - HNS XP mod
Reply With Quote #8

Quote:
Originally Posted by Hunter-Digital View Post
I think you're a bit too late last post was in 2009.
Wow, didnt see that.

Btw Hunter want 2 Help me with my plugin that im working on?

if u want plz add me on steam my name is datadata
2reason2kill is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-30-2011 , 06:05   Re: Nothing is displaying - HNS XP mod
Reply With Quote #9

Post in the forums if you need help.
__________________
Hunter-Digital is offline
2reason2kill
Senior Member
Join Date: Feb 2011
Old 05-30-2011 , 07:50   Re: Nothing is displaying - HNS XP mod
Reply With Quote #10

Quote:
Originally Posted by Hunter-Digital View Post
Post in the forums if you need help.
okay
2reason2kill 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 15:54.


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