View Single Post
Dexon
Member
Join Date: Aug 2019
Old 08-25-2019 , 12:00   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #316

Quote:
Originally Posted by OciXCrom View Post
1. Armor:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <crxranks>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN_VERSION "1.0"

new Trie:g_tArmor

public plugin_init()
{
    
register_plugin("CRXRanks: Armor Per Level"PLUGIN_VERSION"OciXCrom")
    
register_cvar("CRXRanksAPL"PLUGIN_VERSIONFCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
    
RegisterHam(Ham_Spawn"player""OnPlayerSpawn"1)
}

public 
plugin_cfg()
{
    
g_tArmor TrieCreate()
    
ReadFile()
}

public 
plugin_end()
{
    
TrieDestroy(g_tArmor)
}

ReadFile()
{
    new 
szConfigsName[256], szFilename[256]
    
get_configsdir(szConfigsNamecharsmax(szConfigsName))
    
formatex(szFilenamecharsmax(szFilename), "%s/RankSystemArmor.ini"szConfigsName)

    new 
iFilePointer fopen(szFilename"rt")

    if(
iFilePointer)
    {
        new 
szData[64], szValue[32], szMap[32], szKey[32], bool:bRead trueiSize
        get_mapname
(szMapcharsmax(szMap))

        while(!
feof(iFilePointer))
        {
            
fgets(iFilePointerszDatacharsmax(szData))
            
trim(szData)

            switch(
szData[0])
            {
                case 
EOS'#'';': continue
                case 
'-':
                {
                    
iSize strlen(szData)

                    if(
szData[iSize 1] == '-')
                    {
                        
szData[0] = ' '
                        
szData[iSize 1] = ' '
                        
trim(szData)

                        if(
contain(szData"*") != -1)
                        {
                            
strtok(szDataszKeycharsmax(szKey), szValuecharsmax(szValue), '*')
                            
copy(szValuestrlen(szKey), szMap)
                            
bRead equal(szValueszKey) ? true false
                        
}
                        else
                        {
                            static const 
szAll[] = "#all"
                            
bRead equal(szDataszAll) || equali(szDataszMap)
                        }
                    }
                    else continue
                }
                default:
                {
                    if(!
bRead)
                        continue

                    
strtok(szDataszKeycharsmax(szKey), szValuecharsmax(szValue), '=')
                    
trim(szKey); trim(szValue)

                    if(!
szValue[0])
                        continue

                    
TrieSetCell(g_tArmorszKeystr_to_num(szValue))
                }
            }
        }

        
fclose(iFilePointer)
    }
}

public 
OnPlayerSpawn(id)
{
    if(!
is_user_alive(id))
        return

    new 
szLevel[10]
    
num_to_str(crxranks_get_user_level(id), szLevelcharsmax(szLevel))

    if(
TrieKeyExists(g_tArmorszLevel))
    {
        new 
iArmor
        TrieGetCell
(g_tArmorszLeveliArmor)
        
cs_set_user_armor(idiArmorCS_ARMOR_VESTHELM)
    }

Create a file in your "configs" folder named "RankSystemArmor.ini" and inside it add:

PHP Code:
# <level> = <armor amount>
0
0
0
0
0
0
0
0
0
10 
10 
Continue it for other levels.

2. AmmoPacks:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cromchat>
#include <crxranks>
#include <zombieplague>

#define PLUGIN_VERSION "1.0"

new Trie:g_tAP

public plugin_init()
{
    
register_plugin("CRXRanks: ZP Per Level"PLUGIN_VERSION"OciXCrom")
    
register_cvar("CRXRanksAPPL"PLUGIN_VERSIONFCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
}

public 
plugin_cfg()
{
    
g_tAP TrieCreate()
    
ReadFile()
}

public 
plugin_end()
{
    
TrieDestroy(g_tAP)
}

ReadFile()
{
    new 
szConfigsName[256], szFilename[256]
    
get_configsdir(szConfigsNamecharsmax(szConfigsName))
    
formatex(szFilenamecharsmax(szFilename), "%s/RankSystemAmmoPacks.ini"szConfigsName)

    new 
iFilePointer fopen(szFilename"rt")

    if(
iFilePointer)
    {
        new 
szData[64], szValue[32], szMap[32], szKey[32], bool:bRead trueiSize
        get_mapname
(szMapcharsmax(szMap))

        while(!
feof(iFilePointer))
        {
            
fgets(iFilePointerszDatacharsmax(szData))
            
trim(szData)

            switch(
szData[0])
            {
                case 
EOS'#'';': continue
                case 
'-':
                {
                    
iSize strlen(szData)

                    if(
szData[iSize 1] == '-')
                    {
                        
szData[0] = ' '
                        
szData[iSize 1] = ' '
                        
trim(szData)

                        if(
contain(szData"*") != -1)
                        {
                            
strtok(szDataszKeycharsmax(szKey), szValuecharsmax(szValue), '*')
                            
copy(szValuestrlen(szKey), szMap)
                            
bRead equal(szValueszKey) ? true false
                        
}
                        else
                        {
                            static const 
szAll[] = "#all"
                            
bRead equal(szDataszAll) || equali(szDataszMap)
                        }
                    }
                    else continue
                }
                default:
                {
                    if(!
bRead)
                        continue

                    
strtok(szDataszKeycharsmax(szKey), szValuecharsmax(szValue), '=')
                    
trim(szKey); trim(szValue)

                    if(!
szValue[0])
                        continue

                    
TrieSetCell(g_tAPszKeystr_to_num(szValue))
                }
            }
        }

        
fclose(iFilePointer)
    }
}

public 
crxranks_user_level_updated(idiLevelbool:bLevelUp)
{
    if(!
bLevelUp)
        return

    new 
szLevel[10]
    
num_to_str(iLevelszLevelcharsmax(szLevel))

    if(
TrieKeyExists(g_tAPszLevel))
    {
        new 
iAP
        TrieGetCell
(g_tAPszLeveliAP)
        
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + iAP)
        
CC_SendMessage(id"&x04* &x01You received &x04%i AmmoPacks &x01for reaching level &x03%i&x01."iAPiLevel)
    }

Create a file in your "configs" folder named "RankSystemAmmoPacks.ini" and inside it add:

PHP Code:
# <level> = <AmmoPacks amount>
100
100
100
100
100
100
100
100
100
10 
250 
Continue it for other levels.


I am using VIP system on my Zombie Plague server, and so it removes the basic armor what VIPs get at the round start. Could you make it to add + armor to basic armor?
Dexon is offline