[REQ] Human XP System

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
itzBogdaN69
Извън линия
Foreigner
Foreigner
Мнения: 13
Регистриран на: 07 Авг 2018, 11:47
Се отблагодари: 1 път

[REQ] Human XP System

Мнение от itzBogdaN69 » 07 Авг 2018, 12:10

Hi guys. I need a plugin for zombie plague 7.2, that give on level up more damage, speed, decrease gravity and give ammo packs. (just for humans)
Plugin that I use for level up: OciXCrom's Rank System (https://forums.alliedmods.net/showthread.php?t=308540)
Thank you very much for payed attention.
Последно промяна от 1fRaNkkK на 07 Авг 2018, 12:14, променено общо 2 пъти.
Причина: Topic moved to the right place
Изображение

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

[REQ] Human XP System

Мнение от OciXCrom » 07 Авг 2018, 15:50

Zombie Plague 7.2 doesn't even exist or at least it's not the official version. Post your mod's .inc file so I can see what functions it has to offer.

Аватар
itzBogdaN69
Извън линия
Foreigner
Foreigner
Мнения: 13
Регистриран на: 07 Авг 2018, 11:47
Се отблагодари: 1 път

[REQ] Human XP System

Мнение от itzBogdaN69 » 07 Авг 2018, 16:16

Изображение

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

[REQ] Human XP System

Мнение от OciXCrom » 07 Авг 2018, 16:37

1. With this short plugin the rank system will work only for humans, aka zombies won't be able to receive XP:

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <crxranks>

native zp_get_user_zombie(id)

#define PLUGIN_VERSION "1.0"

public plugin_init()
{
	register_plugin("CRXRanks: Humans Only", PLUGIN_VERSION, "OciXCrom")
	register_cvar("CRXRanksHumansOnly", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
}

public crxranks_user_receive_xp(id)
	return zp_get_user_zombie(id) ? CRXRANKS_HANDLED : CRXRANKS_CONTINUE
2. Here's the plugin for the damage:

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <amxmisc>
#include <crxranks>
#include <hamsandwich>

native zp_get_user_zombie(id)

#define PLUGIN_VERSION "1.1-zp"

new Trie:g_tDamage
new g_szDamage[16][33]

public plugin_init()
{
	register_plugin("CRXRanks: Damage Per Level", PLUGIN_VERSION, "OciXCrom")
	register_cvar("CRXRanksDPL", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
	RegisterHam(Ham_TakeDamage, "player", "PreTakeDamage", 0)
	g_tDamage = TrieCreate()
	ReadFile()
}

public plugin_end()
	TrieDestroy(g_tDamage)
	
ReadFile()
{
	new szFilename[256]
	get_configsdir(szFilename, charsmax(szFilename))
	add(szFilename, charsmax(szFilename), "/RankSystemDamage.ini")
	
	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
						
					TrieSetString(g_tDamage, szKey, szValue)
				}
			}
		}
		
		fclose(iFilePointer)
	}
}

public PreTakeDamage(iVictim, iInflictor, iAttacker, Float:fDamage, iDamageBits)
{
	if(!is_user_connected(iAttacker) || zp_get_user_zombie(iAttacker) || !g_szDamage[iAttacker][0])
		return
	
	SetHamParamFloat(4, math_add_f(fDamage, g_szDamage[iAttacker]))
}

public client_putinserver(id)
	g_szDamage[id][0] = EOS

public crxranks_user_level_updated(id, iLevel)
{
	new szLevel[10]
	num_to_str(iLevel, szLevel, charsmax(szLevel))
		
	if(TrieKeyExists(g_tDamage, szLevel))
		TrieGetString(g_tDamage, szLevel, g_szDamage[id], charsmax(g_szDamage[]))
}

Float:math_add_f(Float:fNum, const szMath[])
{
	static szNewMath[16], Float:fMath, bool:bPercent, cOperator
   
	copy(szNewMath, charsmax(szNewMath), szMath)
	bPercent = szNewMath[strlen(szNewMath) - 1] == '%'
	cOperator = szNewMath[0]
   
	if(!isdigit(szNewMath[0]))
		szNewMath[0] = ' '
   
	if(bPercent)
		replace(szNewMath, charsmax(szNewMath), "%", "")
	   
	trim(szNewMath)
	fMath = str_to_float(szNewMath)
   
	if(bPercent)
		fMath *= fNum / 100
	   
	switch(cOperator)
	{
		case '+': fNum += fMath
		case '-': fNum -= fMath
		case '/': fNum /= fMath
		case '*': fNum *= fMath
		default: fNum = fMath
	}
   
	return fNum
}
In order to configure it, create a new file in your amxmodx/configs folder named RankSystemDamage.ini. Inside it, on each line, add the level number and the damage amount separated with the "=" symbol. The damage amount can be written like this:
  • 5 - this will set the damage of each attack to be exactly 5
  • +5 - this will add +5 damage to each attack
  • +5% - this will increase the damage of each attack with 5%
Here's some examples:

Код за потвърждение: Избери целия код

# <level number> = <damage amount>
1 = +5
2 = +10
3 = +15
4 = +20
5 = +25

Аватар
itzBogdaN69
Извън линия
Foreigner
Foreigner
Мнения: 13
Регистриран на: 07 Авг 2018, 11:47
Се отблагодари: 1 път

[REQ] Human XP System

Мнение от itzBogdaN69 » 07 Авг 2018, 16:38

Thank you very much, I will wait the rest.
Изображение

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

[REQ] Human XP System

Мнение от OciXCrom » 08 Авг 2018, 15:12

3. Speed plugin:

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <amxmisc>
#include <crxranks>
#include <fun>

native zp_get_user_zombie(id)

#define PLUGIN_VERSION "1.0-zp"

new Trie:g_tSpeed
new Float:g_fSpeed[33]

public plugin_init()
{
	register_plugin("CRXRanks: Speed Per Level", PLUGIN_VERSION, "OciXCrom")
	register_cvar("CRXRanksSPL", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
	register_event("CurWeapon", "OnChangeWeapon", "be", "1=1")
	g_tSpeed = TrieCreate()
	ReadFile()
}

public plugin_end()
	TrieDestroy(g_tSpeed)
	
ReadFile()
{
	new szFilename[256]
	get_configsdir(szFilename, charsmax(szFilename))
	add(szFilename, charsmax(szFilename), "/RankSystemSpeed.ini")
	
	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_tSpeed, szKey, str_to_float(szValue))
				}
			}
		}
		
		fclose(iFilePointer)
	}
}

public OnChangeWeapon(id)
{
	if(g_fSpeed[id] != 0.0)
		set_user_maxspeed(id, g_fSpeed[id])
}

public client_putinserver(id)
	g_fSpeed[id] = 0.0

public crxranks_user_level_updated(id, iLevel)
{
	new szLevel[10]
	num_to_str(iLevel, szLevel, charsmax(szLevel))
		
	if(TrieKeyExists(g_tSpeed, szLevel))
		TrieGetCell(g_tSpeed, szLevel, g_fSpeed[id])
}
Create a file in your amxmdox/configs folder called RankSystemSpeed.ini and add on each line the level and speed amount separated by "=":

Код за потвърждение: Избери целия код

# level = speed amount
1  = 250
2 = 255
3 = 260
4 = 265
5 = 270
# etc...
4. Gravity plugin:

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <amxmisc>
#include <crxranks>
#include <fun>
#include <hamsandwich>

native zp_get_user_zombie(id)

#define PLUGIN_VERSION "1.0-zp"

new Trie:g_tGravity
new Float:g_fGravity[33]

public plugin_init()
{
	register_plugin("CRXRanks: Gravity Per Level", PLUGIN_VERSION, "OciXCrom")
	register_cvar("CRXRanksGPL", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
	RegisterHam(Ham_Spawn, "player", "OnPlayerSpawn", 1)
	g_tGravity = TrieCreate()
	ReadFile()
}

public plugin_end()
	TrieDestroy(g_tGravity)
	
ReadFile()
{
	new szFilename[256]
	get_configsdir(szFilename, charsmax(szFilename))
	add(szFilename, charsmax(szFilename), "/RankSystemGravity.ini")
	
	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_tGravity, szKey, str_to_float(szValue))
				}
			}
		}
		
		fclose(iFilePointer)
	}
}

public OnPlayerSpawn(id)
{
	if(!is_user_alive(id) || g_fGravity[id] == 0.0)
		return

	set_user_gravity(id, g_fGravity[id])
}

public client_putinserver(id)
	g_fGravity[id] = 0.0

public crxranks_user_level_updated(id, iLevel)
{
	new szLevel[10]
	num_to_str(iLevel, szLevel, charsmax(szLevel))
		
	if(TrieKeyExists(g_tGravity, szLevel))
		TrieGetCell(g_tGravity, szLevel, g_fGravity[id])
}
Create a file in your amxmdox/configs folder called RankSystemGravity.ini and add on each line the level and gravity amount separated by "=":

Код за потвърждение: Избери целия код

# level = gravity amount
1  = 1.0
2 = 0.98
3 = 0.96
4 = 0.94
5 = 0.92
# etc...

Аватар
itzBogdaN69
Извън линия
Foreigner
Foreigner
Мнения: 13
Регистриран на: 07 Авг 2018, 11:47
Се отблагодари: 1 път

[REQ] Human XP System

Мнение от itzBogdaN69 » 09 Авг 2018, 15:12

Thank you man, you can close the post.
Изображение

Заключено
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Заявки за плъгини”

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 13 госта