Raised This Month: $ Target: $400
 0% 

[HELP] XpMOD


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 03-26-2014 , 14:55   [HELP] XpMOD
Reply With Quote #1

can someone Add for this Code > Spec name?
I look at someone, then it will show me the
Name: Level | Exp


As it shows mine I'm living.
PHP Code:
#include <amxmodx>
#include <fvault>
#include <ColorChat>

new const g_vault_name[] = "EXP_MOD";
new const 
g_vault_lvl[] = "LVL_MOD";
new const 
LEVELS[7] = {
    
30//lvl 0 
    
80//lvl 1
    
220//lvl 2
    
370//lvl 3
    
600//lvl 4
    
1500//lvl 5
    
5000 //lvl 6
}

new 
g_exp[33],g_lvl[33];
new 
XP_Kill,XP_Knife,XP_Hs,syncObj

public plugin_init()
{
    
register_plugin("XpMod""1.0""JustGo")
    
register_event("DeathMsg""eDeath""a")
    
XP_Kill=register_cvar("XP_per_kill""2")
    
XP_Hs=register_cvar("XP_hs_bonus","3")
    
XP_Knife=register_cvar("XP_knife_bonus","3")
    
syncObj CreateHudSyncObj()
}

public 
eDeath() //function name 

    
// Create a variable to store the attacker's id
    
new attacker read_data)
    
// We create the victim variable, so that this function can check 
    // if a player was killed 
    
new iVictim read_data)
    
// If a player was killed by a HeadShot, this will be used for the cvar Xp_Hs
    
new headshot read_data)
    if(
attacker == iVictim)
    {
        return 
PLUGIN_HANDLED
    
}
    
//which weapon was used
    
new clipammoweapon get_user_weapon(attacker,clip,ammo); 
    
// used for the xp_hs cvar 
    // it checks if the victim was killed by a headshot 
    
if(headshot
    {
    
g_exp[attacker] += get_pcvar_num(XP_Hs
    }
    else if(
weapon == CSW_KNIFE
    { 
    
g_exp[attacker] += get_pcvar_num(XP_Knife)    
    }
    else
    {
        
g_exp[attacker] += get_pcvar_num(XP_Kill)
    }
    while(
g_exp[attacker] >= LEVELS[g_lvl[attacker]]) 
    {
        
g_lvl[attacker] += 
        ColorChat
(attackerNORMAL"^4[Nex] ^4Congratulations! ^1You are level^3 %i "g_lvl[attacker]) 
    }
    
SaveExp(attacker)
    return 
PLUGIN_HANDLED
}  

public 
show(id

    
set_hudmessage(02550, -1.00.906.012.0
    
ShowSyncHudMsg(id,syncObj"[ Level: %i| Exp: %i/%i]",g_lvl[id],g_exp[id],LEVELS[g_lvl[id]]) 
}

public 
client_putinserver(plr)
{
    if( !
is_user_hltv(plr) && !is_user_bot(plr) )
    {
        
LoadExp(plr);
    }
    
set_task(1.0"show"plr__"b")
}

public 
client_disconnect(plr)
{
    if( 
g_exp[plr] > )
    {
        
SaveExp(plr);
        
        
g_exp[plr] = 0;
    }
}

SaveExp(plr)
{
    new 
authid[35];
    
get_user_authid(plrauthidsizeof(authid) - 1);
    new 
data2[16];
    
num_to_str(g_lvl[plr], data2sizeof(data2) - 1);
    
    
fvault_set_data(g_vault_lvlauthiddata2);
    new 
data[16];
    
num_to_str(g_exp[plr], datasizeof(data) - 1);
    
    
fvault_set_data(g_vault_nameauthiddata);
}

LoadExp(plr)
{
    new 
authid[35];
    
get_user_authid(plrauthidsizeof(authid) - 1);
    new 
data2[16];
    if( 
fvault_get_data(g_vault_lvlauthiddata2sizeof(data2) - 1) )
    {
        
g_lvl[plr] = str_to_num(data2);
    }
    else
    {
        
g_lvl[plr] = 0;
    }
    new 
data[16];
    if( 
fvault_get_data(g_vault_nameauthiddatasizeof(data) - 1) )
    {
        
g_exp[plr] = str_to_num(data);
    }
    else
    {
        
g_exp[plr] = 0;
    }


Last edited by Snitch; 03-26-2014 at 14:59.
Snitch is offline
Send a message via Skype™ to Snitch
Buckshot
Senior Member
Join Date: Mar 2014
Location: Sweden
Old 03-27-2014 , 23:02   Re: [HELP] XpMOD
Reply With Quote #2

PHP Code:
new target,body;
new 
szName32 ]
get_user_aimingidtargetbody )
get_user_nametargetszNamecharsmaxszName ) )

if( 
target )
{
    
set_hudmessage02550, -1.00.906.012.0 
    
show_hudmessageid"Name: %s | Level: %i | Exp: %i/%i"szNameg_lvlid ], g_expid ] ); 

Like this?
__________________
PM me for private work.



Last edited by Buckshot; 03-27-2014 at 23:10.
Buckshot is offline
Send a message via Skype™ to Buckshot
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 03-28-2014 , 07:50   Re: [HELP] XpMOD
Reply With Quote #3

Quote:
Originally Posted by Buckshot View Post
PHP Code:
new target,body;
new 
szName32 ]
get_user_aimingidtargetbody )
get_user_nametargetszNamecharsmaxszName ) )

if( 
target )
{
    
set_hudmessage02550, -1.00.906.012.0 
    
show_hudmessageid"Name: %s | Level: %i | Exp: %i/%i"szNameg_lvlid ], g_expid ] ); 

Like this?
Code:
public show(id) 
{ 
    new target,body;
    new szName[ 32 ]
    get_user_aiming( id, target, body )
    get_user_name( target, szName, charsmax( szName ) )

    if( target > 0 )
    {
    set_hudmessage( 0, 255, 0, -1.0, 0.9, 0, 6.0, 12.0 ) 
    show_hudmessage( id, "Name: %s | Level: %i | Exp: %i/%i", szName, g_lvl[ id ], g_exp[ id ] ); 
    }  
}
but if someone look at me he see the name and my exp and level?

Last edited by Snitch; 03-28-2014 at 07:52.
Snitch is offline
Send a message via Skype™ to Snitch
Buckshot
Senior Member
Join Date: Mar 2014
Location: Sweden
Old 03-28-2014 , 07:58   Re: [HELP] XpMOD
Reply With Quote #4

PHP Code:
#include <amxmodx>
#include <fvault>
#include <ColorChat>

new const g_vault_name[] = "EXP_MOD";
new const 
g_vault_lvl[] = "LVL_MOD";
new const 
LEVELS[7] = {
    
30//lvl 0 
    
80//lvl 1
    
220//lvl 2
    
370//lvl 3
    
600//lvl 4
    
1500//lvl 5
    
5000 //lvl 6
}

new 
g_exp[33],g_lvl[33];
new 
XP_Kill,XP_Knife,XP_Hs,syncObj

public plugin_init()
{
    
register_plugin("XpMod""1.0""JustGo")
    
register_event("DeathMsg""eDeath""a")
    
XP_Kill=register_cvar("XP_per_kill""2")
    
XP_Hs=register_cvar("XP_hs_bonus","3")
    
XP_Knife=register_cvar("XP_knife_bonus","3")
    
syncObj CreateHudSyncObj()
}

public 
eDeath() //function name 

    
// Create a variable to store the attacker's id
    
new attacker read_data)
    
// We create the victim variable, so that this function can check 
    // if a player was killed 
    
new iVictim read_data)
    
// If a player was killed by a HeadShot, this will be used for the cvar Xp_Hs
    
new headshot read_data)
    if(
attacker == iVictim)
    {
        return 
PLUGIN_HANDLED
    
}
    
//which weapon was used
    
new clipammoweapon get_user_weapon(attacker,clip,ammo); 
    
// used for the xp_hs cvar 
    // it checks if the victim was killed by a headshot 
    
if(headshot
    {
    
g_exp[attacker] += get_pcvar_num(XP_Hs
    }
    else if(
weapon == CSW_KNIFE
    { 
    
g_exp[attacker] += get_pcvar_num(XP_Knife)    
    }
    else
    {
        
g_exp[attacker] += get_pcvar_num(XP_Kill)
    }
    while(
g_exp[attacker] >= LEVELS[g_lvl[attacker]]) 
    {
        
g_lvl[attacker] += 
        ColorChat
(attackerNORMAL"^4[Nex] ^4Congratulations! ^1You are level^3 %i "g_lvl[attacker]) 
    }
    
SaveExp(attacker)
    return 
PLUGIN_HANDLED
}  

public 
show(id
{
    new 
target[32],body;
    new 
szName32 ]
    
get_user_aimingidtargetbody )
    
get_user_nametargetszNamecharsmaxszName ) )
    
set_hudmessage(02550, -1.00.906.012.0)
    if( 
target )
    {
        
ShowSyncHudMsg(id,syncObj"Name: %s | Level: %i | Exp: %i/%i"szNameg_lvltarget ], g_exptarget ], LEVELS[g_lvltarget ]])
    }
}

public 
client_putinserver(plr)
{
    if( !
is_user_hltv(plr) && !is_user_bot(plr) )
    {
        
LoadExp(plr);
    }
    
set_task(1.0"show"plr__"b")
}

public 
client_disconnect(plr)
{
    if( 
g_exp[plr] > )
    {
        
SaveExp(plr);
        
        
g_exp[plr] = 0;
    }
}

SaveExp(plr)
{
    new 
authid[35];
    
get_user_authid(plrauthidsizeof(authid) - 1);
    new 
data2[16];
    
num_to_str(g_lvl[plr], data2sizeof(data2) - 1);
    
    
fvault_set_data(g_vault_lvlauthiddata2);
    new 
data[16];
    
num_to_str(g_exp[plr], datasizeof(data) - 1);
    
    
fvault_set_data(g_vault_nameauthiddata);
}

LoadExp(plr)
{
    new 
authid[35];
    
get_user_authid(plrauthidsizeof(authid) - 1);
    new 
data2[16];
    if( 
fvault_get_data(g_vault_lvlauthiddata2sizeof(data2) - 1) )
    {
        
g_lvl[plr] = str_to_num(data2);
    }
    else
    {
        
g_lvl[plr] = 0;
    }
    new 
data[16];
    if( 
fvault_get_data(g_vault_nameauthiddatasizeof(data) - 1) )
    {
        
g_exp[plr] = str_to_num(data);
    }
    else
    {
        
g_exp[plr] = 0;
    }

Try this.. I do not know if it compiles at all since i don't have the fvault include.. But hopefully it works
__________________
PM me for private work.



Last edited by Buckshot; 03-28-2014 at 08:09.
Buckshot is offline
Send a message via Skype™ to Buckshot
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 03-28-2014 , 08:21   Re: [HELP] XpMOD
Reply With Quote #5

Quote:
Originally Posted by Buckshot View Post
PHP Code:
#include <amxmodx>
#include <fvault>
#include <ColorChat>

new const g_vault_name[] = "EXP_MOD";
new const 
g_vault_lvl[] = "LVL_MOD";
new const 
LEVELS[7] = {
    
30//lvl 0 
    
80//lvl 1
    
220//lvl 2
    
370//lvl 3
    
600//lvl 4
    
1500//lvl 5
    
5000 //lvl 6
}

new 
g_exp[33],g_lvl[33];
new 
XP_Kill,XP_Knife,XP_Hs,syncObj

public plugin_init()
{
    
register_plugin("XpMod""1.0""JustGo")
    
register_event("DeathMsg""eDeath""a")
    
XP_Kill=register_cvar("XP_per_kill""2")
    
XP_Hs=register_cvar("XP_hs_bonus","3")
    
XP_Knife=register_cvar("XP_knife_bonus","3")
    
syncObj CreateHudSyncObj()
}

public 
eDeath() //function name 

    
// Create a variable to store the attacker's id
    
new attacker read_data)
    
// We create the victim variable, so that this function can check 
    // if a player was killed 
    
new iVictim read_data)
    
// If a player was killed by a HeadShot, this will be used for the cvar Xp_Hs
    
new headshot read_data)
    if(
attacker == iVictim)
    {
        return 
PLUGIN_HANDLED
    
}
    
//which weapon was used
    
new clipammoweapon get_user_weapon(attacker,clip,ammo); 
    
// used for the xp_hs cvar 
    // it checks if the victim was killed by a headshot 
    
if(headshot
    {
    
g_exp[attacker] += get_pcvar_num(XP_Hs
    }
    else if(
weapon == CSW_KNIFE
    { 
    
g_exp[attacker] += get_pcvar_num(XP_Knife)    
    }
    else
    {
        
g_exp[attacker] += get_pcvar_num(XP_Kill)
    }
    while(
g_exp[attacker] >= LEVELS[g_lvl[attacker]]) 
    {
        
g_lvl[attacker] += 
        ColorChat
(attackerNORMAL"^4[Nex] ^4Congratulations! ^1You are level^3 %i "g_lvl[attacker]) 
    }
    
SaveExp(attacker)
    return 
PLUGIN_HANDLED
}  

public 
show(id
{
    new 
target[32],body;
    new 
szName32 ]
    
get_user_aimingidtargetbody )
    
get_user_nametargetszNamecharsmaxszName ) )
    
set_hudmessage(02550, -1.00.906.012.0)
    if( 
target )
    {
        
ShowSyncHudMsg(id,syncObj"Name: %s | Level: %i | Exp: %i/%i"szNameg_lvltarget ], g_exptarget ], LEVELS[g_lvltarget ]])
    }
}

public 
client_putinserver(plr)
{
    if( !
is_user_hltv(plr) && !is_user_bot(plr) )
    {
        
LoadExp(plr);
    }
    
set_task(1.0"show"plr__"b")
}

public 
client_disconnect(plr)
{
    if( 
g_exp[plr] > )
    {
        
SaveExp(plr);
        
        
g_exp[plr] = 0;
    }
}

SaveExp(plr)
{
    new 
authid[35];
    
get_user_authid(plrauthidsizeof(authid) - 1);
    new 
data2[16];
    
num_to_str(g_lvl[plr], data2sizeof(data2) - 1);
    
    
fvault_set_data(g_vault_lvlauthiddata2);
    new 
data[16];
    
num_to_str(g_exp[plr], datasizeof(data) - 1);
    
    
fvault_set_data(g_vault_nameauthiddata);
}

LoadExp(plr)
{
    new 
authid[35];
    
get_user_authid(plrauthidsizeof(authid) - 1);
    new 
data2[16];
    if( 
fvault_get_data(g_vault_lvlauthiddata2sizeof(data2) - 1) )
    {
        
g_lvl[plr] = str_to_num(data2);
    }
    else
    {
        
g_lvl[plr] = 0;
    }
    new 
data[16];
    if( 
fvault_get_data(g_vault_nameauthiddatasizeof(data) - 1) )
    {
        
g_exp[plr] = str_to_num(data);
    }
    else
    {
        
g_exp[plr] = 0;
    }

Try this.. I do not know if it compiles at all since i don't have the fvault include.. But hopefully it works
Code:
get_user_aiming( id, target, body )
Error: Array must be indexed (variable "target") on line 77
Error: Argument type mismatch (argument 2) on line 72
Error: Argument type mismatch (argument 1) on line 73
Error: Array must be indexed (variable "target") on line 75

*Edit:*
But if i Alive if you can make like this
Level | exp

if im spec on someone i mean if im dead so Name | level | exp

Last edited by Snitch; 03-28-2014 at 08:25.
Snitch is offline
Send a message via Skype™ to Snitch
amx_tiger
Junior Member
Join Date: Aug 2012
Old 03-28-2014 , 14:10   Re: [HELP] XpMOD
Reply With Quote #6

PHP Code:
public show(id
{
    new 
target[32],body;
    new 
szName32 ]
    
get_user_aimingidtargetbody )
    
get_user_nametargetszNamecharsmaxszName ) )
    
set_hudmessage(02550, -1.00.906.012.0)
    if( 
target )
    {
        
ShowSyncHudMsg(id,syncObj"Name: %s | Level: %i | Exp: %i/%i"szNameg_lvltarget ], g_exptarget ], LEVELS[g_lvltarget ]])
    }

-->

PHP Code:
public show(id
{
    new 
target,body;
    
get_user_aimingidtargetbody )
    if( 
target )
    {
    
set_hudmessage(02550, -1.00.906.012.0)
    if (!
is_user_alive(id))
    {
        new 
szName32 ]
        
get_user_nametargetszNamecharsmaxszName ) )
        
ShowSyncHudMsg(id,syncObj"Name: %s | Level: %i | Exp: %i/%i"szNameg_lvltarget ], g_exptarget ], LEVELS[g_lvltarget ]])
    }
    else
        
ShowSyncHudMsg(id,syncObj"Level: %i | Exp: %i/%i",  g_lvltarget ], g_exptarget ], LEVELS[g_lvltarget ]])
    
    }

amx_tiger is offline
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 03-29-2014 , 18:01   Re: [HELP] XpMOD
Reply With Quote #7

Quote:
Originally Posted by amx_tiger View Post
PHP Code:
public show(id
{
    new 
target[32],body;
    new 
szName32 ]
    
get_user_aimingidtargetbody )
    
get_user_nametargetszNamecharsmaxszName ) )
    
set_hudmessage(02550, -1.00.906.012.0)
    if( 
target )
    {
        
ShowSyncHudMsg(id,syncObj"Name: %s | Level: %i | Exp: %i/%i"szNameg_lvltarget ], g_exptarget ], LEVELS[g_lvltarget ]])
    }

-->

PHP Code:
public show(id
{
    new 
target,body;
    
get_user_aimingidtargetbody )
    if( 
target )
    {
    
set_hudmessage(02550, -1.00.906.012.0)
    if (!
is_user_alive(id))
    {
        new 
szName32 ]
        
get_user_nametargetszNamecharsmaxszName ) )
        
ShowSyncHudMsg(id,syncObj"Name: %s | Level: %i | Exp: %i/%i"szNameg_lvltarget ], g_exptarget ], LEVELS[g_lvltarget ]])
    }
    else
        
ShowSyncHudMsg(id,syncObj"Level: %i | Exp: %i/%i",  g_lvltarget ], g_exptarget ], LEVELS[g_lvltarget ]])
    
    }

It shows me a few seconds and then disappears or it does not show anything..

and sometime when im moveing it disappears the message and sometimes it shows

Last edited by Snitch; 03-29-2014 at 18:12.
Snitch is offline
Send a message via Skype™ to Snitch
xxxperts
Senior Member
Join Date: Oct 2013
Location: India
Old 03-30-2014 , 02:53   Re: [HELP] XpMOD
Reply With Quote #8

Quote:
Originally Posted by Snitch View Post
can someone Add for this Code > Spec name?
I look at someone, then it will show me the
Name: Level | Exp


As it shows mine I'm living.
PHP Code:
#include <amxmodx>
#include <fvault>
#include <ColorChat>

new const g_vault_name[] = "EXP_MOD";
new const 
g_vault_lvl[] = "LVL_MOD";
new const 
LEVELS[7] = {
    
30//lvl 0 
    
80//lvl 1
    
220//lvl 2
    
370//lvl 3
    
600//lvl 4
    
1500//lvl 5
    
5000 //lvl 6
}

new 
g_exp[33],g_lvl[33];
new 
XP_Kill,XP_Knife,XP_Hs,syncObj

public plugin_init()
{
    
register_plugin("XpMod""1.0""JustGo")
    
register_event("DeathMsg""eDeath""a")
    
XP_Kill=register_cvar("XP_per_kill""2")
    
XP_Hs=register_cvar("XP_hs_bonus","3")
    
XP_Knife=register_cvar("XP_knife_bonus","3")
    
syncObj CreateHudSyncObj()
}

public 
eDeath() //function name 

    
// Create a variable to store the attacker's id
    
new attacker read_data)
    
// We create the victim variable, so that this function can check 
    // if a player was killed 
    
new iVictim read_data)
    
// If a player was killed by a HeadShot, this will be used for the cvar Xp_Hs
    
new headshot read_data)
    if(
attacker == iVictim)
    {
        return 
PLUGIN_HANDLED
    
}
    
//which weapon was used
    
new clipammoweapon get_user_weapon(attacker,clip,ammo); 
    
// used for the xp_hs cvar 
    // it checks if the victim was killed by a headshot 
    
if(headshot
    {
    
g_exp[attacker] += get_pcvar_num(XP_Hs
    }
    else if(
weapon == CSW_KNIFE
    { 
    
g_exp[attacker] += get_pcvar_num(XP_Knife)    
    }
    else
    {
        
g_exp[attacker] += get_pcvar_num(XP_Kill)
    }
    while(
g_exp[attacker] >= LEVELS[g_lvl[attacker]]) 
    {
        
g_lvl[attacker] += 
        ColorChat
(attackerNORMAL"^4[Nex] ^4Congratulations! ^1You are level^3 %i "g_lvl[attacker]) 
    }
    
SaveExp(attacker)
    return 
PLUGIN_HANDLED
}  

public 
show(id

    
set_hudmessage(02550, -1.00.906.012.0
    
ShowSyncHudMsg(id,syncObj"[ Level: %i| Exp: %i/%i]",g_lvl[id],g_exp[id],LEVELS[g_lvl[id]]) 
}

public 
client_putinserver(plr)
{
    if( !
is_user_hltv(plr) && !is_user_bot(plr) )
    {
        
LoadExp(plr);
    }
    
set_task(1.0"show"plr__"b")
}

public 
client_disconnect(plr)
{
    if( 
g_exp[plr] > )
    {
        
SaveExp(plr);
        
        
g_exp[plr] = 0;
    }
}

SaveExp(plr)
{
    new 
authid[35];
    
get_user_authid(plrauthidsizeof(authid) - 1);
    new 
data2[16];
    
num_to_str(g_lvl[plr], data2sizeof(data2) - 1);
    
    
fvault_set_data(g_vault_lvlauthiddata2);
    new 
data[16];
    
num_to_str(g_exp[plr], datasizeof(data) - 1);
    
    
fvault_set_data(g_vault_nameauthiddata);
}

LoadExp(plr)
{
    new 
authid[35];
    
get_user_authid(plrauthidsizeof(authid) - 1);
    new 
data2[16];
    if( 
fvault_get_data(g_vault_lvlauthiddata2sizeof(data2) - 1) )
    {
        
g_lvl[plr] = str_to_num(data2);
    }
    else
    {
        
g_lvl[plr] = 0;
    }
    new 
data[16];
    if( 
fvault_get_data(g_vault_nameauthiddatasizeof(data) - 1) )
    {
        
g_exp[plr] = str_to_num(data);
    }
    else
    {
        
g_exp[plr] = 0;
    }

i had posted this kind of code lets check again & again..! till u dont get.
__________________
All my work is here
xxxperts is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 03-30-2014 , 03:42   Re: [HELP] XpMOD
Reply With Quote #9

Your main issue is that your calling a task to detect looking at a player, rather than a real event such as StatusValue which would be ideal for this.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
Buckshot
Senior Member
Join Date: Mar 2014
Location: Sweden
Old 03-30-2014 , 03:56   Re: [HELP] XpMOD
Reply With Quote #10

Quote:
Originally Posted by Snitch View Post
It shows me a few seconds and then disappears or it does not show anything..

and sometime when im moveing it disappears the message and sometimes it shows
Yes. that is what you asked for. This message only shows up while looking at a player.
__________________
PM me for private work.


Buckshot is offline
Send a message via Skype™ to Buckshot
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 05:59.


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