Raised This Month: $ Target: $400
 0% 

US Military Mod


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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 - 1181 views - 3.0 KB)

Last edited by >)SL(< | Wicked; 01-29-2008 at 16:33. Reason: Updated
>)SL(< | Wicked is offline
 



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 14:58.


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