Help with XP plz
well, i was testing this plugin, and the thing is what, when i kill somebody, it doesn't give me XP
PHP Code:
#include <amxmodx> #include <amxmisc> #include <nvault>
new PlayerXP[33],PlayerLevel[33] new XP_Kill, SaveXP new g_vault
new const LEVELS[7] = { 0, 100, 200, 400, 800, 1600, 3200 }
public plugin_init() { register_plugin("Boxing_levels", "1.0", "Zapdos1") //Cvars SaveXP = register_cvar("amx_svxp","1") XP_Kill=register_cvar("amx_xpkill", "20") //nvault g_vault = nvault_open("boxingmodd") //clcmd register_clcmd("say /myboxxp", "ShowHud") //dictionary register_dictionary("boxing.txt") }
public eDeath( ) { new attacker = read_data(1) PlayerXP[attacker] += get_pcvar_num(XP_Kill) while(PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]]) { client_print(attacker, print_chat, "[AMXX] %L", LANG_PLAYER, "LEVEL_MESSAGE", PlayerLevel[attacker]) PlayerLevel[attacker] += 1 } ShowHud(attacker) }
public ShowHud(id) { set_hudmessage(255, 0, 0, 0.1, 0.8, 0, 6.0, 12.0) show_hudmessage(id, "Level: %i^nXP: %i",PlayerLevel[id],PlayerXP[id]) }
public client_connect(id) { if(get_pcvar_num(SaveXP) == 1) { LoadData(id) } }
public SaveData(id) { new AuthID[35] get_user_authid(id,AuthID,34) new vaultkey[64],vaultdata[256] format(vaultkey,63,"%s-Mod",AuthID) format(vaultdata,255,"%i#%i#",PlayerXP[id],PlayerLevel[id]) nvault_set(g_vault,vaultkey,vaultdata) return PLUGIN_CONTINUE }
public LoadData(id) { new AuthID[35] get_user_authid(id,AuthID,34)
new vaultkey[64],vaultdata[256] format(vaultkey,63,"%s-Mod",AuthID) format(vaultdata,255,"%i#%i#",PlayerXP[id],PlayerLevel[id]) nvault_get(g_vault,vaultkey,vaultdata,255) replace_all(vaultdata, 255, "#", " ") new playerxp[32], playerlevel[32] parse(vaultdata, playerxp, 31, playerlevel, 31) PlayerXP[id] = str_to_num(playerxp) PlayerLevel[id] = str_to_num(playerlevel) return PLUGIN_CONTINUE }
|