OciXCrom [XP | Level | Ranks] Damage Per Level

Въпроси и проблеми свързани с AMXModX.
Аватар
carrx
Извън линия
Foreigner
Foreigner
Мнения: 12
Регистриран на: 17 Апр 2020, 13:49
Се отблагодари: 1 път

OciXCrom [XP | Level | Ranks] Damage Per Level

Мнение от carrx » 21 Апр 2020, 18:55

Hehe its too much! People are shocked to see zombies with lots of life and run away. But why this addon changes the basic value of life from 5000 to 17000? Shouldn't it look like this?
Level 5 : 5750
Level 12: 6800
Level 26: 8900

Instead i have:
Level 5 : 17750
Level 12: 18800
Level 26: 20900

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

OciXCrom [XP | Level | Ranks] Damage Per Level

Мнение от OciXCrom » 21 Апр 2020, 21:15

It depends on your crxranks_hpl_mode setting. If it's set to 1, the amount will be ADDED to the player's current amount. If it's 0, it will set it to what it's set in the file.

Аватар
carrx
Извън линия
Foreigner
Foreigner
Мнения: 12
Регистриран на: 17 Апр 2020, 13:49
Се отблагодари: 1 път

OciXCrom [XP | Level | Ranks] Damage Per Level

Мнение от carrx » 22 Апр 2020, 10:53

OM! Im so sorry! Its working perfect! Look what i did im stupid:

[post]
1 = 150
2 = 300
3 = 450
... etc
72 = 10800
73 = 10950
74 = 11100
75 = 11250
76 = 11400
77 = 11550
78 = 11700
79 = 11850
80 = 12000
1 = 12150
2 = 12300
3 = 12450
4 = 12600
5 = 12750
6 = 12900
7 = 13050
8 = 13200
9 = 13350
10 = 13500
11 = 13650
12 = 13800
13 = 13950
14 = 14100
15 = 14250
16 = 14400
17 = 14550
18 = 14700
19 = 14850
20 = 15000[/post]
I forgot to end file to 100!

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

OciXCrom [XP | Level | Ranks] Damage Per Level

Мнение от OciXCrom » 22 Апр 2020, 14:14

Nice. :coolface:

If everything is working as it should, can the thread be closed now?

Аватар
carrx
Извън линия
Foreigner
Foreigner
Мнения: 12
Регистриран на: 17 Апр 2020, 13:49
Се отблагодари: 1 път

OciXCrom [XP | Level | Ranks] Damage Per Level

Мнение от carrx » 23 Апр 2020, 09:33

I have another problem :( in my LOGS:
Извън темата
[AMXX] Displaying debug trace (plugin "crxranks_damage_per_level.amxx", version "1.2-zp")
[AMXX] Run time error 4: index out of bounds
[AMXX] [0] crxranks_damage_per_level.sma::crxranks_user_level_updated (line 110)
[AMXX] Displaying debug trace (plugin "crxranks_damage_per_level.amxx", version "1.2-zp")
[AMXX] Run time error 4: index out of bounds
[AMXX] [0] crxranks_damage_per_level.sma::client_putinserver (line 100)
[AMXX] Displaying debug trace (plugin "crxranks_damage_per_level.amxx", version "1.2-zp")
[AMXX] Run time error 4: index out of bounds
[AMXX] [0] crxranks_damage_per_level.sma::PreTakeDamage (line 92)

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

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

native zp_get_user_zombie(id)

#define PLUGIN_VERSION "1.2-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
	crxranks_user_level_updated(id, crxranks_get_user_level(id), false)
}

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
}
Have Zombie Plague 5.0.8

Аватар
atmax
Извън линия
Потребител
Потребител
Мнения: 492
Регистриран на: 22 Мар 2018, 15:06
Се отблагодари: 37 пъти
Получена благодарност: 43 пъти

OciXCrom [XP | Level | Ranks] Damage Per Level

Мнение от atmax » 23 Апр 2020, 10:14

An invalid cell has been used that goes over the maximum value. Try changing this:

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

new g_szDamage[16][33]
to this:

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

new g_szDamage[][33]
If it doesn't work, set it to higher value.
Rest in peace my friend I always will remember you! 🖤👊

Аватар
mi0
Извън линия
AMXX Скриптър
AMXX Скриптър
Мнения: 534
Регистриран на: 09 Дек 2016, 22:02
Се отблагодари: 97 пъти
Получена благодарност: 120 пъти
Обратна връзка:

OciXCrom [XP | Level | Ranks] Damage Per Level

Мнение от mi0 » 23 Апр 2020, 10:51

atmax написа: 23 Апр 2020, 10:14 An invalid cell has been used that goes over the maximum value. Try changing this:

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

new g_szDamage[16][33]
to this:

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

new g_szDamage[][33]
If it doesn't work, set it to higher value.
This type of declaration requires initialization so it wouldn't be an option in this case. The second dimenssion of the array has 33 elements which seems kind of odd(exactly 33?) so I can assume someone just swapped them accidentaly.

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

new g_szDamage[33][16]
aka kurdokoleno
Catch Mod - 87.121.112.232:27021

Аватар
carrx
Извън линия
Foreigner
Foreigner
Мнения: 12
Регистриран на: 17 Апр 2020, 13:49
Се отблагодари: 1 път

OciXCrom [XP | Level | Ranks] Damage Per Level

Мнение от carrx » 23 Апр 2020, 11:24

atmax написа: 23 Апр 2020, 10:14 An invalid cell has been used that goes over the maximum value. Try changing this:

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

new g_szDamage[16][33]
to this:

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

new g_szDamage[][33]
If it doesn't work, set it to higher value.
This not work at all. Not granting more damage. But thx ;)
mi0 написа: 23 Апр 2020, 10:51
atmax написа: 23 Апр 2020, 10:14 An invalid cell has been used that goes over the maximum value. Try changing this:

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

new g_szDamage[16][33]
to this:

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

new g_szDamage[][33]
If it doesn't work, set it to higher value.
This type of declaration requires initialization so it wouldn't be an option in this case. The second dimenssion of the array has 33 elements which seems kind of odd(exactly 33?) so I can assume someone just swapped them accidentaly.

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

new g_szDamage[33][16]
Not add damage :(

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

OciXCrom [XP | Level | Ranks] Damage Per Level

Мнение от OciXCrom » 23 Апр 2020, 20:43

It should be g_szDamage[33][16], like mi0 said.

Аватар
carrx
Извън линия
Foreigner
Foreigner
Мнения: 12
Регистриран на: 17 Апр 2020, 13:49
Се отблагодари: 1 път

OciXCrom [XP | Level | Ranks] Damage Per Level

Мнение от carrx » 24 Апр 2020, 01:11

Thx! It worked! Guys you help me with everything. I think its time to close ;) thx again!

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

Обратно към “Поддръжка / Помощ”

Кой е на линия

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