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

USM Mod


Post New Thread Reply   
 
Thread Tools Display Modes
>)SL(< | Wicked
Senior Member
Join Date: Jan 2008
Old 02-07-2008 , 15:14   Re: USM Mod
Reply With Quote #11

Yes, if you choose army, then you'll rank up according to their ranks. Right now, you don't, but I'm trying to find a way to where if you first choose army, then get like 40 XP, then choose marines, it starts you back at 0. But if you go back to army, you start back at 40 XP.

Also, since everyone is complaining that it needs rewards, I'm making it so that every five ranks, you gain an extra 5 HP.
__________________
#Team !иکдиІтy
>)SL(< | Wicked is offline
Old 02-07-2008, 15:26
fxfighter
This message has been deleted by fxfighter. Reason: gfaw
>)SL(< | Wicked
Senior Member
Join Date: Jan 2008
Old 02-08-2008 , 07:33   Re: USM Mod
Reply With Quote #12

Yeah, thats what I thought I should do, ;)

It might take a bit to figure it out, but I know I will get it
__________________
#Team !иکдиІтy
>)SL(< | Wicked is offline
>)SL(< | Wicked
Senior Member
Join Date: Jan 2008
Old 02-11-2008 , 10:20   Re: USM Mod
Reply With Quote #13

If i change the PlayerXP array into a 2d array, wont PlayerLevel need to change to a 2d array too?

Ok, I think I got this, could someone plz check over the load and save data functions? Im not that familar with nVault, or saving anything really.

PHP Code:
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
*  Credits:                                             *
*     Most credit goes to the guy that helped me the    *
*     most, fxfighter.   Thank you so much =D.          *
*     I also give credit to Black Rose for helping me   *
*     out with the 3-D array, thanks ;)                 *
*                                                       *
*     I hope you all enjoy this mod as much as I had    *
*     fun making it.                                    *
*                                                       *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#define MAXRANKS 27
new PlayerClass[33]
new 
PlayerXP[3][33]
new 
PlayerLevel[3][33]
new 
XP_Killg_vaultSaveXPModOn
new const CLASSES[] = {"None""US Army""US Marines""US Navy"}
new const 
RANKS[][][] = {
  {
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
"",
    
""
  
},
  {
    
"Private",
    
"Private 1st Class",
    
"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]",
    
"Chief Warrant Officer[4]",
    
"2nd Lieutenant",
    
"1st Lieutenant",
    
"Captian",
    
"Major",
    
"Lieutenant Colonel",
    
"Colonel",
    
"Brigadier General",
    
"Major General",
    
"Lieutenant General",
    
"General",
    
"General of the Army"
  
},
  {
    
"Private 1st Class",
    
"Lance Corporal",
    
"Corporal",
    
"Sergeant",
    
"Staff Sergeant",
    
"Gunnery Sergeant",
    
"Master Sergeant",
    
"1st Sergeant",
    
"Sergeant Major",
    
"Master Gunnery Sergeant",
    
"Sergeant Major of the Marine Corps",
    
"Warrant Officer",
    
"Chief Warrant Officer[1]",
    
"Chief Warrant Officer[2]",
    
"Chief Warrant Officer[3]",
    
"Chief Warrant Officer[4]",
    
"2nd Lieutenant",
    
"First Lieutenant",
    
"Captain",
    
"Major",
    
"Lieutenant Colonel",
    
"Colonel",
    
"Brigadier General",
    
"Major General",
    
"Lieutenant General",
    
"General",
    
""
  
},
  {
    
"Seaman Apprentice",
    
"Seaman",
    
"Petty Officer 3rd Class",
    
"Petty Officer 2nd Class",
    
"Petty Officer 1st Class",
    
"Chief Petty Officer",
    
"Senior Chief Petty Officer",
    
"Master Chief Petty Officer",
    
"Command Master Chief Petty Officer",
    
"Master Chief Petty Officer of the Navy",
    
"USN Warrant Officer",
    
"USN Chief Warrant Officer[1]",
    
"USN Chief Warrant Officer[2]",
    
"USN Chief Warrant Officer[3]",
    
"USN Chief Warrant Officer[4]",
    
"Ensign",
    
"Lieutenant Junior Grade",
    
"Lieutenant",
    
"Lieutenant Commander",
    
"Commander",
    
"Captain",
    
"Rear Admiral Lower Half",
    
"Rear Admiral Upper Half",
    
"Vice Admiral",
    
"Admiral",
    
"Fleet Admiral",
    
""
  
}
}
new const 
LEVELS[] = {
  
25,
  
50,
  
75,
  
100,
  
150,
  
200,
  
250,
  
300,
  
400,
  
500,
  
600,
  
800,
  
1000,
  
1200,
  
1400,
  
1600,
  
1800,
  
2000,
  
2500,
  
3000,
  
3500,
  
4000,
  
5500,
  
6000,
  
8000,
  
10000
}
public 
plugin_init()
{
  
register_plugin("US Military Mod""1.00""Robert aKa D]i[P  Wicked")
  
//CVAR line, adds a cvar command to the plugin (on/off)
  
ModOn register_cvar("usm_mod""1")
  
register_event("DeathMsg""eDeath""a")
  
register_clcmd"military_menu","ChooseClass")
  
SaveXP register_cvar("SaveXP","1")
  
XP_Kill=register_cvar("XP_per_kill""1")
  
g_vault nvault_open("VAULT")
  
register_logevent("Round_start"2"1=Round_Start")
  
register_event("ResetHUD""HudReset""b")
}
public 
HudReset(id)
{
  
ShowHud(id)
}
public 
Round_start() 
{
  new 
i
  
for ( 33 ++ ) 
  {
    if(
is_user_connected(i) && PlayerClass[i] == 0
    {
      
ChooseClass(i)
    }
  }
}  
 
public 
ChooseClass(id)
{
  new 
menu menu_create("\rChoose a Class!:""menu_handler")
  
menu_additem(menu"\wUS Army""1"0)
  
menu_additem(menu"\wUS Marines""2"0)
  
menu_additem(menu"\wUS Navy""3"0)
  
menu_setprop(menuMPROP_EXITMEXIT_ALL)
  
menu_display(idmenu0)
}
public 
menu_handler(idmenuitem)
{
  if (
item == MENU_EXIT)
  {
    
menu_destroy(menu)
  }
  new 
data[6], iName[64]
  new 
accesscallback
  menu_item_getinfo
(menuitemaccessdata,5iName63callback)
  new 
key str_to_num(data)
  
PlayerClass[id] = key
  client_print
(idprint_chat"Welcome to the %s maggot! Get out there and rank up!",CLASSES[PlayerClass[id]])
  
menu_destroy(menu)
}
public 
SaveData(id)
{
  if(
get_pcvar_num(ModOn) == 0)
  {
    return 
PLUGIN_HANDLED
  
}
 
  new 
AuthID[35]
  
get_user_authid(id,AuthID,34)
  new 
vaultkey[64],vaultdata[256]
  
format(vaultkey,63,"%s-US Military Mod",AuthID)
  
format(vaultdata,255,"%i#%i#%i#",PlayerClass[id],PlayerXP[PlayerClass[id]][id],PlayerLevel[PlayerClass[id]][id])
  
nvault_set(g_vault,vaultkey,vaultdata)
  return 
PLUGIN_CONTINUE
}
public 
LoadData(id)
{
  if(
get_pcvar_num(ModOn) == 0)
  {
    return 
PLUGIN_HANDLED
  
}
 
  new 
authid[35]
  
get_user_authid(id,authid,34)
  new 
vaultkey[64],vaultdata[256];
  
format(vaultkey,63,"%s-US Military Mod",authid)
  
format(vaultdata,255,"%i#%i#%i#",PlayerClass[id],PlayerXP[PlayerClass[id]][id],PlayerLevel[PlayerClass[id]][id])
  
nvault_get(g_vault,vaultkey,vaultdata,255)
  
replace_all(vaultdata255"#"" ")
  new 
playerclass[32], playerxp[3][32], playerlevel[3][32]
  
parse(vaultdataplayerclass31playerxp2,  31playerlevel231)
 
  
PlayerClass[id] = str_to_num(playerclass)
  
PlayerXP[PlayerClass[id]][id] = str_to_num(playerxp[PlayerClass[id]])
  
PlayerLevel[PlayerClass[id]][id] = str_to_num(playerlevel[PlayerClass[id]])
  return 
PLUGIN_CONTINUE
}
//Loads Class, Level, and XP connect
public client_connect(id)
{  
  if(
get_pcvar_num(SaveXP) == 1)
  {
    
LoadData(id)
  }
}
//Saves XP on disconnect
public client_disconnect(id)
{
  if(
get_pcvar_num(SaveXP) == 1)
  {
    
SaveData(id)
  }
  new 
rowcol
  
for(row 0row 3row++)
  {
    for(
col 0col 33col++)
    {
      
PlayerXP[row][col] = 0
      PlayerLevel
[row][col] = 0
    
}
  }
  
PlayerClass[id] = 0
}
public 
eDeath(  ) 

  new 
attacker read_data)
 
  if(
PlayerClass[attacker] != 0)
  {
    
PlayerXP[PlayerClass[attacker]][attacker] += get_pcvar_num(XP_Kill)
    
client_print(attackerprint_chat"+1 Kill"XP_Kill)
    if(
PlayerXP[PlayerClass[attacker]][attacker] >= LEVELS[PlayerLevel[PlayerClass[attacker]][attacker]])
    {
      
PlayerLevel[PlayerClass[attacker]][attacker] += 1
      client_print
(attackerprint_chat"You have just been promoted! You are now a %s"RANKS[PlayerClass[attacker]][PlayerLevel[PlayerClass[attacker]][attacker]])
    }
  }
  
ShowHud(attacker)
  
SaveData(attacker)
}  
public 
ShowHud(id)
{
  
set_hudmessage(25500, -1.0, -1.006.012.0);
  
show_hudmessage(id"Class: %s^nRank: %s^nKills: %i/%i^n"CLASSES[PlayerClass[id]], RANKS[PlayerClass[id]][PlayerLevel[PlayerClass[id]][id]], PlayerXP[PlayerClass[id]][id], LEVELS[PlayerLevel[PlayerClass[id]][id]]);

Attached Files
File Type: sma Get Plugin or Get Source (usm_mod.sma - 665 views - 7.7 KB)
__________________
#Team !иکдиІтy

Last edited by >)SL(< | Wicked; 02-11-2008 at 12:16.
>)SL(< | Wicked 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 19:08.


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