Hi, I am building building an xp mod with some classes, but I can't seem to get it working.
It should be loading xp and lvl from each class, and it's this sentence that is wrong:
PHP Code:
format(vaultkey,63,"Jumper-%s-%i-xp",authid,CLASSES[sum]);
and it's the %i and the CLASSES[sum].
I really hope someone can help me
When I compile it doesn't point out any errors, but when I run it on debug it says:
Code:
L 05/09/2009 - 20:53:35: [AMXX] Displaying debug trace (plugin "xp-mod.amxx")
L 05/09/2009 - 20:53:35: [AMXX] Run time error 4: index out of bounds
L 05/09/2009 - 20:53:35: [AMXX] [0] xp-mod.sma::LoadXP (line 103)
L 05/09/2009 - 20:53:35: [AMXX] [1] xp-mod.sma::client_connect (line 120)
L 05/09/2009 - 20:53:35: [admin.amxx] Login: "[JPro] ReTaRD [ToY]<14><>" became an admin (account "STEAM_0:0:22688377") (access "abcdefghijklmnopqrstu") (address "217.60.224.194")
L 05/09/2009 - 20:53:43: [AMXX] Displaying debug trace (plugin "xp-mod.amxx")
L 05/09/2009 - 20:53:43: [AMXX] Run time error 4: index out of bounds
L 05/09/2009 - 20:53:43: [AMXX] [0] xp-mod.sma::LoadXP (line 103)
L 05/09/2009 - 20:53:43: [AMXX] [1] xp-mod.sma::ChooseJumper (line 147)
PHP Code:
#define MAXCLASSES 5
new const CLASSES[MAXCLASSES][] = {
"None",
"Jumper",
"BHopper",
"CHopper",
"Noob"
}
PHP Code:
public LoadXP(id)
{
new authid[32];
get_user_authid(id,authid,31);
new vaultkey[64], vaultdata[64];
new i
new sum;
for (i=1; i<=MAXCLASSES; i++)
{
//Load their XP
format(vaultkey,63,"Jumper-%s-%i-xp",authid,CLASSES[sum]);
get_vaultdata(vaultkey,vaultdata,63);
PlayerXP[id] = str_to_num(vaultdata);
//Load their level
format(vaultkey,63,"Jumper-%s-%i-level",authid,CLASSES[sum]);
get_vaultdata(vaultkey,vaultdata,63);
PlayerLevel[id] = str_to_num(vaultdata);
sum += i;
}
}
Regards
[JPro] ReTaRD [ToY]