Raised This Month: $32 Target: $400
 8% 

OciXCrom's Rank System [XP|Levels|Ranks]


Post New Thread Reply   
 
Thread Tools Display Modes
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-12-2018 , 18:17   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #151

It does have such an option. If MySQL doesn't work, data will be saved in nVault. There's no point in using both of them at the same time though. I'll make a plugin that allows you to transfer the data from nVault to MySQL.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-28-2018 , 15:07   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #152


  • In order to update from version 3.0 to version 3.1, it is NOT required to replace the configration file as it doesn't include any changes.
  • IMPORTANT (READ IF YOU ARE USING MYSQL): the new update includes a change in the MySQL saving method that requires you to change the SQL table that you're using, aka change the SQL_TABLE setting. Bear in mind that this will restart the players' XP. In order to transfer the XP from the old table, use the server command crxranks_update_mysql CRXRanks only once - where CRXRanks is the name of the SQL table that you used in the old version. The command is accessible only through the server's console (if you don't have access to it, use amx_rcon crxranks_update_mysql CRXRanks). There's no need to do any of this if you're using nVault to save the XP.
  • MySQL now stores the player's level, rank, next rank and XP required for the next rank as well. This is very useful to those who want to create a webpanel for displaying player data, as well as creating top15 which will be created soon as a sub-plugin.
  • Added a new native crxranks_get_setting which allows you to read a setting from the [Settings] section in the configuration file. With this addition, it is now possible to add new settings in the configuration file which can be read by other plugins.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 12-29-2018 , 12:25   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #153

nice update, soon we will have a web stats page!

i have 53 ranks on my server, and a lot of players already reached the max level, before i reset the rank, i wanted some new features, this one blood2k suggested is the one more interesting

Quote:
Originally Posted by blood2k View Post
Hey two quick questions:

- Does this system do a weighted XP system? Like when a noob player kills a higher ranked player he gets more XP and vice versa? High ranked player loses MORE XP when dieing to a lower ranked player?
i will also do a hall of fame every month making a mdl board with top 15 players + rank and LvL with details from the server stats and make it using photoshop and add in each map on my servers, this will be very cool
tarsisd2 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-29-2018 , 14:51   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #154

It's a good idea and it can be done. If you have a suggestion on how the "weighted" system is going to work, let me hear it. Do you want it to use some math formula in order to determine the XP a player is going to receive based on the other player's XP or how?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 12-29-2018 , 17:05   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #155

Quote:
Originally Posted by OciXCrom View Post
It's a good idea and it can be done. If you have a suggestion on how the "weighted" system is going to work, let me hear it. Do you want it to use some math formula in order to determine the XP a player is going to receive based on the other player's XP or how?
lets say
level from 0 - 8 has 2 points extra on all events
level 9 - 17 has 3 points extra
level 18 - 25 has 4 points
level 26 - 34 has 5 points
level 35 - 42 has 6 points
and so on

when level 5 which has ( 2 ) kills level 31 ( 5 ), he gets the value of his points = 5
when its the other way and level 31 ( 5 ) kills level 5 ( 2 ), he gets his points value which is = 2

lvl 26 ( 5 ) kills lvl 17 ( 4 ) he gets = 4 points
lvl 11 ( 3 ) kills lvl 38 ( 6 ) he gets = 6 points
lvl 19 ( 5 ) kills lvl 8 ( 2 ) he gets = 2 points

all can be set by cvar, and can be extra points for events like, + 2 from headshot, + 3 knife + 2 nade, +2 plant or defuse or explode

so when a low rank player kills a veteran, he gets way more points, and a veteran has to kill good players to get good XP, if he just kills low rank players, he gets very low points

the important thing i want, is that all the points gained, are extracted from the victim, like if a low ranked player kills me and i'm worth 5 points, he gets 5 points + 2 from headshot as example, and those 5 points are removed from me as well, a lose - 5 points, kind like gameME works

this is my math, everyone can help us make it better, its like a gambling system which makes players more addicted to the game server

i will add weapons skins and player skins ( if you make it ) based on the rank like you weapons and knife plugins, ranks and exp will be high so it will be hard, i will have like 60 or more ranks and lvl, so it will be an amazing server

other thing i want is too give a bonus of +2 XP for assistance kill, which i'm using too, when the player makes 60% dmg and another player kills, he gets assistance + 1 frag, so he could get +2 XP as bonus!
tarsisd2 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-31-2018 , 08:39   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #156

Try this:

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

#define PLUGIN_VERSION "1.0"

new Trie:g_tWeightg_iWeight[33]

public 
plugin_init()
{
    
register_plugin("CRXRanks: Weighted XP"PLUGIN_VERSION"OciXCrom")
    
register_cvar("CRXRanksWXP"PLUGIN_VERSIONFCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
    
register_event("DeathMsg""OnPlayerKilled""a")
    
g_tWeight TrieCreate()
    
ReadFile()
}

public 
plugin_end()
    
TrieDestroy(g_tWeight)
    
ReadFile()
{
    new 
szConfigsName[256], szFilename[256]
    
get_configsdir(szConfigsNamecharsmax(szConfigsName))
    
formatex(szFilenamecharsmax(szFilename), "%s/RankSystemWeight.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_tWeightszKeystr_to_num(szValue))
                }
            }
        }
        
        
fclose(iFilePointer)
    }
}

public 
client_putinserver(id)
    
crxranks_user_level_updated(idcrxranks_get_user_level(id), true)

public 
crxranks_user_level_updated(idiLevelbool:bLevelUp)
{
    
g_iWeight[id] = 0

    
for(new szI[8], iLevel0i--)
    {
        
num_to_str(iszIcharsmax(szI))
        
        if(
TrieGetCell(g_tWeightszIg_iWeight[id]))
            break
    }
}

public 
OnPlayerKilled()
{
    new 
iAttacker read_data(1), iVictim read_data(2)
    
    if(!
is_user_connected(iAttacker) || iAttacker == iVictim || !g_iWeight[iVictim])
        return

    
crxranks_give_user_xp(iAttackerg_iWeight[iVictim], _CRXRANKS_XPS_REWARD)
    
crxranks_give_user_xp(iVictimg_iWeight[iVictim] * -1_CRXRANKS_XPS_REWARD)
}

public 
crxranks_user_receive_xp(idiXPCRXRanks_XPSources:iSource)
    return (
g_iWeight[id] && iSource == CRXRANKS_XPS_REWARD) ? (iXP g_iWeight[id]) : CRXRANKS_CONTINUE 
Create a file in your "configs" folder named "RankSystemWeight.ini" and add in it the following:

PHP Code:
# <level> = <xp weight>
2
3
18 
4
26 
5
35 

For example, "18 = 4" means that players that reached level 18 will have a XP weight of 4.

When a player kills another player, he will receive the XP weight of the killed player, and the killed player will lose XP according to his own XP weight.

For example, player A has a XP weight of 4 and player B has 6.
If player A kills player B, player A will receive 6 XP and player B will lose 6 XP.

When a player receives any kind of XP that is set in the [XP Rewards] section in "RankSystem.ini", he will also receive the amount of XP weight he has.

For example, "headshot" is set to 2 in the configuration file and player B kills player A - player B will get the XP weight of player A which is 4 + the "headshot" event of 2 (+ any other events set in the .ini file) which will result in him gaining 6 XP. Player A will lose only 4 XP as this is his XP weight.

Let me know if things are working as they should, since I haven't tested the plugin. Also let me know if you want me to change something.
Using a formula to determine the XP weight can make the plugin work without an .ini file and make it much smaller, so let me know if you figure out some kind of formula. For example, XP weight = player level * 20 / 100.

About the assistance plugin you're using - post it here. Only 1 line needs to be added in order for it to give XP on assist.
__________________

Last edited by OciXCrom; 01-01-2019 at 18:25.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 01-02-2019 , 09:30   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #157

Quote:
Originally Posted by OciXCrom View Post
Try this:

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

#define PLUGIN_VERSION "1.0"

new Trie:g_tWeightg_iWeight[33]

public 
plugin_init()
{
    
register_plugin("CRXRanks: Weighted XP"PLUGIN_VERSION"OciXCrom")
    
register_cvar("CRXRanksWXP"PLUGIN_VERSIONFCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
    
register_event("DeathMsg""OnPlayerKilled""a")
    
g_tWeight TrieCreate()
    
ReadFile()
}

public 
plugin_end()
    
TrieDestroy(g_tWeight)
    
ReadFile()
{
    new 
szConfigsName[256], szFilename[256]
    
get_configsdir(szConfigsNamecharsmax(szConfigsName))
    
formatex(szFilenamecharsmax(szFilename), "%s/RankSystemWeight.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_tWeightszKeystr_to_num(szValue))
                }
            }
        }
        
        
fclose(iFilePointer)
    }
}

public 
client_putinserver(id)
    
crxranks_user_level_updated(idcrxranks_get_user_level(id), true)

public 
crxranks_user_level_updated(idiLevelbool:bLevelUp)
{
    
g_iWeight[id] = 0

    
for(new szI[8], iLevel0i--)
    {
        
num_to_str(iszIcharsmax(szI))
        
        if(
TrieGetCell(g_tWeightszIg_iWeight[id]))
            break
    }
}

public 
OnPlayerKilled()
{
    new 
iAttacker read_data(1), iVictim read_data(2)
    
    if(!
is_user_connected(iAttacker) || iAttacker == iVictim || !g_iWeight[iVictim])
        return

    
crxranks_give_user_xp(iAttackerg_iWeight[iVictim], _CRXRANKS_XPS_REWARD)
    
crxranks_give_user_xp(iVictimg_iWeight[iVictim] * -1_CRXRANKS_XPS_REWARD)
}

public 
crxranks_user_receive_xp(idiXPCRXRanks_XPSources:iSource)
    return (
g_iWeight[id] && iSource == CRXRANKS_XPS_REWARD) ? (iXP g_iWeight[id]) : CRXRANKS_CONTINUE 
Create a file in your "configs" folder named "RankSystemWeight.ini" and add in it the following:

PHP Code:
# <level> = <xp weight>
2
3
18 
4
26 
5
35 

For example, "18 = 4" means that players that reached level 18 will have a XP weight of 4.

When a player kills another player, he will receive the XP weight of the killed player, and the killed player will lose XP according to his own XP weight.

For example, player A has a XP weight of 4 and player B has 6.
If player A kills player B, player A will receive 6 XP and player B will lose 6 XP.

When a player receives any kind of XP that is set in the [XP Rewards] section in "RankSystem.ini", he will also receive the amount of XP weight he has.

For example, "headshot" is set to 2 in the configuration file and player B kills player A - player B will get the XP weight of player A which is 4 + the "headshot" event of 2 (+ any other events set in the .ini file) which will result in him gaining 6 XP. Player A will lose only 4 XP as this is his XP weight.

Let me know if things are working as they should, since I haven't tested the plugin. Also let me know if you want me to change something.
Using a formula to determine the XP weight can make the plugin work without an .ini file and make it much smaller, so let me know if you figure out some kind of formula. For example, XP weight = player level * 20 / 100.

About the assistance plugin you're using - post it here. Only 1 line needs to be added in order for it to give XP on assist.
thanks, i will test it today

do you know what this is?

PHP Code:
L 01/02/2019 12:27:35: [crx_ranksystemMysql.amxx] [SQL ErrorQuery failed (1064): You have an error in your SQL syntaxcheck the manual that corresponds to your MySQL server version for the right syntax to use near ''STEAM' at line 1
L 01/02/2019 - 12:27:37: [crx_ranksystemMysql.amxx] [SQL Error] Query failed (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''STEAM_' 
at line 1 
tarsisd2 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-02-2019 , 09:58   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #158

You updated to version v3.1 but you didn't do what was told in the update description. Read the part marked with IMPORTANT - https://forums.alliedmods.net/showpo...&postcount=152
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 01-02-2019 , 10:26   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #159

Quote:
Originally Posted by OciXCrom View Post
You updated to version v3.1 but you didn't do what was told in the update description. Read the part marked with IMPORTANT - https://forums.alliedmods.net/showpo...&postcount=152
i did read it, but it says to use amx_rcon crxranks_update_mysql CRXRanks to update the database, but i don't want to update it, i want to start all again, even my VAULT_NAME and SQL_TABLE is different from before, so i still need to use that command and update it?

edit: and i just started using mysql, i have no old tables

Last edited by tarsisd2; 01-02-2019 at 10:33.
tarsisd2 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-02-2019 , 13:20   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #160

If you want to start over, just change the "SQL_TABLE" option to a new name, otherwise it will give you that error.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply



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 22:26.


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