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

US Military Mod


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Condition-Zero        Category:   Gameplay       
>)SL(< | Wicked
Senior Member
Join Date: Jan 2008
Old 01-28-2008 , 19:49   US Military Mod
Reply With Quote #1

This is my very first mod. I hope that it doesn't get deleted .

Well, this is just a simple XP based mod that I made following XunTric's tutorial. I took some of that stuff out, added stuff, changed stuff... and I got this!

There are 27 different ranks, you start at private and work your way up to General. By default, XP per kill is set to 1. If you want to change the XP per kill, you might want to go into the .sma file and change lines 184 and 248 to better suit the output.

I hope to be able to add a menu so that you can choose if you want to be in the Marines or the US Army, and at any time you can change which one your in. But say for example, your a Sergeant in the US Army, with 130 kills, I would like that to stay only on the Army side if you switch to the Marines so you start at scratch in the Marines instead of skipping the first 4 ranks.

There are 2 CVARS for this plugin:
Code:
xp_per_kill 1 //by default is set to 1
sv_rankmod 1 //by default set to 1, 0 turns of the plugin
Well, enjoy!
I haven't really been able to test it, so if someone could real quick, that would be awsome!

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>

#define PLUGIN "Rank Mod"
#define VERSION "1.00"
#define AUTHOR "Robert aka Wicked"

#define MAXCLASSES 27

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

new const 
CLASSES[MAXCLASSES][] = {
    
"Private",
    
"Private 1st Class",
    
"Specialist",
    
"Corporal",
    
"Sergant",
    
"Staff Sergeant",
    
"Sergeant 1st Class",
    
"Master Sergeant",
    
"1st Sergeant",
    
"Sergeant Major",
    
"Command Sergeant Major",
    
"Sergeant Major Of The Army",
    
"Warrant Officer",
    
"Chief Warrant Officer[1]",
    
"Chief Warrant Officer[2]",
    
"Chief Warrant Officer[3]",
    
"Master Chief Warrant Officer",
    
"2nd Lieutenant",
    
"1st Lieutenant",
    
"Captian",
    
"Major",
    
"Lieutenant Colonel",
    
"Colonel",
    
"Brigadier General",
    
"Major General",
    
"Lieutenant General",
    
"General"
};

new const 
LEVELS[26] = {
    
25,
    
50,
    
75,
    
100,
    
150,
    
200,
    
250,
    
300,
    
400,
    
500,
    
600,
    
800,
    
1000,
    
1200,
    
1400,
    
1600,
    
1800,
    
2000,
    
2500,
    
3000,
    
3500,
    
4000,
    
5500,
    
6000,
    
7000,
    
8000
};

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
//CVAR line, adds a cvar command to the plugin (on/off)
    
register_cvar("sv_rankmod""1");
    
    
register_event("DeathMsg""eDeath""a");
    
    
SaveXP register_cvar("SaveXP","1");
    
XP_Kill=register_cvar("XP_per_kill""1");
    
g_vault nvault_open("VAULT");
}

public 
SaveData(id)
{
    new 
AuthID[35];
    
get_user_authid(id,AuthID,34);
 
    new 
vaultkey[64],vaultdata[256];
    
format(vaultkey,63,"%s-Rank Mod",AuthID);
    
format(vaultdata,255,"%i#%i#",PlayerXP[id],PlayerLevel[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-Rank Mod",authid);
    
format(vaultdata,255,"%i#%i#",PlayerXP[id],PlayerLevel[id]);
    
nvault_get(g_vault,vaultkey,vaultdata,255);
 
    
replace_all(vaultdata255"#"" ");
 
    new 
playerxp[32], playerlevel[32];
 
    
parse(vaultdataplayerxp31playerlevel31);
 
    
PlayerXP[id] = str_to_num(playerxp);
    
PlayerLevel[id] = str_to_num(playerlevel);
 
    return 
PLUGIN_CONTINUE;
}

//Loads Class, Level, and XP connect
public client_connect(id)
{
    if(
get_pcvar_num(SaveXP) == 1)
    {
 
        
LoadData(id);
        
client_print(idprint_chat"[Rank Mod] XP Loaded!");
    }
}

//Saves XP on disconnect
public client_disconnect(id)
{
    if(
get_pcvar_num(SaveXP) == 1)
    {
 
        
SaveData(id);
    }
    
PlayerXP[id] = 0;
    
PlayerLevel[id] = 0;
    
PlayerClass[id] = 0;
}

public 
eDeath(  ) 
{
    new 
iVictim read_data);
    new 
attacker get_user_attacker(iVictim);
 
    
PlayerXP[attacker] += get_pcvar_num(XP_Kill);
 
    if(
PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]])
    
PlayerLevel[attacker] += 1;
 
    
ShowHud(attacker);
    
SaveData(attacker);
}

public 
ShowHud(id)
{
 
set_hudmessage(255000.750.0106.015.0);
 
show_hudmessage(id"Rank: %s^nKills: %i^n",PlayerLevel[id],PlayerXP[id],CLASSES[PlayerClass[id]]);

Updates:
1.1 -
  • Took out Vault, replaced it with nVault
  • Changed the SaveXP function
  • changed the LoadXP function
  • took out ResetHUD
  • fixed the crash (hopefully)
1.00 -
  • Initial Release
Attached Files
File Type: sma Get Plugin or Get Source (rankmod.sma - 1171 views - 3.0 KB)

Last edited by >)SL(< | Wicked; 01-29-2008 at 16:33. Reason: Updated
>)SL(< | Wicked is offline
chris
Senior Member
Join Date: Mar 2007
Location: America
Old 01-29-2008 , 00:41   Re: US Military Mod
Reply With Quote #2

Nice I'll try this out. By any chance is this the same as the BF2 Rank mod?
__________________
chris is offline
Send a message via AIM to chris
fxfighter
Veteran Member
Join Date: Feb 2007
Location: Trollhättan
Old 01-29-2008 , 02:00   Re: US Military Mod
Reply With Quote #3

it shuld krash the server i recommend you test your plugins before submiting them next time.
PHP Code:
public ResetHUD(id)
{
    
//Checks to see if rankmod is on
    
if(get_cvar_num("sv_rankmod") == 0) {
        return 
PLUGIN_HANDLED;
    }
 
    return 
PLUGIN_HANDLED;

Use PLUGIN_CONTINUE
You shuld replace vault whit nvault
You dont need all the defines.....
You Dont need fun and cstrike
Use Pcvars
Add more futures.

Quote:
public client_connect(id)
{ client_print(id, print_chat, "[Rank Mod] XP Loaded!");
client_print(id, print_chat, "[Rank Mod] Your a %s with %s kills", PlayerClas
}
you cant print chat in thare hud if they arent in yet.
__________________
If one of my plugins become broken, contact me by mail. [email protected]

Last edited by fxfighter; 01-29-2008 at 02:08.
fxfighter is offline
Send a message via MSN to fxfighter
hasta
Senior Member
Join Date: Aug 2004
Location: Ukraine, Kyiv
Old 01-29-2008 , 07:30   Re: US Military Mod
Reply With Quote #4

plugin work by steamid?
can u do this by name(nick)
tnx
hasta is offline
Send a message via ICQ to hasta
>)SL(< | Wicked
Senior Member
Join Date: Jan 2008
Old 01-29-2008 , 07:38   Re: US Military Mod
Reply With Quote #5

Quote:
Originally Posted by chris View Post
Nice I'll try this out. By any chance is this the same as the BF2 Rank mod?
Sort of... This is basically a dumb downed version.

Quote:
Originally Posted by fxfighter View Post
it shuld krash the server i recommend you test your plugins before submiting them next time.
PHP Code:
public ResetHUD(id)
{
    
//Checks to see if rankmod is on
    
if(get_cvar_num("sv_rankmod") == 0) {
        return 
PLUGIN_HANDLED;
    }
 
    return 
PLUGIN_HANDLED;

Use PLUGIN_CONTINUE
You shuld replace vault whit nvault
You dont need all the defines.....
You Dont need fun and cstrike
Use Pcvars
Add more futures.


you cant print chat in thare hud if they arent in yet.
could you help me with this then, im fairly new to this.
ok, this is what i should do?:
-Replace all instances of vault to nvault?

Thats basically all that i can understand since im new, so u gotta explain it a little more.

Also, i was gonna test this as soon as i got home from school today.

Oh and i cant believe i didnt see that one part where it should crash the server, it basically common sense that plugin_continue should be there =\

Quote:
Originally Posted by hasta View Post
plugin work by steamid?
can u do this by name(nick)
tnx
Trust me, you want to go by id, not nick, because if someone wants to change their name, they will have to start all over again.
__________________
#Team !иکдиІтy

Last edited by >)SL(< | Wicked; 01-29-2008 at 07:41.
>)SL(< | Wicked is offline
fxfighter
Veteran Member
Join Date: Feb 2007
Location: Trollhättan
Old 01-29-2008 , 08:30   Re: US Military Mod
Reply With Quote #6

actuly you can remove the hole resethud event becase it actuly dont do enything.

i updated the xp tutorial script its at the last page have a look.
XP TUTORIAL
got pcvars,nvault and new menu system.
__________________
If one of my plugins become broken, contact me by mail. [email protected]
fxfighter is offline
Send a message via MSN to fxfighter
>)SL(< | Wicked
Senior Member
Join Date: Jan 2008
Old 01-29-2008 , 11:10   Re: US Military Mod
Reply With Quote #7

Ohh, thank thank you

Would you like to help me with this mod? I got an idea of making a menu so that you can choose if your in the army or the marines.
__________________
#Team !иکдиІтy
>)SL(< | Wicked is offline
>)SL(< | Wicked
Senior Member
Join Date: Jan 2008
Old 01-29-2008 , 11:56   Re: US Military Mod
Reply With Quote #8

Quote:
Originally Posted by >)SL(< | Wicked View Post
Ohh, thank thank you

Would you like to help me with this mod? I got an idea of making a menu so that you can choose if your in the army or the marines.


OMG, if i follow that, i will need to rewrite everything!

I'll just change the vault to nvault, and take out the defines and test that in a little bit, once i get home from school.



Updated!
__________________
#Team !иکдиІтy

Last edited by >)SL(< | Wicked; 01-29-2008 at 12:30.
>)SL(< | Wicked is offline
>)SL(< | Wicked
Senior Member
Join Date: Jan 2008
Old 01-29-2008 , 14:45   Re: US Military Mod
Reply With Quote #9

Ok, i have tested it, and I need some help . Can someone please help me? I cant get anything to show up or work... It compiles fine though...
__________________
#Team !иکдиІтy
>)SL(< | Wicked is offline
fxfighter
Veteran Member
Join Date: Feb 2007
Location: Trollhättan
Old 01-29-2008 , 15:33   Re: US Military Mod
Reply With Quote #10

you have remove the ResetHUD function but you still register it.
remove it or it should cause problems
Quote:
register_event("ResetHUD", "ResetHud", "b");

dont know if you removed it or not frome your main code but i can see it at the top post.
__________________
If one of my plugins become broken, contact me by mail. [email protected]
fxfighter is offline
Send a message via MSN to fxfighter
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 02:47.


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