AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   XP Required %i, Help! (https://forums.alliedmods.net/showthread.php?t=233245)

Going Dutch 01-11-2014 20:13

XP Required %i, Help!
 
Hello,

I am trying to add so you can see on what amount of XP you level up.
Example: 25/300, you level up when you gained 100xp.

The problem i am having now is that the /300 isn't changing it keeps on 300 and when you reach over it it also wont change to the next amount needed for that level. so you will have 310/300.

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <nvault>  
#include <colorchat>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>

new Level[33], eXP[33]
new 
KillXpHsXpHeXp/*, KnifeXp*/
new gVault

new const szPrefix[] = "[^4GDG^3] -"

#define MaxLevels 102
#define IsPlayer(%1) ( 1 <= %1 <=  g_iMaxPlayers )
#define TASK_SHOW_HUD 10113

new g_msgHudSync
new bool:is_user_ignored33 ]

new const 
Levels[MaxLevels] = 
{
    
150// 1
    
300
    
450
    
600
    
750
    
900
    
1050
    
1200
    
1350
    
1500
    
1650
    
1800
    
1950
    
2100
    
2250//15
    
2400,
    
2550,
    
2700,
    
2850,
    
3000//20
    
3150,
    
3300,
    
3450,
    
3600,
    
3750,
    
3900,
    
4050,
    
4200,
    
4350,
    
4500//30
    
4650,
    
4800,
    
4950,
    
5100,
    
5250,
    
5400,
    
5550,
    
5700,
    
5850,
    
6000//40
    
6150,
    
6300,
    
6450,
    
6600,
    
6750,
    
6900,
    
7050,
    
7200,
    
7350,
    
7500,//50
    
7650,
    
7800,
    
7950,
    
8100,
    
8250,
    
8400,
    
8550,
    
8700,
    
8850,
    
9000,//60
    
9150,
    
9300,
    
9450,
    
9600,
    
9750,
    
9900,
    
10050,
    
10200,
    
10350,
    
10500,//70
    
10650,
    
10800,
    
10950,
    
11100,
    
11250,
    
11400,
    
11550,
    
11700,
    
11850,
    
12000,//80
    
12150,
    
12300,
    
12450,
    
12600,
    
12750,
    
12900,
    
13050,
    
13200,
    
13350,
    
13500,//90
    
13650,
    
13800,
    
13950,
    
14100,
    
14250,
    
14400,
    
14550,
    
14700,
    
14850,
    
15000 //100
}
new const 
Prefix[MaxLevels +1][] =
{
    
"Lvl 0"// 0
    
"Lvl 1"// 1
    
"Lvl 2",  // 2
    
"Lvl 3"// 3
    
"Lvl 4"// 4
    
"Lvl 5",  // 5
    
"Lvl 6"// 6
    
"Lvl 7"// 7
    
"Lvl 8"// 8
    
"Lvl 9"// 9
    
"Lvl 10"// 10
    
"Lvl 11"// 11
    
"Lvl 12"// 12
         
"Lvl 13"// 0
    
"Lvl 14"// 1
    
"Lvl 14",  // 2
    
"Lvl 15"// 3
    
"Lvl 16"// 4
    
"Lvl 17",  // 5
    
"Lvl 18"// 6
    
"Lvl 19"// 7
    
"Lvl 20"// 8
    
"Lvl 21"// 9
    
"Lvl 22"// 10
    
"Lvl 23"// 11
    
"Lvl 24"// 12
    
"Lvl 25"// 1
    
"Lvl 26",  // 2
    
"Lvl 27"// 3
    
"Lvl 28"// 4
    
"Lvl 29",  // 5
    
"Lvl 30"// 6
    
"Lvl 31"// 7
    
"Lvl 32"// 8
    
"Lvl 33"// 9
    
"Lvl 34"// 10
    
"Lvl 35"// 11
    
"Lvl 36"// 12
         
"Lvl 37"// 0
    
"Lvl 38"// 1
    
"Lvl 39",  // 2
    
"Lvl 40"// 3
    
"Lvl 41"// 4
    
"Lvl 42",  // 5
    
"Lvl 43"// 6
    
"Lvl 44"// 7
    
"Lvl 45"// 8
    
"Lvl 46"// 9
    
"Lvl 47"// 10
    
"Lvl 48"// 11
    
"Lvl 49"// 12
    
"Lvl 50"//50
    
"Lvl 51"// 1
    
"Lvl 52",  // 2
    
"Lvl 53"// 3
    
"Lvl 54"// 4
    
"Lvl 55",  // 5
    
"Lvl 56"// 6
    
"Lvl 57"// 7
    
"Lvl 58"// 8
    
"Lvl 59"// 9
    
"Lvl 60"// 10
    
"Lvl 61"// 11
    
"Lvl 62"// 12
         
"Lvl 63"// 0
    
"Lvl 64"// 1
    
"Lvl 65"// 3
    
"Lvl 66"// 4
    
"Lvl 67",  // 5
    
"Lvl 68"// 6
    
"Lvl 69"// 7
    
"Lvl 70"// 8
    
"Lvl 71"// 9
    
"Lvl 72"// 10
    
"Lvl 73"// 11
    
"Lvl 74"// 12
    
"Lvl 75"// 1
    
"Lvl 76",  // 2
    
"Lvl 77"// 3
    
"Lvl 78"// 4
    
"Lvl 79",  // 5
    
"Lvl 80"// 6
    
"Lvl 81"// 7
    
"Lvl 82"// 8
    
"Lvl 83"// 9
    
"Lvl 84"// 10
    
"Lvl 85"// 11
    
"Lvl 86"// 12
         
"Lvl 87"// 0
    
"Lvl 88"// 1
    
"Lvl 89",  // 2
    
"Lvl 90"// 3
    
"Lvl 91"// 4
    
"Lvl 92",  // 5
    
"Lvl 93"// 6
    
"Lvl 94"// 7
    
"Lvl 95"// 8
    
"Lvl 96"// 9
    
"Lvl 97"// 10
    
"Lvl 98"// 11
    
"Lvl 99"// 12
    
"Lvl 100"//50
    
"MAX"
}

// Bonus Stuff
new healthperlevel,
    
armorperlevel,
    
speedperlevel,
    
damageperlevel,
    
gravityperlvl
    
new g_iMaxPlayers

// ADMIN CHAT COLORS by ConnorMcLeod
enum _:ADMIN_DATAS 

    
m_szName[32], 
    
m_iFlag 


new const 
AdminsDatas[][ADMIN_DATAS] =  

    {
"Owner"ADMIN_IMMUNITY}, 
    {
"Admin"ADMIN_KICK}, 
    
// {"SuperAdmin", ADMIN_CFG}, 
    
{"VIP"ADMIN_RESERVATION}, 
    {
"GDG"ADMIN_LEVEL_G
};

public 
plugin_init() 
{
    
register_plugin("Leveltag""1.0.0""Jeroen")
    
    
register_message(get_user_msgid("SayText"),"Message_SayText"); // CREDITS TO ConnorMcLeod
    
    
RegisterHam Ham_Spawn"player""Ham_CheckOthers_Bonus"1);
    
RegisterHam Ham_TakeDamage"player""Ham_CheckDamage_Bonus", .Post false );
    
RegisterHam Ham_Item_PreFrame"player""Ham_CheckSpeed_Bonus"1);
    
    
g_iMaxPlayers get_maxplayers( );
    
    
register_cvar"AdminChatColors_On""1" ); // Admin Tag - Example: [Admin] Freestyle
    
register_cvar"XP_Reward_MSG""1" ); // Message of the XP Gain
    
    // CHAT COMMANDS //
    
register_clcmd "say /xp""ShowPlayerXP")
    
register_clcmd "say_team /xp""ShowPlayerXP")
    
register_clcmd "say /level""ShowPlayerLevel")
    
register_clcmd "say_team /level""ShowPlayerLevel")
    
    
// XP SYSTEM //
    
KillXp    register_cvar("drxp_per_kill""10")
    
HsXp    register_cvar("drxp_per_hs""15")
    
HeXp    register_cvar("drxp_per_nade_kill""10")
    
//KnifeXp    = register_cvar("drxp_per_knife_kill", "10")
    
    // Give & Remove XP //
    
register_concmd "give_xp""CmdAddXP"ADMIN_RCON"<nick, #userid, authid | @all> <xp>" )
    
register_concmd "remove_xp""CmdRemoveXP"ADMIN_RCON"<nick, #userid, authid | @all> <xp>" )
    
    
/* Bonus Stuff */
    
    // Health Per Level //
    
healthperlevel    register_cvar("health_per_lvl""0")
    
    
// Armor Per Level //
    
armorperlevel    register_cvar("armor_per_lvl""0"
    
    
// Speed Per Level //
    
speedperlevel    register_cvar("speed_per_lvl""0")
    
    
// Gravity Per Level //
    
gravityperlvl    register_cvar("gravity_per_lvl""0"// NERVER MORE THAN 66 PER LVL
    
    // Damage Per Level //
    
damageperlevel    register_cvar("damage_per_lvl""0")
    
    
g_msgHudSync CreateHudSyncObj()
}

public 
plugin_cfg( )
{    
    
gVault nvault_open"TAG_LVLS" )
    
    if ( 
gVault == INVALID_HANDLE )
        
set_fail_state"Error opening nVault" );
}

/*      INFO ABOUT PERSONAL XP/LEVEL      */
public ShowPlayerXP(id)
{
    
ColorChat(idGREY"%s You have ^4%i^3 XP and your Level are ^4%s^3!"szPrefixeXP[id], Prefix[Level[id]])
}

public 
ShowPlayerLevel(id)
{
    new 
name[32]
    
get_user_name(idnamesizeof(name) -1)
        
    
ColorChat(idGREY"%s You are Level ^4%s^3 with ^4%i^3 XP!"szPrefixPrefix[Level[id]], eXP[id])
}

public 
Ham_CheckDamage_BonuspevVictimpevInflictorpevAttackerFloat:flDamageiDmgBits 

    if( !( 
<= pevAttacker <= g_iMaxPlayers) ) 
    { 
        return 
HAM_HANDLED
    } 
     
    if( !
is_user_alivepevAttacker )  ) 
    { 
        return 
HAM_HANDLED
    } 

    
SetHamParamFloatflDamage + ( get_pcvar_numdamageperlevel ) * LevelpevAttacker ] ) ) 

    return 
HAM_IGNORED


/*      Speed Check      */
public Ham_CheckSpeed_Bonusid )
{
    if( !
is_user_aliveid ) || cs_get_user_teamid ) != CS_TEAM_T )
    {
        return 
HAM_IGNORED;
    }
    
    
set_user_maxspeedid250.0 + ( get_pcvar_num(speedperlevel) * Levelid ] ) );
            
    return 
HAM_IGNORED;
}

/*      HP & AP & Gravity Check      */
public Ham_CheckOthers_Bonus(id)
{
    if( !
is_user_aliveid ) || cs_get_user_teamid ) != CS_TEAM_T )
        return 
HAM_IGNORED;
        
    
// HP Check
    
new HPCheck = ( get_user_health(id) + get_pcvar_num(healthperlevel) * Levelid ] );
    
set_user_healthidHPCheck );
    
    
// AP Check
    
new APCheck = ( get_user_armor(id) + get_pcvar_num(armorperlevel) * Levelid ] );
    
set_user_armoridAPCheck );
    
    
// Gravity
    
new GRAVITYCheck 800 - ( get_pcvar_numgravityperlvl ) * Levelid ] );
    
    if(
get_pcvar_num(gravityperlvl) > 66)
    {
        
set_user_gravityidfloat) / 800.0 );
    }
    else
    {
        
set_user_gravityidfloatGRAVITYCheck ) / 800.0 );
    }
    
    
remove_taskTASK_SHOW_HUD id );        

    
set_task(0.1"ShowHud"TASK_SHOW_HUD id)
            
    return 
HAM_IGNORED;
}
/*      Respected Player Join / Leave Stuff      */

public LvL_12_PlayerJoin(id)
{
    new 
name[32]
    
get_user_name(idnamesizeof(name) -1)
        
    
ColorChat(0GREY"%s ^4Respected Player : ^1%s^4 has joined with ^1%i^4 XP!"szPrefixnameeXP[id])
}

public 
LvL_12_PlayerRemove(id)
{
    new 
name[32]
    
get_user_name(idnamesizeof(name) -1)
        
    
ColorChat(0GREY"%s ^4Respected Player : %s has left with %i XP!"szPrefixnameeXP[id])
}
public 
plugin_end( )
    
nvault_closegVault )
    
public 
client_putinserver(id)
{
    
LoadData(id)
    
set_task3.0"ShowHud"id, .flags "b" );
    
    if(
Level[id] == 12)
    {
        
set_task(5.0"LvL_12_PlayerJoin"id)
    }
}

public 
client_disconnect(id)
{
    
SaveData(id)
    
    if(
Level[id] == 12)
    {
        
set_task(1.0"LvL_12_PlayerRemove"id)
    }
}

/*      XP REWARDS      */
public client_deathiKilleriVictimwpnindexhitplace )
{
    new 
vname[32]
    new 
kname[32]
    
    
get_user_nameiKillerknamecharsmaxkname ) )
    
get_user_nameiVictimvnamecharsmaxvname ) )

    if( 
is_user_ignorediKiller ] )
        return 
PLUGIN_HANDLED_MAIN
    
    get_user_name
iKillerknamecharsmaxkname ) )
    
get_user_nameiVictimvnamecharsmaxvname ) )
    
    if( 
iKiller != iVictim && ( <= iKiller <= g_iMaxPlayers ) && ( <= iVictim <= g_iMaxPlayers ) && !( hitplace == HIT_HEAD ) && !( wpnindex == CSW_HEGRENADE ) )
    {
        
eXP[iKiller] += get_pcvar_num(KillXp)
        
        if( 
get_cvar_num("XP_Reward_MSG") == 
        {
            
ColorChat iKillerGREY"%s You got^4 %i^3 XP for killing^4 %s^3"szPrefixget_pcvar_num(KillXp), vname )
        }
    }
    
    if( 
hitplace == HIT_HEAD )
    {
        
eXP[iKiller] += get_pcvar_num(HsXp)
        
        if( 
get_cvar_num("XP_Reward_MSG") == 
        {
            
ColorChat iKillerGREY"%s You got ^4%i^3 XP for killing ^4%s^3 with a ^4HeadShot"szPrefixget_pcvar_num (HsXp), vname )
        }
    }
    
    if( 
wpnindex == CSW_HEGRENADE && iKiller != iVictim )
    {
        
eXP[iKiller] += get_pcvar_num(HeXp)
        
        if( 
get_cvar_num("XP_Reward_MSG") == 
        {
            
ColorChatiKillerGREEN"%s^1 You got^4 %i^3 XP for killing^4 %s^3 with a ^4Grenade"szPrefixget_pcvar_num (HeXp), vname )
        }
    }
    
CheckLevel(iKiller)
    
SaveData(iKiller)
    
    return 
PLUGIN_CONTINUE
}

public 
CheckLevel(id)
{
    if(
Level[id] < MaxLevels-1)
    {
        while(
eXP[id] >= Levels[Level[id]])
        {
            
Level[id] += 
            ColorChat
(idGREY"%s Congratulations, you've leveled up! You are now level : ^4%i^3"szPrefixLevel[id])
        }
    } 
}

/*      HUD PERMANENT INFO      */
public ShowHud(task)
{
    new 
id task TASK_SHOW_HUD
    
    
if(!is_user_alive(id))
        return;
    
    
set_hudmessage(025500.020.3300.00.30.00.0)
    
ShowSyncHudMsg (idg_msgHudSync,"[You Are %s]^n[XP : %i / %i ]"Prefix[Level[id]], eXP[id], Levels[id])
    
    
set_task(0.1"ShowHud"TASK_SHOW_HUD id)    
}

/*      nVault Stuff      */
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#",eXP[id],Level[id]) 
    
    
nvault_set(gVault,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#",eXP[id],Level[id]) 
    
    
nvault_get(gVault,vaultkey,vaultdata,255
    
    
replace_all(vaultdata255"#"" "
    
    new 
playerxp[32], playerlevel[32
    
    
parse(vaultdataplayerxp31playerlevel31
    
    
eXP[id] = str_to_num(playerxp
    
    
Level[id] = str_to_num(playerlevel
    
    return 
PLUGIN_CONTINUE 


/*      Remove And Add XP      */
public CmdAddXP iPlayerlevelcid )
{
    if( !
cmd_accessiPlayerlevelcid) ) return PLUGIN_HANDLED;
       
    new 
arg 32 ]
    
read_argv 1arg31 
 
    new 
AddXP 32 ]
    
read_argv 2AddXPcharsmax AddXP ) )
 
    new 
XPtoGive str_to_num AddXP )
       
    new 
AdminName 32 ]
    new 
TargetName 32 ]
    
get_user_name iPlayerAdminNamecharsmax AdminName ) )
       
    if( 
arg[0]=='@' )
    { 
        if( 
equali(arg[1],"All") || equali(arg[1],"ALL") )
        {
            new 
players[32], totalplayersAll
            get_players
playerstotalplayers )
            
            for ( new 
0totalplayersi++ )
            {
                
All players]
                       
                
eXPAll ] += XPtoGive
            
}
            
            
CheckLevelAll )
            
ColorChat 0GREY"%s ^1%s^3 give^1 %i^3 XP to all ^1 players^3!"szPrefixAdminNameXPtoGive )
        }
        else if( 
equali(arg[1],"T") || equali(arg[1],"t") )
        {
            new 
players[32], totalplayersT
            get_players
playerstotalplayers )
            
            for ( new 
0totalplayersi++ )
            {
                if ( 
get_user_team(players]) == )
                {
                    
players]
                           
                    
eXP] += XPtoGive
                
}
            }
            
            
CheckLevel)
            
ColorChat 0GREY"%s ^1%s^3 give^1 %i^3 XP to all ^1 Terrorists^3!"szPrefixAdminNameXPtoGive )
        }
        else if( 
equali(arg[1],"CT") || equali(arg[1],"ct") )
        {
            new 
players[32], totalplayersCT
            get_players
playerstotalplayers )
            
            for( new 
0totalplayersi++ )
            {
                if( 
get_user_team(players] ) == )
                {
                    
CT players]
                           
                    
eXPCT ] += XPtoGive
                
}
            }
            
            
CheckLevelCT )
            
ColorChat 0GREY"%s ^1%s^3 give^1 %i^3 XP to all ^1 Counter-Terrorists^3!"szPrefixAdminNameXPtoGive )
        }
    }
    else
    {
        new 
iTarget cmd_targetiPlayerarg)
        
get_user_name iTargetTargetNamecharsmax TargetName ) )
        
        if( 
iTarget )
        {
            
eXPiTarget ] += XPtoGive
            
            CheckLevel
iTarget )
            
ColorChat 0GREY"%s ^1%s^3 give^1 %i^3 XP to^1 %s^3"szPrefixAdminNameXPtoGiveTargetName )
        }
    }
    return 
PLUGIN_HANDLED
}
 
public 
CmdRemoveXP iPlayerlevelcid )
{
    if( !
cmd_access(iPlayerlevelcid3) ) return PLUGIN_HANDLED;
       
    new 
arg 32 ]
    
read_argv 1arg31 
 
    new 
RemoveXP 32 ]
    
read_argv 2RemoveXPcharsmax RemoveXP ) )
 
    new 
XPtoRemove str_to_num RemoveXP )
       
    new 
AdminName 32 ]
    new 
TargetName 32 ]
    
get_user_name iPlayerAdminNamecharsmax AdminName ) )
       
    if( 
arg[0]=='@' )
    { 
        if( 
equali(arg[1],"All") || equali(arg[1],"ALL") )
        {
            new 
players[32], totalplayersAll
            get_players
playerstotalplayers )
            
            for ( new 
0totalplayersi++ )
            {
                
All players]
                       
                
eXPAll ] -= XPtoRemove
            
}
            
            
CheckLevelAll )
            
ColorChat 0GREY"%s ^1%s^3 toke^1 %i^3 XP of all ^1 players^3!"szPrefixAdminNameXPtoRemove )
        }
        else if( 
equali(arg[1],"T") || equali(arg[1],"t") )
        {
            new 
players[32], totalplayersT
            get_players
playerstotalplayers )
            
            for ( new 
0totalplayersi++ )
            {
                if ( 
get_user_team(players]) == )
                {
                    
players]
                           
                    
eXP] -= XPtoRemove
                
}
            }
            
            
CheckLevel)
            
ColorChat 0GREY"%s ^1%s^3 toke^1 %i^3 XP of all ^1 Terrorists^3!"szPrefixAdminNameXPtoRemove )
        }
        else if( 
equali(arg[1],"CT") || equali(arg[1],"ct") )
        {
            new 
players[32], totalplayersCT
            get_players
playerstotalplayers )
            
            for( new 
0totalplayersi++ )
            {
                if( 
get_user_team(players] ) == )
                {
                    
CT players]
                           
                    
eXPCT ] -= XPtoRemove
                
}
            }
            
            
CheckLevelCT )
            
ColorChat 0GREY"%s ^1%s^3 toke^1 %i^3 XP of all ^1 Counter-Terrorists^3!"szPrefixAdminNameXPtoRemove )
        }
    }
    else
    {
        new 
iTarget cmd_targetiPlayerarg)
        
get_user_name iTargetTargetNamecharsmax TargetName ) )
        
        if( !
iTarget )
            return 
PLUGIN_HANDLED
            
        eXP
iTarget ] -= XPtoRemove
            
        CheckLevel
iTarget )
        
ColorChat 0GREY"%s ^1%s^3 give^1 %i^3 XP to^1 %s^3"szPrefixAdminNameXPtoRemoveTargetName )
    }
    
    return 
PLUGIN_HANDLED
}
/*      Level Behind Nick & AdminChatColors
              CREDITS TO ConnorMcLeod            */
public Message_SayText(msgId,msgDest,msgEnt

    new 
id get_msg_arg_int(1); 
    if( 
is_user_connected(id) ) 
    { 
        if( 
get_cvar_num("AdminChatColors_On") == 
        {
            new 
flags get_user_flags(id)
            for(new 
ii<sizeof(AdminsDatas); i++) 
            { 
                if( 
flags AdminsDatas[i][m_iFlag] ) 
                { 
                    new 
szChannel[64]
                    
get_msg_arg_string(2szChannelcharsmax(szChannel))
        
                    if( 
equal(szChannel"#Cstrike_Chat_All") ) 
                    { 
                        
formatex(szChannelcharsmax(szChannel), "^4[%s - %s] ^3%%s1 ^1:  %%s2"Prefix[Level[id]], AdminsDatas[i][m_szName])
                        
set_msg_arg_string(2szChannel)
                    } 
                    else if( !
equal(szChannel"#Cstrike_Name_Change") ) 
                    { 
                        
format(szChannelcharsmax(szChannel), "^4[%s - %s] %s"Prefix[Level[id]], AdminsDatas[i][m_szName], szChannel)
                        
set_msg_arg_string(2szChannel)
                    } 
                    return
                } 
                else
                {
                    new 
szChannel[64]
                    
get_msg_arg_string(2szChannelcharsmax(szChannel))
        
                    if( 
equal(szChannel"#Cstrike_Chat_All") ) 
                    { 
                        
formatex(szChannelcharsmax(szChannel), "^4[%s] ^3%%s1 ^1:  %%s2"Prefix[Level[id]])
                        
set_msg_arg_string(2szChannel)
                    } 
                    else if( !
equal(szChannel"#Cstrike_Name_Change") ) 
                    { 
                        
format(szChannelcharsmax(szChannel), "^4[%s] %s"Prefix[Level[id]], szChannel)
                        
set_msg_arg_string(2szChannel)
                    } 
                    return 
                }
            } 
        }
        else
        {
            new 
szChannel[64]
            
get_msg_arg_string(2szChannelcharsmax(szChannel));
        
            if( 
equal(szChannel"#Cstrike_Chat_All") ) 
            { 
                
formatex(szChannelcharsmax(szChannel), "^4[%s] ^3%%s1 ^1:  %%s2"Prefix[Level[id]])
                
set_msg_arg_string(2szChannel)
            } 
            else if( !
equal(szChannel"#Cstrike_Name_Change") ) 
            { 
                
format(szChannelcharsmax(szChannel), "^4[%s] %s"Prefix[Level[id]], szChannel
                
set_msg_arg_string(2szChannel)
            } 
            return 
        }
    } 



fysiks 01-11-2014 21:24

Re: XP Required %i, Help!
 
Please post long plugins as attachments. Also, where in the code are you having this issue (what line)?

xxxperts 01-11-2014 23:47

Re: XP Required %i, Help!
 
i guess that u want to get the points for next... like my XP is 20 and its should show as 20/100.....and 100 is the finish line of the current level....do i am right..???

Going Dutch 01-12-2014 05:46

Re: XP Required %i, Help!
 
Oh i'm sorry Fysiks i thought it was standard to post the full sma.

Line 505


PHP Code:

/*      HUD PERMANENT INFO      */
public ShowHud(task)
{
    new 
id task TASK_SHOW_HUD
    
    
if(!is_user_alive(id))
        return;
    
    
set_hudmessage(025500.020.3300.00.30.00.0)
    
ShowSyncHudMsg (idg_msgHudSync,"[You Are %s]^n[XP : %i / %i ]"Prefix[Level[id]], eXP[id], Levels[id])
    
set_task(0.1"ShowHud"TASK_SHOW_HUD id)    


PHP Code:

ShowSyncHudMsg (idg_msgHudSync,"[You Are %s]^n[XP : %i / %i ]"Prefix[Level[id]], eXP[id], 



Yes xxxperts, you are right.

xxxperts 01-12-2014 06:29

Re: XP Required %i, Help!
 
first thing your codes are very complicated to understand... soo i created it in my style..i think you can understand it..its a very comman sence style
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN    "XP LEVEL EXAMPLE"
#define VERSION    "1.0"
#define AUTHOR    "[ZOF 'X]"

new User_XP[33];
new 
User_Level[33];

new const 
XP[] =
{
    
100,
    
200,
    
300,
    
400,
    
500
}

new const 
Level_Names[][] =
{
    
"Lvl 1",
    
"Lvl 2",
    
"Lvl 3",
    
"Lvl 4",
    
"Lvl 5"
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_clcmd("say /xp""cmdXP");
    
register_clcmd("say_team /xp""cmdXP");
}

public 
cmdXP(id)
{
    
client_print(idprint_chat"Your Stats : %s | XP : %d / %d"Level_Names[User_Level[id]], User_XP[id], XP[User_Level[id]+0])



Going Dutch 01-12-2014 07:10

Re: XP Required %i, Help!
 
Thank you xxxperts!

I know that the script was kinda confusing, i'm still new to all the scripting.
But the main part of the plugin was that which level you are was shown as a Tag in front of your name.

fysiks 01-12-2014 07:39

Re: XP Required %i, Help!
 
Quote:

Originally Posted by Going Dutch (Post 2084846)
Oh i'm sorry Fysiks i thought it was standard to post the full sma.

It is best to post the whole plugin. I never said that it wasn't. I said that it's better if you attach the .sma file to your post.

Quote:

Originally Posted by Going Dutch (Post 2084846)
Line 505

PHP Code:

/*      HUD PERMANENT INFO      */
public ShowHud(task)
{
    new 
id task TASK_SHOW_HUD
    
    
if(!is_user_alive(id))
        return;
    
    
set_hudmessage(025500.020.3300.00.30.00.0)
    
ShowSyncHudMsg (idg_msgHudSync,"[You Are %s]^n[XP : %i / %i ]"Prefix[Level[id]], eXP[id], Levels[id])
    
set_task(0.1"ShowHud"TASK_SHOW_HUD id)    



This probably happened because your variable names are vague and make it easy to confuse them.

Levels[id] :arrow: Levels[Level[id]]

Going Dutch 01-12-2014 07:43

Re: XP Required %i, Help!
 
1 Attachment(s)
Thank you, works now.

And sorry for the miss communication.

Uploaded the working .sma for anyone interested in this plugin.


All times are GMT -4. The time now is 10:14.

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