While Chdata's functions do seem particularly useful, I'm afraid I still can't figure this out, sorry. It's been ages since I touched SourcePawn and I've completely forgotten how to do this stuff, heh.
After doing a bit of poking around, I've found myself with an exception getting thrown up: "Couldn't load SDK function (CTFWeaponBase::GetMaxClip1)." I've got the gamedata file from Chdata's post installed, and spcomp compiles my modified plugin with only a tag mismatch warning, so I don't know what I'm doing wrong.
Here's what my modified code looks like:
Code:
else if(StrEqual(attrib, "reload clip on damage"))
{
new String:values[2][10];
ExplodeString(value, " ", values, sizeof(values), sizeof(values[]));
DamageReloads[client][slot] = true;
new hWeapon = GetSlotContainingAttribute(client, DamageReloads);
new maxClip = GetMaxClip(hWeapon);
DamageReloads_Damage[client][slot] = StringToFloat(values[0]);
DamageReloads_Max[client][slot] = maxClip;
g_fTotalDamage1296[client] = 0.0;
action = Plugin_Handled;
}
EDIT: And for comparison, here's the unmodified code:
Code:
else if(StrEqual(attrib, "reload clip on damage"))
{
new String:values[2][10];
ExplodeString(value, " ", values, sizeof(values), sizeof(values[]));
DamageReloads[client][slot] = true;
DamageReloads_Max[client][slot] = StringToFloat(values[0]);
DamageReloads_Damage[client][slot] = StringToFloat(values[1]);
g_fTotalDamage1296[client] = 0.0;
action = Plugin_Handled;
}
(I know I don't need the ExplodeString stuff in my version since I'm trying to reduce it from two values required to just one, but I'm trying to take this one step at a time right now)
spcomp tells me the tag mismatch is on the "DamageReloads_Max = maxClip;" line, and the stack trace that Sourcemod gives me on the server just points to the line where I added "OnPluginStart_RegisterWeaponData();" in the plugin, which doesn't really tell me much. I couldn't quite figure it out with my own SDKCall either, but I forget what exactly happened there, I think it just didn't function properly in-game. I'll try again later to see if I can figure it out.
In the meantime, is there something obviously wrong with my code here that needs fixing? ^^;