AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   OciXCrom's Rank System [XP|Levels|Ranks] (https://forums.alliedmods.net/showthread.php?t=308540)

Alber9091 09-04-2019 16:32

Re: OciXCrom's Rank System [XP|Levels|Ranks]
 
Quote:

Originally Posted by OciXCrom (Post 2665889)
@Alber9091 - try 0.03, 0.19. You can use this and move the text to the desired location in order to see its coordinates (little buggy on the sides, still working on it).

Use $br$ to move the text on a new line.

0.01 0.20 suited much better.
Thanks.

OciXCrom 09-04-2019 17:07

Re: OciXCrom's Rank System [XP|Levels|Ranks]
 
https://img.shields.io/badge/update-...2019-green.svg
  • MySQL optimization.
  • Added a new setting SAVE_INTERVAL that allows you to enable additional periods when the XP is saved, rather than it happening only when the player disconnects. Now you can do it when the player dies, in the end of the round or every time when the XP amount is modified. The goal of this setting is to prevent XP loss in servers that have a tendency to crash.
  • Added 2 new XP Rewards: team_win and team_lose that are called when you win a round and lose a round, respectively.

In order to update from the previous version, you need to update the .sma file and add the following lines in the [Settings] section of the configuration file:

PHP Code:

# When to save the XP?
# It's best to leave this setting on 0 if your server isn't experiencing any problems (crashes) that prevent it from saving XP.
# 0 = on disconnect (best for servers that never crash)
# 1 = on disconnect + on death (good for servers that crash occasionally and you want to save the XP for at least the current life)
# 2 = on disconnect + on round end (good for servers that crash occasionally and you want to save the XP for at least the current round)
# 3 = every time the player's XP is changed (guarantees that XP will never be lost, but may be laggy if players receive XP very often)
SAVE_INTERVAL 

Quote:

Originally Posted by OciXCrom
@HamletEagle - I'll do the changes + the ones from your PM later today or tomorrow.

Tomorrow has finally come.

Quote:

Originally Posted by HamletEagle
g_aLevels seems to be an array for integers. Then cellsize should be 1, not 16.

Done.

Quote:

Originally Posted by HamletEagle
As I said before, your code can leak connections if a query fails. If you prematurely return from a function before a handle is freed you should also add SQL_FreeHandle before returning.

For example, at line 239: assume the if check passes because the query failed. You will print the error message and jump after SQL_FreeHandle(iSqlConnection) with a goto. This will cause a leak.

I think it should be fine now.

Quote:

Originally Posted by HamletEagle
In client_infochanged you should refactor to have the SAVE_TYPE check be first or right after is_user_connected check. There is no point in retrieving new/old name or doing anything for that matter if the saving method is not "name".

You missed this line:

PHP Code:

set_task(DELAY_ON_CHANGE"update_vip_status"id

If the name changes, his flags can change as well and this is independent of the SAVE_TYPE setting. This is yet another reason why we need client_flags_updated forward.

Quote:

Originally Posted by HamletEagle
Why do you wait 0.1 seconds in the mysql case instead of immediately calling save_or_load for loading.

Usually the name updates ~0.1 seconds after client_infochanged, but not sure why I didn't use szNewName right away. I changed it now.

Quote:

Originally Posted by HamletEagle
Also, do you think you could add a setting to control what happens on a name change? It can be right now, where you simply load whatever was saved on the new name or you could actually transfer the data from the old name to the new name and remove the old one from the vault/database.
I think this could be useful if a player gets sick of his old name, wants to play under a new one, but doesn't want to start from 0.

It's a possibility, yes. I'll leave it for a future update though, as I don't have much options for testing at the moment, plus this will need to be checked on player connect as well and compare the IP/SteamID data with the previous nickname, which is not possible at the moment, because only the IP/SteamID is saved when SAVE_TYPE is not ST_NICKNAME.

Quote:

Originally Posted by HamletEagle
It's probably time to remove Cmd_UpdateMySQL.

Yup.

Quote:

Originally Posted by HamletEagle
In sort_players_by_xp, you can just return g_ePlayerData[id2][XP] - g_ePlayerData[id1][XP]. This is common practice for short sorting functions.

So I assume "-1" and "1" are not the only valid return values as stated in the API and it actually checks if the value is positive or negative. Cool, I didn't know that.

Quote:

Originally Posted by HamletEagle
I know I pointed this out before, but I'll say again, just in case: inside save_or_load, in SL_SAVE_DATA you should free iSqlConnection or use SQL_FreeHandle inside SQL_QuoteString.

Yup. I made sure every variable tagged with Handle is freed at the end of its usage.

Quote:

Originally Posted by HamletEagle
In SL_LOAD_DATA case: I don't really like you make a connection, close it and then reopen immediately inside prepare_player. Keep the connection open and do both task with one connection, the information is already there.

Done.

Alber9091 09-04-2019 18:21

Re: OciXCrom's Rank System [XP|Levels|Ranks]
 
Quote:

Originally Posted by OciXCrom (Post 2665897)
https://img.shields.io/badge/update-...2019-green.svg

Added 2 new XP Rewards: team_win and team_lose

Add 2 more:

dead = -1
suicide -2

It will let points fluctuating and let full rank too change.

OciXCrom 09-04-2019 21:01

Re: OciXCrom's Rank System [XP|Levels|Ranks]
 
Quote:

Originally Posted by Alber9091 (Post 2665912)
Add 2 more:

dead = -1
suicide -2

It will let points fluctuating and let full rank too change.

I already added those in an earlier version. Check this link.

Alber9091 09-05-2019 10:51

Re: OciXCrom's Rank System [XP|Levels|Ranks]
 
can you add:
amx_reload_ranks.ini (Reloads RanksSystem.ini)
Helpful for servers like DM or maps with many rounds and single map.

amx_reset_ranks [Resets everyone XP back to 0- RCON flag].

amx_save_ranks [Manually saves ranks, regardless of save_interval] needed when some admin crashes servers himself like restart/shutdown.

OciXCrom 09-05-2019 13:20

Re: OciXCrom's Rank System [XP|Levels|Ranks]
 
Reloading the file during gameplay is not safe, especially if using MySQL and modifying the SQL server information. Same goes for changing the ranks and XP needed, it's not worth adding code to prevent errors in those cases.

You can reset the rank by modifying the VAULT_NAME or SQL_TABLE option depending on which save method you're using. A command for this is rather dangerous.

Ranks are saved when using "restart" or shutting down the server properly.

OciXCrom 09-15-2019 07:22

Re: OciXCrom's Rank System [XP|Levels|Ranks]
 
https://img.shields.io/badge/update-...2019-green.svg
  • Added 4 new XP Rewards: team_win_ct, team_win_t, team_lose_ct и team_lose_t.
  • Added a new native: crxranks_xp_reward_is_set

In order to update from the previous version, you need to update the .sma file and crxranks.inc.

Alber9091 09-15-2019 13:13

Re: OciXCrom's Rank System [XP|Levels|Ranks]
 
Better you had, client Command for hud.
/rankhudon
/rankhudoff

And it would be more better to use menu,
Would you like to see Ranks/XP Hud?
Yes
No

Once option selected, a message appears you can change it any time command /rankshud.

Its suggestion as I was using your plugin, but had to ultimately remove it as few 25% players liked the HUD & 75% didn't & some also complained of lag, because of Plugin.

OciXCrom 09-15-2019 17:27

Re: OciXCrom's Rank System [XP|Levels|Ranks]
 
The HUD can be turned of from the configuration file.
I will add a command to toggle the HUD by each player individually in the next update.
How did the players decide that the lag is coming from this plugin?! That's nonsense.

Alber9091 09-15-2019 19:11

Re: OciXCrom's Rank System [XP|Levels|Ranks]
 
Quote:

Originally Posted by OciXCrom (Post 2667093)
The HUD can be turned of from the configuration file.
I will add a command to toggle the HUD by each player individually in the next update.
How did the players decide that the lag is coming from this plugin?! That's nonsense.

I said they complained, I appreciate your work & may be they decided as that was the lastest plugin added and they felt that or may be the didn't like hud so, they made an excuse.

& Thanks for taking my suggestion into consideration.


All times are GMT -4. The time now is 13:01.

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