Raised This Month: $110 Target: $400
 27% 

Health per Level


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
luciaus18
Senior Member
Join Date: Dec 2014
Old 02-27-2021 , 17:00   Health per Level
Reply With Quote #1

Hi! I'm using CRXRanks: Health Per Level and I want that to be replaced with hp steal per level for kill/headshot. Thanks!
luciaus18 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-02-2021 , 14:58   Re: Health per Level
Reply With Quote #2

How can it be HP steal if the player is dead?

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

#define PLUGIN_VERSION "1.0"

new Trie:g_tHealth
new Trie:g_tHealthHS

public plugin_init()
{
    
register_plugin("CRXRanks: Health on Kill"PLUGIN_VERSION"OciXCrom")
    
register_cvar("CRXRanksHPOnKill"PLUGIN_VERSIONFCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
    
RegisterHam(Ham_Spawn"player""OnPlayerSpawn"1)
    
register_event("DeathMsg""OnPlayerKilled""a")
}

public 
plugin_cfg()
{
    
g_tHealth TrieCreate()
    
g_tHealthHS TrieCreate()
    
ReadFile()
}

public 
plugin_end()
{
    
TrieDestroy(g_tHealth)
    
TrieDestroy(g_tHealthHS)
}
    
ReadFile()
{
    new 
szConfigsName[256], szFilename[256]
    
get_configsdir(szConfigsNamecharsmax(szConfigsName))
    
formatex(szFilenamecharsmax(szFilename), "%s/RankSystemHealthOnKill.ini"szConfigsName)
    
    new 
iFilePointer fopen(szFilename"rt")
    
    if(
iFilePointer)
    {
        new 
szData[64], szValue[16], szValue2[8], 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

                    
parse(szValueszValuecharsmax(szValue), szValue2charsmax(szValue2))                        
                    
TrieSetCell(g_tHealthszKeystr_to_num(szValue))
                    
TrieSetCell(g_tHealthHSszKeystr_to_num(szValue2))
                }
            }
        }
        
        
fclose(iFilePointer)
    }
}

public 
OnPlayerKilled()
{
    new 
iAttacker read_data(1), iVictim read_data(2)

    if(
is_user_connected(iAttacker) && iAttacker != iVictim)
    {
        new 
szLevel[8], iLevel crxranks_get_user_level(iAttacker)
        
num_to_str(iLevelszLevelcharsmax(szLevel))

        new 
iHealth
        TrieGetCell
(read_data(3) ? g_tHealthHS g_tHealthszLeveliHealth)
        
set_user_health(iAttackerget_user_health(iAttacker) + iHealth)
    }

Example RankSystemHealthOnKill.ini:

PHP Code:
#======================================================#
# CRXRanks: Health On Kill Configuration file          #
#======================================================#
# This plugin requires OciXCrom's Rank System to work  #
#======================================================#

# Add each health amount on a new line following the format:
# <level number> = <health on normal kill> <health on headshot>

0 0
1 2
2 3
5 10 

Last edited by OciXCrom; 03-02-2021 at 14:59.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
luciaus18
Senior Member
Join Date: Dec 2014
Old 03-02-2021 , 16:19   Re: Health per Level
Reply With Quote #3

I was thinking about the same way as vip plugin works with hp steal per kill/headshot. Everytime you are alive it set the amount of hp that you can steal per kill/headshot as your level is set to give.
I'm gonna test it now
luciaus18 is offline
luciaus18
Senior Member
Join Date: Dec 2014
Old 03-05-2021 , 16:47   Re: Health per Level
Reply With Quote #4

Doesn't work
luciaus18 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-05-2021 , 17:07   Re: Health per Level
Reply With Quote #5

Explain.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
luciaus18
Senior Member
Join Date: Dec 2014
Old 03-06-2021 , 16:22   Re: Health per Level
Reply With Quote #6

Well you are right. I was confused first time about what u said, it's just hp per kill/headshot.

Explanation: I don't get hp per kill/headshot at any level. It doesn't work, idk why. Plugin is running but not working

Other thing that I want is to implement something to play for on my server, I mean to merge the xp system with achievements. For example zombiemod or hero mod which have something to play for.
These mods have implemented extra items. I want something like this for normal server, for example: at lvl 15 you get laser gun, you get this just for 3 rounds or till you die. Or idk, some extra abilities. Give me an advice please

Last edited by luciaus18; 03-06-2021 at 16:29.
luciaus18 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-06-2021 , 17:21   Re: Health per Level
Reply With Quote #7

Quote:
Well you are right. I was confused first time about what u said, it's just hp per kill/headshot.

Explanation: I don't get hp per kill/headshot at any level. It doesn't work, idk why. Plugin is running but not working
Let me see your .ini file.

Quote:
Other thing that I want is to implement something to play for on my server, I mean to merge the xp system with achievements. For example zombiemod or hero mod which have something to play for.
These mods have implemented extra items. I want something like this for normal server, for example: at lvl 15 you get laser gun, you get this just for 3 rounds or till you die. Or idk, some extra abilities. Give me an advice please
No advice would be viable if you don't know how to make plugins.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
luciaus18
Senior Member
Join Date: Dec 2014
Old 03-06-2021 , 17:26   Re: Health per Level
Reply With Quote #8

Quote:
Originally Posted by OciXCrom View Post
Let me see your .ini file.



No advice would be viable if you don't know how to make plugins.

Well, I don't..

Ini:
Code:
#======================================================#
# CRXRanks: Health On Kill Configuration file          #
#======================================================#
# This plugin requires OciXCrom's Rank System to work  #
#======================================================#

# Add each health amount on a new line following the format:
# <level number> = <health on normal kill> <health on headshot>

10 = 3 1
11 = 5 3
12 = 8 5
13 = 10 8
14 = 10 10
15 = 10 12
16 = 10 14
17 = 11 16
18 = 12 18
20 = 13 20
21 = 14 20
22 = 15 20
23 = 16 20
24 = 17 20
25 = 18 20
26 = 19 20
27 = 20 20
28 = 21 23
29 = 22 24
30 = 25 25
luciaus18 is offline
North_Fiv3
Junior Member
Join Date: Mar 2021
Old 03-12-2021 , 12:55   Re: Health per Level
Reply With Quote #9

So it doesn't work? The idea sounds good,I would like to use this plugin too.
Hp steal is called for the other games xD
North_Fiv3 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:59.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode