Raised This Month: $ Target: $400
 0% 

Call Of Duty Mod


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
linkosc
Senior Member
Join Date: Apr 2007
Location: Everywhere
Old 06-28-2010 , 19:26   Call Of Duty Mod
Reply With Quote #1

Hello everyone as you know I have been needing help for my new mod I am Creating. I decided instead of creating individual post to just start One thread for all the help I need lol. Anyway I have this mod its derived from the New Xp Mod Tutorial.

My First Problem is my classes. When a player chooses a class he recieves weapons and ammo. I dont want the player to be able to choose another class mid round because it will give him all new weapons and ammo. I need help so that he can choose another class but it wont change till next round. Cany anyone help me?

Here is my Plugins Code:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <fakemeta_util>
#include <fun>
#include <hamsandwich>
#include <nvault>
#define PLUGIN "COD4"
#define VERSION "1.0"
#define AUTHOR "<GT>LINK"
#define CLASS_NOTHING 0
#define CLASS_ASSUALT 1
#define CLASS_DEMO 4
#define CLASS_HEAVYG 3
#define CLASS_SNIPER 5
#define CLASS_SPECOPS 2
#define MAXCLASSES 6
#define MAXRANK 55
new PlayerRank[33]
new 
PlayerClass[33]
new 
PlayerXP[33]
new 
PlayerLevel[33]
new 
g_vault
new g_msgStatusIcon
new iPlayers[32]
new 
iNum
new const CLASSES[MAXCLASSES][] = {
 
"None",
 
"Assault",
 
"Spec Ops",
 
"Heavy Gunner",
 
"Demolitions",
 
"Sniper"
}
new const 
RANK[MAXRANK][] = {
 
"Private First Class",
 
"Private First Class I",
 
"Private First Class II"
 
"Lance Corporal"
 
"Lance Corporal I",
 
"Lance Corporal II"
 
"Corporal"
 
"Corporal I",
 
"Corporal II"
 
"Sargeant",
 
"Sargeant I"
 
"Sargeant II"
 
"Staff Sargeant"
 
"Staff Sargeant I"
 
"Straff Sargeant II",
 
"Gunnery Sargeant"
 
"Gunnery Sargeant I"
 
"Gunnery Sargeant II"
 
"Master Sargeant",
 
"Master Sargeant I",
 
"Master Sargeant II",
 
"Master Gunnery Sergeant"
 
"Master Gunnery Sergeant I"
 
"Master Gunnery Sergeant II",
 
"2nd Lieutenant",
 
"2nd Lieutenant I",
 
"2nd Lieutenant II"
 
"1st Lieutenant"
 
"1st Lieutenant I"
 
"1st Lieutenant II"
 
"Captain",
 
"Captain I"
 
"Captain II"
 
"Major"
 
"Major I"
 
"Major II",
 
"Lt. Colonel",
 
"Lt. Colonel I",
 
"Lt. Colonel II",
 
"Colonel",
 
"Colonel I"
 
"Colonel II"
 
"Brigadier General",
 
"Brigadier General I",
 
"Brigadier General II"
 
"Major General",
 
"Major General I"
 
"Major General II",
 
"Lieutenant General",
 
"Lieutenant General I",
 
"Lieutenant General II"
 
"General",
 
"General I"
 
"General II"
 
"Commander"
}
new 
msgtext
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
}
public 
plugin_init()
{
 
register_plugin(PLUGINVERSIONAUTHOR)
 
register_cvar("sv_cod4""1")
 
register_event("DeathMsg""DeathMsg""a"
 
register_cvar("XP_per_kill""30")
 
register_cvar("XP_Bomb""15")
 
register_cvar("XP_BDefuse""15")
 
register_cvar("XP_Xplode""20")
 
register_cvar("Min_players_XP""1")
 
register_cvar("XP_HS""10")
 
register_cvar("SaveXP","1")
 
register_menucmd(register_menuid("menu_ChooseClass"),1023,"DoChooseClass");
 
register_event("ResetHUD""ResetHud""b")
 
msgtext get_user_msgid("StatusText"
 
register_clcmd("say /changeclass""ChooseClass")
 
register_clcmd("say_team /changeclass""ChooseClass")
 
register_clcmd("say /class""ShowClass")
 
register_clcmd("say /rank""ShowRank")
 
g_vault nvault_open("cod4")
 
g_msgStatusIcon get_user_msgid("StatusIcon")
 
register_message(g_msgStatusIcon"msgStatusIcon")
RegisterHam(Ham_Spawn"player""HamPlayerSpawnPost"1)
}
public 
HamPlayerSpawnPost(id) {
 if(
is_user_alive(id) && PlayerClass[id] == CLASS_ASSUALT
 {
  
fm_strip_user_weapons(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_m4a1");
  
fm_give_item(id"ammo_556nato");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
 }
 if(
is_user_alive(id) && PlayerClass[id] == CLASS_SPECOPS)
 {
  
fm_strip_user_weapons(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_mp5navy");
  
fm_give_item(id"ammo_9mm");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
 }
 if(
is_user_alive(id) && PlayerClass[id] == CLASS_HEAVYG)
 {
  
fm_strip_user_weapons(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_m249");
  
fm_give_item(id"ammo_556natobox");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
 }
 if(
is_user_alive(id) && PlayerClass[id] == CLASS_DEMO)
 {
  
fm_strip_user_weapons(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_m3");
  
fm_give_item(id"ammo_buckshot");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
 }
 if(
is_user_alive(id) && PlayerClass[id] == CLASS_SNIPER)
 {
  
fm_strip_user_weapons(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_scout");
  
fm_give_item(id"ammo_762nato");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
 }
}
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 
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#%i#",PlayerXP[id],PlayerLevel[id],PlayerRank[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#%i#",PlayerXP[id],PlayerLevel[id],PlayerRank[id])
    
nvault_get(g_vault,vaultkey,vaultdata,255)
 
    
replace_all(vaultdata255"#"" ")
 
    new 
playerxp[32], playerlevel[32], playerrank[32];
 
    
parse(vaultdataplayerxp31playerlevel31)
 
    
PlayerXP[id] = str_to_num(playerxp)
    
PlayerLevel[id] = str_to_num(playerlevel)
    
PlayerRank[id] = str_to_num(playerrank)
 
    return 
PLUGIN_CONTINUE
}
public 
client_connect(id)
{
    if(
get_cvar_num("SaveXP") == 1) {
       
         
LoadData(id)
         
client_print(idprint_chat"[Call of Duty 4] XP Loaded!")
         
client_print(idprint_chat"[Call of Duty 4] You are a %s with level %s and %s XP"PlayerClass[id], PlayerLevel[id], PlayerXP[id], PlayerRank[id])
    }
}
public 
client_disconnect(id)
{
    if(
get_cvar_num("SaveXP") == 1) {
    
         
SaveData(id)
    }
}
public 
ChooseClass(id)
{    
    new 
menu[] = "Call Of Duty 4: Choose Class^n^n1. Assault^n2. Spec Ops^n3. Heavy Gunner^n4. Demolitions^n5. Sniper";
    new 
keys MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5;
    
show_menu(idkeysmenu, -1"menu_ChooseClass")    
    return 
PLUGIN_CONTINUE
}
public 
DoChooseClass(idkey)
{
    if(
key == 0) {
       
         if(
PlayerClass[id] == CLASS_ASSUALT) {
         
              
client_print(idprint_chat"[Call of Duty 4] You are allready a Assault! Choose something else!")
              
ChooseClass(id)           
              return 
PLUGIN_HANDLED
         
}        
  
PlayerClass[id] = CLASS_ASSUALT
  fm_strip_user_weapons
(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_m4a1");
  
fm_give_item(id"ammo_556nato");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
  
client_print(idprint_chat"[Call of Duty 4] You are now Assault Class!")
    }        
         
    if(
key == 3) {
         
         if(
PlayerClass[id] == CLASS_DEMO) {
              
              
client_print(idprint_chat"[Call of Duty 4] You are allready Demolitions! Choose something else!")
              
ChooseClass(id)
              return 
PLUGIN_HANDLED
         
}
                   
  
PlayerClass[id] = CLASS_DEMO
  fm_strip_user_weapons
(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_m3");
  
fm_give_item(id"ammo_buckshot");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
  
client_print(idprint_chat"[Call of Duty 4] You are now Demolitions!")
    }
    
    if(
key == 2) {
         
         if(
PlayerClass[id] == CLASS_HEAVYG) {
              
              
client_print(idprint_chat"[Call of Duty 4] You are allready a Heavy Gunner! Choose something else!")
              
ChooseClass(id)
              return 
PLUGIN_HANDLED
         
}
                   
  
PlayerClass[id] = CLASS_HEAVYG
  fm_strip_user_weapons
(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_m249");
  
fm_give_item(id"ammo_556natobox");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
  
client_print(idprint_chat"[Call of Duty 4] You are now a Heavy Gunner!")
    }    
    if(
key == 4) {
         
         if(
PlayerClass[id] == CLASS_SNIPER) {
              
              
client_print(idprint_chat"[Call of Duty 4] You are allready a Sniper! Choose something else!")
              
ChooseClass(id)
              return 
PLUGIN_HANDLED
         
}
                   
  
PlayerClass[id] = CLASS_SNIPER
  fm_strip_user_weapons
(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_scout");
  
fm_give_item(id"ammo_762nato");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
  
client_print(idprint_chat"[Call of Duty 4] You are now a Sniper!")
    }
    
    if(
key == 1) {
     
 if(
PlayerClass[id] == CLASS_SPECOPS) {
  
client_print(idprint_chat"[Call of Duty 4] You are allready Spec Ops! Choose something else!")
  
ChooseClass(id)
  return 
PLUGIN_HANDLED
 
}
 
  
PlayerClass[id] = CLASS_SPECOPS
  fm_strip_user_weapons
(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_mp5navy");
  
fm_give_item(id"ammo_9mm");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
  
client_print(idprint_chat"[Call of Duty 4] You are now Spec Ops!")
    }
get_playersiPlayersiNum )
new 
id
for( new 0iNumi++ )
{
    
id iPlayers[i]
    if( 
is_user_aliveid ) && cs_get_user_teamid ) == CS_TEAM_T )
    {
        
give_itemid"weapon_c4" )
        break;
    }
}
if( 
is_user_aliveid ) && cs_get_weapon_idid ) == CSW_C4 )
    {
        
cs_set_user_plant(id11)
    }
}
public 
ResetHud(id)
{
    if(
PlayerClass[id] == CLASS_NOTHING) {
    
         
ChooseClass(id)
         return 
PLUGIN_HANDLED
    
}
 
    return 
PLUGIN_HANDLED
}
public 
DeathMsg()
{
    if(
get_cvar_num("sv_cod4") == 0) {
         return 
PLUGIN_HANDLED
    
}
    if(
get_playersnum() < get_cvar_num("Min_players_XP"))
    {
     return 
0;
    }
    new 
attacker read_data(1)
    new 
headshot read_data(3)
    
    if(
PlayerClass[attacker] == CLASS_NOTHING) {
         return 
PLUGIN_HANDLED
    
}
    
    if(
PlayerLevel[attacker] == 50) {
         return 
PLUGIN_HANDLED
    
}
            
    
PlayerXP[attacker] += get_cvar_num("XP_per_kill")
    
    if(
headshot)
    
PlayerXP[attacker] += get_cvar_num("XP_HS")
    
    if(
PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]]) {
     
         
PlayerLevel[attacker] += 1
         
         client_print
(attackerprint_chat"[Call of Duty 4] Congratulations! You are now level %i!"PlayerLevel[attacker])
         if(
get_cvar_num("SaveXP") == 1) {
 
              
SaveData(attacker)
         }
         
         
ShowHUD(attacker)
    }   
    
    
ShowHUD(attacker)
    
    return 
PLUGIN_CONTINUE
}
public 
ShowHUD(id)    

    new 
HUD[51]
    
format(HUD50"[%s]Level: %i XP: %i"RANK[PlayerClass[id]], PlayerLevel[id], PlayerXP[id], PlayerRank[id]) 
    
message_begin(MSG_ONEmsgtext, {0,0,0}, id
    
write_byte(0
    
write_string(HUD
    
message_end() 
    return 
PLUGIN_CONTINUE
}
public 
ShowClass(id)
{
 new 
HUDS[61]
 
format(HUDS60"[%s]Level: %i XP: %i"CLASSES[PlayerClass[id]], PlayerLevel[id], PlayerXP[id], PlayerRank[id])
 
 
message_begin(MSG_ONEmsgtext, {0,0,0}, id)
 
write_byte(0)
 
write_string(HUDS)
 
message_end()
 return 
PLUGIN_CONTINUE
}
public 
ShowRank(id)
{
 new 
HUDD[71]
 
format(HUDD70"[%s]Level: %i XP: %i"RANK[PlayerClass[id]], PlayerLevel[id], PlayerXP[id], PlayerRank[id])
 
 
message_begin(MSG_ONEmsgtext, {0,0,0}, id)
 
write_byte(0)
 
write_string(HUDD)
 
message_end()
 return 
PLUGIN_HANDLED

__________________
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
linkosc is offline
Send a message via AIM to linkosc
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 06-28-2010 , 19:54   Re: Call Of Duty Mod
Reply With Quote #2

Can you first just clean up the code you posted? With proper indentation and give space to different functions.. it's going to give me a headache.
__________________
Hi.
Kreation is offline
linkosc
Senior Member
Join Date: Apr 2007
Location: Everywhere
Old 06-28-2010 , 21:11   Re: Call Of Duty Mod
Reply With Quote #3

Hey man sorry bout that here ya go. When I compile it says
DoChooseClass should return a value - just a warning

Code:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <fakemeta_util>
#include <fun>
#include <hamsandwich>
#include <nvault>

/*#include "cod4/Menu.inl"*/

#define PLUGIN "COD4"
#define VERSION "1.0"
#define AUTHOR "<GT>LINK"

#define CLASS_NOTHING 0
#define CLASS_ASSUALT 1
#define CLASS_DEMO 4
#define CLASS_HEAVYG 3
#define CLASS_SNIPER 5
#define CLASS_SPECOPS 2
#define MAXCLASSES 6
#define MAXRANK 55

new PlayerRank[33]
new 
PlayerClass[33]
new 
PlayerXP[33]
new 
PlayerLevel[33]
new 
g_vault
new g_msgStatusIcon
new iPlayers[32]
new 
iNum

new const CLASSES[MAXCLASSES][] = {
 
"None",
 
"Assault",
 
"Spec Ops",
 
"Heavy Gunner",
 
"Demolitions",
 
"Sniper"
}

new const 
RANK[MAXRANK][] = {
 
"Private First Class",
 
"Private First Class I",
 
"Private First Class II"
 
"Lance Corporal"
 
"Lance Corporal I",
 
"Lance Corporal II"
 
"Corporal"
 
"Corporal I",
 
"Corporal II"
 
"Sargeant",
 
"Sargeant I"
 
"Sargeant II"
 
"Staff Sargeant"
 
"Staff Sargeant I"
 
"Straff Sargeant II",
 
"Gunnery Sargeant"
 
"Gunnery Sargeant I"
 
"Gunnery Sargeant II"
 
"Master Sargeant",
 
"Master Sargeant I",
 
"Master Sargeant II",
 
"Master Gunnery Sergeant"
 
"Master Gunnery Sergeant I"
 
"Master Gunnery Sergeant II",
 
"2nd Lieutenant",
 
"2nd Lieutenant I",
 
"2nd Lieutenant II"
 
"1st Lieutenant"
 
"1st Lieutenant I"
 
"1st Lieutenant II"
 
"Captain",
 
"Captain I"
 
"Captain II"
 
"Major"
 
"Major I"
 
"Major II",
 
"Lt. Colonel",
 
"Lt. Colonel I",
 
"Lt. Colonel II",
 
"Colonel",
 
"Colonel I"
 
"Colonel II"
 
"Brigadier General",
 
"Brigadier General I",
 
"Brigadier General II"
 
"Major General",
 
"Major General I"
 
"Major General II",
 
"Lieutenant General",
 
"Lieutenant General I",
 
"Lieutenant General II"
 
"General",
 
"General I"
 
"General II"
 
"Commander"
}

new 
msgtext

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
}

public 
plugin_init() {
 
 
register_plugin(PLUGINVERSIONAUTHOR)
 
 
register_cvar("sv_cod4""1")
 
 
register_event("DeathMsg""DeathMsg""a")
 
 
register_cvar("XP_per_kill""30"
 
register_cvar("XP_Bomb""15"
 
register_cvar("XP_BDefuse""15"
 
register_cvar("XP_Xplode""20"
 
register_cvar("Min_players_XP""1"
 
register_cvar("XP_HS""10"
 
register_cvar("SaveXP","1")
 
g_vault nvault_open("cod4")
 
 
register_menucmd(register_menuid("menu_ChooseClass"),1023,"DoChooseClass"); 
 
register_event("ResetHUD""ResetHud""b"
 
msgtext get_user_msgid("StatusText"
 
g_msgStatusIcon get_user_msgid("StatusIcon")
 
register_message(g_msgStatusIcon"msgStatusIcon")
 
RegisterHam(Ham_Spawn"player""HamPlayerSpawnPost"1)
 
register_clcmd("say /changeclass""ChooseClass")
 
register_clcmd("say_team /changeclass""ChooseClass")
 
register_clcmd("say /class""ShowClass")
 
register_clcmd("say /rank""ShowRank")
 }
public 
HamPlayerSpawnPost(id) {
 if(
is_user_alive(id) && PlayerClass[id] == CLASS_ASSUALT) {
  
  
fm_strip_user_weapons(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_m4a1");
  
fm_give_item(id"ammo_556nato");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
  
 }
 
 if(
is_user_alive(id) && PlayerClass[id] == CLASS_SPECOPS) {
  
  
fm_strip_user_weapons(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_mp5navy");
  
fm_give_item(id"ammo_9mm");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
  
 }
 
 if(
is_user_alive(id) && PlayerClass[id] == CLASS_HEAVYG) {
  
  
fm_strip_user_weapons(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_m249");
  
fm_give_item(id"ammo_556natobox");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
  
 }
 
 if(
is_user_alive(id) && PlayerClass[id] == CLASS_DEMO) {
  
  
fm_strip_user_weapons(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_m3");
  
fm_give_item(id"ammo_buckshot");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
  
 }
 
 if(
is_user_alive(id) && PlayerClass[id] == CLASS_SNIPER) {
  
  
fm_strip_user_weapons(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_scout");
  
fm_give_item(id"ammo_762nato");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
  
 }
 
}

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 
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#%i#",PlayerXP[id],PlayerLevel[id],PlayerRank[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#%i#",PlayerXP[id],PlayerLevel[id],PlayerRank[id])
 
nvault_get(g_vault,vaultkey,vaultdata,255)
 
 
replace_all(vaultdata255"#"" ")
 
 new 
playerxp[32], playerlevel[32], playerrank[32];
 
 
parse(vaultdataplayerxp31playerlevel31)
 
 
PlayerXP[id] = str_to_num(playerxp)
 
PlayerLevel[id] = str_to_num(playerlevel)
 
PlayerRank[id] = str_to_num(playerrank)
 
 return 
PLUGIN_CONTINUE
}

public 
client_connect(id) {
 
 if(
get_cvar_num("SaveXP") == 1) {
  
       
  
LoadData(id)
  
client_print(idprint_chat"[Call of Duty 4] XP Loaded!")
  
client_print(idprint_chat"[Call of Duty 4] You are a %s with level %s and %s XP"PlayerClass[id], PlayerLevel[id], PlayerXP[id], PlayerRank[id])
 }
    
}

public 
client_disconnect(id) {
 
 if(
get_cvar_num("SaveXP") == 1) {
  
    
  
SaveData(id)
 }
}

public 
ResetHud(id) {
 
 if(
PlayerClass[id] == CLASS_NOTHING) {
  
    
  
ChooseClass(id)
  return 
PLUGIN_HANDLED
 
}
 
 return 
PLUGIN_HANDLED
}

public 
DeathMsg() {
 
 if(
get_cvar_num("sv_cod4") == 0) {
  
  return 
PLUGIN_HANDLED
 
}
 
 if(
get_playersnum() < get_cvar_num("Min_players_XP")) {
  
 return 
0;
}
 new 
attacker read_data(1)
 new 
headshot read_data(3)
 
 if(
PlayerClass[attacker] == CLASS_NOTHING) {
  return 
PLUGIN_HANDLED
 
}
 if(
PlayerLevel[attacker] == 50) {
  return 
PLUGIN_HANDLED
 
}
 
 
PlayerXP[attacker] += get_cvar_num("XP_per_kill")
 if(
headshot)
 
PlayerXP[attacker] += get_cvar_num("XP_HS")
 if(
PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]]) {
  
PlayerLevel[attacker] += 1
  client_print
(attackerprint_chat"[Call of Duty 4] Congratulations! You are now level %i!"PlayerLevel[attacker])
  if(
get_cvar_num("SaveXP") == 1) {
   
SaveData(attacker)
  }
  
  
ShowHUD(attacker)
 }
 
 
ShowHUD(attacker)
 return 
PLUGIN_CONTINUE
}

public 
ShowHUD(id) {
  
 new 
HUD[51]
 
format(HUD50"[%s]Level: %i XP: %i"RANK[PlayerClass[id]], PlayerLevel[id], PlayerXP[id], PlayerRank[id]) 
 
message_begin(MSG_ONEmsgtext, {0,0,0}, id
 
write_byte(0
 
write_string(HUD
 
message_end() 
 return 
PLUGIN_CONTINUE
}

public 
ShowClass(id) {
 
 new 
HUDS[61]
 
format(HUDS60"[%s]Level: %i XP: %i"CLASSES[PlayerClass[id]], PlayerLevel[id], PlayerXP[id], PlayerRank[id])
 
 
message_begin(MSG_ONEmsgtext, {0,0,0}, id)
 
write_byte(0)
 
write_string(HUDS)
 
message_end()
 return 
PLUGIN_CONTINUE
}

public 
ShowRank(id) {
 
 new 
HUDD[71]
 
format(HUDD70"[%s]Level: %i XP: %i"RANK[PlayerClass[id]], PlayerLevel[id], PlayerXP[id], PlayerRank[id])
 
 
message_begin(MSG_ONEmsgtext, {0,0,0}, id)
 
write_byte(0)
 
write_string(HUDD)
 
message_end()
 return 
PLUGIN_HANDLED
}

public 
ChooseClass(id) {
     
 new 
menu[] = "Call Of Duty 4: Choose Class^n^n1. Assault^n2. Spec Ops^n3. Heavy Gunner^n4. Demolitions^n5. Sniper";
 new 
keys MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5;
 
show_menu(idkeysmenu, -1"menu_ChooseClass")    
 return 
PLUGIN_CONTINUE
}

public 
DoChooseClass(idkey) {
 
 if(
key == 0) {
  
       
  if(
PlayerClass[id] == CLASS_ASSUALT) {
   
   
client_print(idprint_chat"[Call of Duty 4] You are allready a Assault! Choose something else!")
   
ChooseClass(id)           
   return 
PLUGIN_HANDLED
  
}
  
  
PlayerClass[id] = CLASS_ASSUALT
  fm_strip_user_weapons
(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_m4a1");
  
fm_give_item(id"ammo_556nato");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
  
client_print(idprint_chat"[Call of Duty 4] You are now Assault Class!")
 }
       
         
 if(
key == 3) {
  
         
  if(
PlayerClass[id] == CLASS_DEMO) {              
   
client_print(idprint_chat"[Call of Duty 4] You are allready Demolitions! Choose something else!")
   
ChooseClass(id)
   return 
PLUGIN_HANDLED
  
}
  
  
PlayerClass[id] = CLASS_DEMO
  fm_strip_user_weapons
(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_m3");
  
fm_give_item(id"ammo_buckshot");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
  
client_print(idprint_chat"[Call of Duty 4] You are now Demolitions!")
 }
 
    
 if(
key == 2) {
  if(
PlayerClass[id] == CLASS_HEAVYG) {
   
client_print(idprint_chat"[Call of Duty 4] You are allready a Heavy Gunner! Choose something else!")
   
ChooseClass(id)
   return 
PLUGIN_HANDLED
  
}
                   
  
PlayerClass[id] = CLASS_HEAVYG
  fm_strip_user_weapons
(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_m249");
  
fm_give_item(id"ammo_556natobox");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
  
client_print(idprint_chat"[Call of Duty 4] You are now a Heavy Gunner!")
 }
 
 if(
key == 4) {
  if(
PlayerClass[id] == CLASS_SNIPER) {
   
client_print(idprint_chat"[Call of Duty 4] You are allready a Sniper! Choose something else!")
   
ChooseClass(id)
   return 
PLUGIN_HANDLED
  
}
  
  
PlayerClass[id] = CLASS_SNIPER
  fm_strip_user_weapons
(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_scout");
  
fm_give_item(id"ammo_762nato");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
  
client_print(idprint_chat"[Call of Duty 4] You are now a Sniper!")
 }
 
 if(
key == 1) {
  if(
PlayerClass[id] == CLASS_SPECOPS) {
   
client_print(idprint_chat"[Call of Duty 4] You are allready Spec Ops! Choose something else!")
   
ChooseClass(id)
   return 
PLUGIN_HANDLED
  
}
  
  
PlayerClass[id] = CLASS_SPECOPS
  fm_strip_user_weapons
(id);
  
fm_give_item(id"weapon_knife");
  
fm_give_item(id"weapon_mp5navy");
  
fm_give_item(id"ammo_9mm");
  
fm_give_item(id"weapon_glock18");
  
fm_give_item(id"ammo_9mm");
  
client_print(idprint_chat"[Call of Duty 4] You are now Spec Ops!")
 }
 
get_playersiPlayersiNum )
 new 
id
 
for( new 0iNumi++ ) {
  
id iPlayers[i]
  if( 
is_user_aliveid ) && cs_get_user_teamid ) == CS_TEAM_T ) {
   
give_itemid"weapon_c4" )
   break;
  }
 }
 if( 
is_user_aliveid ) && cs_get_weapon_idid ) == CSW_C4 ) {
  
cs_set_user_plant(id11)
 }

__________________
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
linkosc is offline
Send a message via AIM to linkosc
Old 06-28-2010, 21:21
drekes
This message has been deleted by drekes. Reason: nvm
Old 06-28-2010, 22:04
Kreation
This message has been deleted by Kreation. Reason: wrong in the head.
JaGareN
Senior Member
Join Date: Mar 2009
Old 06-28-2010 , 22:06   Re: Call Of Duty Mod
Reply With Quote #6

return PLUGIN_HANDLED; at the end of DoChooseClass function.

Edit: @Kreation ops, didnt see your post. My web browser was going slowley.
He have used the "return PLUGIN_HANDLED" in the function so i think it's return PLUGIN_HANDLED he should return not PLUGIN_CONTINUE.

Edit 2: @linkosc Your code still not clearly.

Last edited by JaGareN; 06-28-2010 at 22:13.
JaGareN is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-28-2010 , 23:38   Re: Call Of Duty Mod
Reply With Quote #7

Quote:
Originally Posted by JaGareN View Post
Edit: @Kreation ops, didnt see your post. My web browser was going slowley.
He have used the "return PLUGIN_HANDLED" in the function so i think it's return PLUGIN_HANDLED he should return not PLUGIN_CONTINUE.
The return value doesn't matter in this case. You can return any value you want, it won't effect the way the code operates.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Old 06-29-2010, 09:20
JaGareN
This message has been deleted by JaGareN. Reason: didnt read your post good.
linkosc
Senior Member
Join Date: Apr 2007
Location: Everywhere
Old 06-28-2010 , 22:18   Re: Call Of Duty Mod
Reply With Quote #9

What is not clear about my code? SPaced everything out it is toatly readable
__________________
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
linkosc is offline
Send a message via AIM to linkosc
linkosc
Senior Member
Join Date: Apr 2007
Location: Everywhere
Old 06-28-2010 , 22:20   Re: Call Of Duty Mod
Reply With Quote #10

Im still new at coding so correct me where im wrong.
__________________
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
linkosc is offline
Send a message via AIM to linkosc
Reply


Thread Tools
Display Modes

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:53.


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