Member
|
08-25-2019
, 12:00
Re: OciXCrom's Rank System [XP|Levels|Ranks]
|
#316
|
Quote:
Originally Posted by OciXCrom
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_VERSION, FCVAR_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(szConfigsName, charsmax(szConfigsName))
formatex(szFilename, charsmax(szFilename), "%s/RankSystemArmor.ini", szConfigsName)
new iFilePointer = fopen(szFilename, "rt")
if(iFilePointer)
{
new szData[64], szValue[32], szMap[32], szKey[32], bool:bRead = true, iSize
get_mapname(szMap, charsmax(szMap))
while(!feof(iFilePointer))
{
fgets(iFilePointer, szData, charsmax(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(szData, szKey, charsmax(szKey), szValue, charsmax(szValue), '*')
copy(szValue, strlen(szKey), szMap)
bRead = equal(szValue, szKey) ? true : false
}
else
{
static const szAll[] = "#all"
bRead = equal(szData, szAll) || equali(szData, szMap)
}
}
else continue
}
default:
{
if(!bRead)
continue
strtok(szData, szKey, charsmax(szKey), szValue, charsmax(szValue), '=')
trim(szKey); trim(szValue)
if(!szValue[0])
continue
TrieSetCell(g_tArmor, szKey, str_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), szLevel, charsmax(szLevel))
if(TrieKeyExists(g_tArmor, szLevel))
{
new iArmor
TrieGetCell(g_tArmor, szLevel, iArmor)
cs_set_user_armor(id, iArmor, CS_ARMOR_VESTHELM)
}
}
Create a file in your "configs" folder named "RankSystemArmor.ini" and inside it add:
PHP Code:
# <level> = <armor amount>
1 = 0
2 = 0
3 = 0
4 = 0
5 = 0
6 = 0
7 = 0
8 = 0
9 = 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_VERSION, FCVAR_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(szConfigsName, charsmax(szConfigsName))
formatex(szFilename, charsmax(szFilename), "%s/RankSystemAmmoPacks.ini", szConfigsName)
new iFilePointer = fopen(szFilename, "rt")
if(iFilePointer)
{
new szData[64], szValue[32], szMap[32], szKey[32], bool:bRead = true, iSize
get_mapname(szMap, charsmax(szMap))
while(!feof(iFilePointer))
{
fgets(iFilePointer, szData, charsmax(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(szData, szKey, charsmax(szKey), szValue, charsmax(szValue), '*')
copy(szValue, strlen(szKey), szMap)
bRead = equal(szValue, szKey) ? true : false
}
else
{
static const szAll[] = "#all"
bRead = equal(szData, szAll) || equali(szData, szMap)
}
}
else continue
}
default:
{
if(!bRead)
continue
strtok(szData, szKey, charsmax(szKey), szValue, charsmax(szValue), '=')
trim(szKey); trim(szValue)
if(!szValue[0])
continue
TrieSetCell(g_tAP, szKey, str_to_num(szValue))
}
}
}
fclose(iFilePointer)
}
}
public crxranks_user_level_updated(id, iLevel, bool:bLevelUp)
{
if(!bLevelUp)
return
new szLevel[10]
num_to_str(iLevel, szLevel, charsmax(szLevel))
if(TrieKeyExists(g_tAP, szLevel))
{
new iAP
TrieGetCell(g_tAP, szLevel, iAP)
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + iAP)
CC_SendMessage(id, "&x04* &x01You received &x04%i AmmoPacks &x01for reaching level &x03%i&x01.", iAP, iLevel)
}
}
Create a file in your "configs" folder named "RankSystemAmmoPacks.ini" and inside it add:
PHP Code:
# <level> = <AmmoPacks amount>
1 = 100
2 = 100
3 = 100
4 = 100
5 = 100
6 = 100
7 = 100
8 = 100
9 = 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?
|
|