What you need is a statpointcount() function that would count their StatusPoint, including points they already put into stats (similar to skillpointcount).
Here you go! statpointcount.txt
The script functions are based on trunk/src/map/pc.c::pc_need_status_point() ~line 5900
/// Returns the number of stat points needed to change the specified stat by val.
/// If val is negative, returns the number of stat points that would be needed to
/// raise the specified stat from (current value - val) to current value.
int pc_need_status_point(struct map_session_data* sd, int type, int val)
{
PS: yes, we could have just created a 'statpointcount' script command with about 25 lines of code from pc_resetstate() (vs 600 lines of script) but writing the script was more fun!You could trigger this script with OnPCLoginEvent by replacing lines 3-40 with this:
- script check_statpoints -1,{
OnPCLoginEvent:
if (getgmlevel() > 50) end;
function pc_need_status_point; // src/map/pc.c
function pc_maxparameter;
function read_statpoint_table; // db/re/statpoint.txt OR db/pre-re/statpoint.txt
set .@should_have, read_statpoint_table(BaseLevel) + ( Class&EAJ_UPPERMASK ? 52 : 0 );
//==== statpointcount() ====================================================
set .@actual_statpoint,
pc_need_status_point(bStr, 1-readparam(bStr)) +
pc_need_status_point(bAgi, 1-readparam(bAgi)) +
pc_need_status_point(bVit, 1-readparam(bVit)) +
pc_need_status_point(bInt, 1-readparam(bInt)) +
pc_need_status_point(bDex, 1-readparam(bDex)) +
pc_need_status_point(bLuk, 1-readparam(bLuk)) +
StatusPoint;
//==========================================================================
if (.@actual_statpoint > .@should_have) {
set .@name$, strcharinfo(0);
mes "We have detected your stats are over the limit.";
mes "You will be disconnected shortly. Please contact a GM.";
atcommand "@kick " + .@name$;
atcommand "@block " + .@name$;
debugmes .@name$ + " was blocked for having more stat points than normal.";
atcommand "@request <-- was blocked for having more stat points than normal.";
}
end;