View Single Post
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 02-10-2012 , 00:43   Re: [ANY] tLevelMod v0.1.3 (2010-04-05)
Reply With Quote #97

Hiya Thrawn; I came across this snippet today thanks to the most recent post and decided to use it as the basis of a Dodgeball RPG plugin I've been working on for a little while. I've modified the script a bit, but I've fixed the clientpref issue and added MySQL support. You're free to copy/paste what you want into your actual plugin, but just note that I changed a lot of variable names to suit my coding style (less it sneer me everytime I work with it). There were some other updates as well, so I'll just post the revision log for the attached files:
Quote:
Added internal support for ClientPrefs into levelmod, removing the need for levelmod.permanent.clientprefs.sp. This was more so required to make it function properly.
Added support saving/loading information to a SQL database, table/database.cfg entry "levelmod" by default.
--- Note; You could export your clientpref data to another sqlite database and use it with the sql support feature.
Added proper support for loading levelmod.core late, so that data is loaded without requiring a map change.
Modified various segments of code for personal reasons and for minor adjustments/improvements.
Modified client loading process for ClientPrefs to a method that I know functions properly (shouldn't be a race condition issue anymore).
Fixed a few timer issues, while not necessarily harmful, could have caused issues later down the road in future development.
Raised the hardcoded level support of levelmod.core to 1000, as opposed to 101, as well as the cvar cap.
Modified several natives to return values based on whether or not a client had properly loaded.
--- lm_SetClientLevel, lm_SetClientXP, lm_GiveXP, lm_GiveLevel return true is successful, false if not loaded
--- lm_GetClientLevel, lm_GetClientXP, lm_GetClientXPNext return -1 if not loaded, otherwise correct value.
Added forward lm_OnCoreLoad, which fires when levelmod.core is loaded for the first time.
Added forward lm_OnClientLoad, which fires when a client is successfully loaded by levelmod.core
Added cvar sm_lm_exp_savemethod, which determines the save method for levelmod.core: (0 = Disabled, 1 = ClientPrefs, 2 = Database)
Added cvar sm_lm_exp_savefrequency, which saves clients lvl/exp every x seconds (0 = Disabled, Default: 15 minutes)
--- Note: The original clientprefs save plugin would only save on levelup/disconnect; both are true for the internal version, but this is extra incase of crash / long maps.
Added extra checks to ensure a client's Next Level EXP is always -1 if at max level.
Added native lm_IsClientLoaded, which checks if a client has been fully loaded by levelmod.core.
The experience table is now created only at plugin launch (delayed 0.1 seconds after), and upon change of cvar sm_lm_exp_reqmulti.
Levelmod.core now creates a cvar config file, which should be located somewhere along the lines of <game>/<config>/sourcemod/levelmod.core.cfg
Added cvar sm_lm_exp_savebots, which will save bots under their name if sm_lm_exp_savemethod is set to 2.
It should be noted that the attached files didn't get any real form of strenuous testing, but they're methods I use in dozens of other plugins without issue so there shouldn't be any problems.
Attached Files
File Type: inc levelmod.inc (3.6 KB, 203 views)
File Type: sp Get Plugin or Get Source (levelmod.core.sp - 456 views - 24.4 KB)
File Type: smx levelmod.core.smx (12.0 KB, 210 views)
__________________

Last edited by thetwistedpanda; 02-10-2012 at 00:48.
thetwistedpanda is offline