Raised This Month: $ Target: $400
 0% 

Different XP mod


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rikards1
Member
Join Date: Aug 2009
Old 09-22-2010 , 12:34   Different XP mod
Reply With Quote #1

Hello, I wondered if somewhere out there could make me a hns plugin.

I need a xp mod that has no classes only xp. You should get xp for killing with knife, headshot with knife, loosing xp for dieing (not getting killed) and get xp for killing with gas nade.

The different lvls should be like:

Ricky: /xp
Ricky has 550 xp (Beginner!)

250 xp = Beginner
500 xp = Learning
1000 xp = Better
1500 xp = Soon pro
2000 xp = Pro

Or something like that.

You shouldnt get anything on eatch lvl just the rank (Beginner etc...)

Big thanx for any help.
rikards1 is offline
nnajko
Senior Member
Join Date: May 2009
Location: Sweden
Old 09-23-2010 , 13:09   Re: Different XP mod
Reply With Quote #2

I couldnt test it myself but I hope it should work
Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
new const RANK[6] = 
{
 0,
 250, 
 500, 
 1000, 
 1500,
 2000
}
new const RANKNAMES[6][] =
{
 "Noob",
 "Beginner",
 "Learning",
 "Better",
 "Soon pro",
 "Pro"
}

new gXP[33], gLevel[33];
new XP_Kill, XP_Hs;
new g_vault;
public plugin_init()
{
 register_plugin("XP-Ranking", "1.0", "nnajko");
 
 register_event("DeathMsg", "eDeath", "a");
 
 XP_Kill = register_cvar("XP_per_kill", "20");
 XP_Hs = register_cvar("XP_hs_bonus","10");
 g_vault = nvault_open("HNSXPRANK");
 
 register_clcmd("say /xp", "ShowHud");
 register_clcmd("say_team /xp", "ShowHud");
}
public eDeath() 
{
 new attacker = read_data(1);
 new victim = read_data(2);
 new headshot = read_data(3);
 new gPrintMSG[100];
 new gXPKill = get_pcvar_num(XP_Kill);
 new gXPHs = get_pcvar_num(XP_Hs);
 
 if( victim == attacker )
  return PLUGIN_HANDLED;
 
 if( !headshot && victim != attacker )
 {
  gXP[attacker] += gXPKill
  formatex(gPrintMSG, charsmax(gPrintMSG), "You gained %d XP!", gXPKill);
 }
 else if( headshot && victim != attacker )
 {
  gXP[attacker] += (gXPKill + gXPHs);
  formatex(gPrintMSG, charsmax(gPrintMSG), "You gained %d XP!^x01 (Headshot)", (gXPHs + gXPKill));
 }
 
 Print(attacker, gPrintMSG);
 
 
 CheckLevel(attacker);
 SaveData(attacker);
}
public CheckLevel(id)
{
 if( gXP[id] >= RANK[gLevel[id]] )
 {
  Print(id, "Congratulations! You are now a:^x01 %s^x03!", RANKNAMES[gLevel[id]]);
  gLevel[id]++;
 }
}
public ShowHud(id)
{
 new szName[33];
 get_user_name(id, szName, charsmax(szName));
 Print(id, "^x01%s^x03 is a:^x01 %s^x03 with^x01 %d XP^x03!", szName, RANKNAMES[gLevel[id]], gXP[id]);
}
public client_connect(id)
{
 LoadData(id);
}
public client_disconnect(id)
{
 SaveData(id);
 gXP[id] = 0;
 gLevel[id] = 0;
}
public SaveData(id)
{
 new AuthID[35];
 get_user_authid(id,AuthID,34);
 
 new vaultkey[64],vaultdata[256];
 format(vaultkey,63,"%s-Mod",AuthID);
 format(vaultdata,255,"%i#%i#",gXP[id],gLevel[id]);
 nvault_set(g_vault,vaultkey,vaultdata);
 return PLUGIN_CONTINUE
}
public LoadData(id)
{
 new AuthID[35];
 get_user_authid(id,AuthID,34);
 
 new vaultkey[64],vaultdata[256];
 format(vaultkey,63,"%s-Mod",AuthID);
 format(vaultdata,255,"%i#%i#",gXP[id],gLevel[id]);
 nvault_get(g_vault,vaultkey,vaultdata,255);
 
 replace_all(vaultdata, 255, "#", " ");
 
 new gXP[32], gLevel[32];
 
 parse(vaultdata, gXP, 31, gLevel, 31);
 
 gXP[id] = str_to_num(gXP);
 gLevel[id] = str_to_num(gLevel);
 
 return PLUGIN_CONTINUE;
}
Print(iPlayer, const sMsg[], any:...)
{
 static i; i = iPlayer ? iPlayer : get_Player();
 if ( !i ) return;
 
 new sMessage[256];
 new len = formatex(sMessage, sizeof(sMessage) - 1, "^x04[HNS Ranks]^x03 ");
 vformat(sMessage[len], sizeof(sMessage) - 1 - len, sMsg, 3);
 sMessage[192] = '^0';
  
 static msgid_SayText;
 if ( !msgid_SayText ) msgid_SayText = get_user_msgid("SayText");
 
 new const team_Names[][] =
 {
  "",
  "TERRORIST",
  "CT",
  "SPECTATOR"
 };
  
 new sTeam = get_user_team(i);
 
 team_Info(i, iPlayer, team_Names[0]);
  
 message_begin(iPlayer ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, msgid_SayText, _, iPlayer);
 write_byte(i);
 write_string(sMessage);
 message_end();
  
 team_Info(i, iPlayer, team_Names[sTeam]);
}
team_Info(receiver, sender, sTeam[])
{
 static msgid_TeamInfo;
 if ( !msgid_TeamInfo ) msgid_TeamInfo = get_user_msgid("TeamInfo");
 
 message_begin(sender ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, msgid_TeamInfo, _, sender);
 write_byte(receiver);
 write_string(sTeam);
 message_end();
}
get_Player()
{
 for ( new iPlayer = 1; iPlayer <= get_maxplayers(); iPlayer++ )
 {
  return iPlayer;
 }
 
 return 0;
}

Last edited by nnajko; 09-23-2010 at 13:30.
nnajko is offline
DaxProxy
Senior Member
Join Date: Sep 2007
Old 09-23-2010 , 13:26   Re: Different XP mod
Reply With Quote #3

Coz u prolly going to ask that...then here's how to modify a plugin so it would have new ranks.

(Original)
PHP Code:
new const RANK[6] = 
{
 
0,
 
250
 
500
 
1000
 
1500,
 
2000
}
new const 
RANKNAMES[6][] =
{
 
"Noob",
 
"Beginner",
 
"Learning",
 
"Better",
 
"Soon pro",
 
"Pro"
}
New 
rank1337 
PHP Code:
new const RANK[7] = 
{
 
0,
 
250
 
500
 
1000
 
1500,
 
2000,
 
4000
}
new const 
RANKNAMES[7][] =
{
 
"Noob",
 
"Beginner",
 
"Learning",
 
"Better",
 
"Soon pro",
 
"Pro",
 
"1337"

Changes in bold.
__________________

Want ApolloRP for Counter-Strike? Show your support: http://forums.alliedmods.net/showthr...39#post1264739
DaxProxy is offline
rikards1
Member
Join Date: Aug 2009
Old 09-23-2010 , 13:37   Re: Different XP mod
Reply With Quote #4

Thank you both!

There's just two small anoying bugs... When you die the server gets 20 xp and it says:
" "Server name" gained 20 xp (Beginner!) " And the xp isnt saved when you re-join.

And could u add getting xp for killing with gas nade? (smoke grenade)

Last edited by rikards1; 09-23-2010 at 13:48.
rikards1 is offline
nnajko
Senior Member
Join Date: May 2009
Location: Sweden
Old 09-23-2010 , 14:09   Re: Different XP mod
Reply With Quote #5

Okej the "annoying message" is now fixed and I guess the save works?
About the gasnade I got no idea
nnajko is offline
rikards1
Member
Join Date: Aug 2009
Old 09-23-2010 , 14:47   Re: Different XP mod
Reply With Quote #6

Both things still bug :S The server gets xp and it doesnt save <.<
rikards1 is offline
nnajko
Senior Member
Join Date: May 2009
Location: Sweden
Old 09-23-2010 , 15:03   Re: Different XP mod
Reply With Quote #7

Quote:
Originally Posted by rikards1 View Post
Both things still bug :S The server gets xp and it doesnt save <.<
The server does NOT gain xp
But the saving does not work. So I will fix it tomorrow
nnajko is offline
rikards1
Member
Join Date: Aug 2009
Old 09-23-2010 , 15:12   Re: Different XP mod
Reply With Quote #8

The server actually does get xp :S
From console:
NeverStore killed self with worldspawn
[HB-XP] You gained 20 XP <----- The server gets xp when NeverStore dies

When we type amx_rcon say /xp this comes up:
[HB-XP] ThaKidsHns[Fast DL][rooftops only!] is a Noob with 80 xp!
rikards1 is offline
nnajko
Senior Member
Join Date: May 2009
Location: Sweden
Old 09-23-2010 , 17:27   Re: Different XP mod
Reply With Quote #9

Quote:
Originally Posted by rikards1 View Post
The server actually does get xp :S
From console:
NeverStore killed self with worldspawn
[HB-XP] You gained 20 XP <----- The server gets xp when NeverStore dies

When we type amx_rcon say /xp this comes up:
[HB-XP] ThaKidsHns[Fast DL][rooftops only!] is a Noob with 80 xp!
Good news
The server does NOT gain any xp now (Tested).
The saving also works!
But about the gasnades you will have to ask someone else.

Have Fun
Attached Files
File Type: sma Get Plugin or Get Source (XpRank.sma - 629 views - 4.5 KB)

Last edited by nnajko; 09-23-2010 at 17:30. Reason: Uploaded wrong sma
nnajko is offline
rikards1
Member
Join Date: Aug 2009
Old 09-24-2010 , 10:04   Re: Different XP mod
Reply With Quote #10

Thank you Very much! <3 And the gasnades, it counts as a kill and u get xp so that doesnt matters

Edit***

Server still gets xp -.-

Edit2***

xD Were using wrong file. It works, THANK YOU! )

Last edited by rikards1; 09-24-2010 at 15:19.
rikards1 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 12:30.


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