Raised This Month: $ Target: $400
 0% 

Adding Ranks to Each Level


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
linkosc
Senior Member
Join Date: Apr 2007
Location: Everywhere
Old 06-26-2010 , 12:38   Adding Ranks to Each Level
Reply With Quote #1

Hello Im trying to create a new mod called Call Of Duty Mod. I plan on making it like the exact game play of COD 4 MP. So Far this is what I have accomplished. I need Help adding Ranks To Each Level that the player gains.

Here is the Code:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <nvault>
#define MAXCLASSES 6
new const CLASSES[MAXCLASSES][] = {
    
"None",
    
"Assault",
    
"Spec Ops",
    
"Heavy Gunner",
    
"Demolitions",
    
"Sniper"
}
new const 
LEVELS[55] = {
      
0,
    
30
    
120
    
270
    
480
    
750
    
1080,
    
1470,
    
1920,
    
2430,
    
3000,
    
3650,
    
4380,
    
5190,
    
6080,
    
7050,
    
8100,
    
9230,
    
10440,
    
11730,
    
13100,
    
14550,
    
16080,
    
17690,
    
19380,
    
21150,
    
23000,
    
24930,
    
26940,
    
29030,
    
31240,
    
33570,
    
36020,
    
38590,
    
41280,
    
44090,
    
47020,
    
50070,
    
53240,
    
56530,
    
59940,
    
63470,
    
67120,
    
70890,
    
74780,
    
82920,
    
87170,
    
91540,
    
96030,
    
100640,
    
105370,
    
110220,
    
115190,
    
120280
}
new 
g_msgStatusIcon
new PlayerXP[33],PlayerLevel[33],PlayerClass[33]
new 
XP_Kill,XP_Knife,XP_Hs,SaveXP,g_vault
public plugin_init()
{
    
register_plugin("CODmod""1.0""<STX>Link")
    
g_msgStatusIcon get_user_msgid("StatusIcon")
    
register_message(g_msgStatusIcon"msgStatusIcon")
    
register_event("DeathMsg""eDeath""a"
    
SaveXP register_cvar("SaveXP","1")
    
XP_Kill=register_cvar("XP_per_kill""20")
    
XP_Hs=register_cvar("XP_hs_bonus","20")
    
XP_Knife=register_cvar("XP_knife_bonus","20")
    
g_vault nvault_open("CODmod")
 
 
    
register_clcmd("say /class""ChangeClass")
    
register_clcmd("say_team /class""ChangeClass")
    
register_clcmd("say /xp""ShowHud")
    
register_clcmd("say_team /xp""ShowHud")
}
public 
ChangeClass(id)
{
    new 
menu menu_create("Class Menu" "Class_Handle");
    
menu_additem(menu ,"Assault""1" 0);
    
menu_additem(menu ,"Spec Ops""2" 0);
    
menu_additem(menu ,"Heavy Gunner""3" 0);
    
menu_additem(menu ,"Demolitions""4" 0);
    
menu_additem(menu ,"Sniper""5" 0);
 
    
menu_setprop(menu MPROP_EXIT MEXIT_ALL);
 
    
menu_display(id menu 0);
 
    return 
PLUGIN_CONTINUE;
}
public 
Class_Handle(id menu item
{
    if(
item == MENU_EXIT
    {
 
        
menu_destroy(menu);
 
    }
 
    new 
szCommand[6] , szName[64];
    new 
access callback;
 
    
menu_item_getinfo(menu item access szCommand szName 63 callback);
 
    new 
str_to_num(szCommand)
    if(
PlayerClass[id] != i)
    {
        
PlayerClass[id] = i
        client_print
(id,print_chat,"You are now a %s",CLASSES[i])
    }
    else
    {
        
client_print(id,print_chat,"You are alredy a %s",CLASSES[i])
    }
    
menu_destroy(menu);
    return 
PLUGIN_CONTINUE
}
public 
msgStatusIcon(msgidmsgdestid)
{
    static 
szIcon[8];
    
get_msg_arg_string(2szIcon7);
 
    if(
equal(szIcon"buyzone") && get_msg_arg_int(1))
    {
        
set_pdata_int(id235get_pdata_int(id235) & ~(1<<0));
        return 
PLUGIN_HANDLED;
    }
 
    return 
PLUGIN_CONTINUE;
}
public 
eDeath(id
{
    new 
headshot read_data)
    new 
attacker read_data
    new 
clipammoweapon get_user_weapon(id,clip,ammo);
 
    
PlayerXP[attacker] += get_pcvar_num(XP_Kill)
 
    if(
headshot)
    
PlayerXP[attacker] += get_pcvar_num(XP_Hs)
 
    if(
weapon == CSW_KNIFE)
    
PlayerXP[attacker] += get_pcvar_num(XP_Knife)
 
 
    while(
PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]])
    {
        
PlayerLevel[attacker] += 1
        client_print
(attackerprint_chat"[COD Mod] Congratulations! You are a level %i %s!"PlayerLevel[attacker], CLASSES[PlayerClass[attacker]])
    }
    
ShowHud(attacker)
    
SaveData(attacker)
}
public 
ShowHud(id)
{
    
set_hudmessage(255000.750.0106.015.0)
    
show_hudmessage(id"Level: %i^nXP: %i^nClass: %s",PlayerLevel[id],PlayerXP[id],CLASSES[PlayerClass[id]])
}
public 
client_connect(id)
{
    if(
get_pcvar_num(SaveXP) == 1)
    {
 
        
LoadData(id)
    }
}
public 
client_disconnect(id)
{
    if(
get_pcvar_num(SaveXP) == 1)
    {
 
        
SaveData(id)
    }
    
PlayerXP[id] = 0
    PlayerLevel
[id] = 0
    PlayerClass
[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#",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-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

Here are the Ranks That I would Like to add:
PHP Code:
<Level><Rank><XP Needed>
 Private 
First Class 0
 2 
Private First Class I 30 
Private First Class II 120 
4 Lance Corporal 270 
5 Lance Corporal I 480 
6 Lance Corporal II 750 
7 Corporal 1080 
8 Corporal I 1470 
9 Corporal II 1920 
10 Sargeant 2430 
11 Sargeant I 3000 
12 Sargeant II 3650 
13 Staff Sargeant 4380 
14 Staff Sargeant I 5190 
15 Straff Sargeant II 6080
 16 Gunnery Sargeant 7050 
17 Gunnery Sargeant I 8100 
18 Gunnery Sargeant II 9230 
19 Master Sargeant 10440
 20 Master Sargeant I 11730
 21 Master Sargeant II 13100
 22 Master Gunnery Sergeant 14550 
23 Master Gunnery Sergeant I 16080 
24 Master Gunnery Sergeant II 17690
 25 2nd Lieutenant 19380 
26 2nd Lieutenant I 21150
 27 2nd Lieutenant II 23000 
28 1st Lieutenant 24930 
29 1st Lieutenant I 26940 
30 1st Lieutenant II 29030 
31 Captain 31240 
32Captain I 33570 
33Captain II 36020 
34Major 38590 
35 Major I 41280 
36 Major II 44090
 37 Lt
Colonel 47020
 38 Lt
Colonel I 50070
 39 Lt
Colonel II 53240
 40 Colonel 56530 
41 Colonel I 59940 
42Colonel II 63470 
43Brigadier General 67120
 44Brigadier General I 70890
 45Brigadier General II 74780 
46 Major General 78790
 47 Major General II 82920 
48 Major General II 87170 
49 Lieutenant General 91540
 50 Lieutenant General I 96030
 51 Lieutenant General II 100640 
52 General 105370
 53 General I 110220 
54 General II 115190 
55 Commander 120280 
Also I have another Request for help. For Each Class I cant figure out How to add the Weapons for each class. Or I should say rather where I shoulp Put it.
In My code it say for the class menu the Class_Handler Is this where I should set up for each class to give them the appropriate weapons?
__________________
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
linkosc is offline
Send a message via AIM to linkosc
JaGareN
Senior Member
Join Date: Mar 2009
Old 06-26-2010 , 17:41   Re: Adding Ranks to Each Level
Reply With Quote #2

wrong section. Try to post in Suggestions / Requests.
JaGareN is offline
linkosc
Senior Member
Join Date: Apr 2007
Location: Everywhere
Old 06-26-2010 , 19:32   Re: Adding Ranks to Each Level
Reply With Quote #3

Why would I post in Suggestions or requests? Im Not Suggesting anything and im not requesting any plugins im simply asking for help with a plugin i am creating. Thats Why I posted here in the Scripting help. I need help with How to script this into my plugin
__________________
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
linkosc is offline
Send a message via AIM to linkosc
JaGareN
Senior Member
Join Date: Mar 2009
Old 06-26-2010 , 20:52   Re: Adding Ranks to Each Level
Reply With Quote #4

Ok. I thought you was requesting. Sorry my bad...
JaGareN 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 14:49.


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