Re: [HELP] XpMOD
Quote:
Originally Posted by Buckshot
(Post 2116837)
PHP Code:
#include <amxmodx> #include <fvault> #include <ColorChat>
new const g_vault_name[] = "EXP_MOD"; new const g_vault_lvl[] = "LVL_MOD"; new const LEVELS[7] = { 30, //lvl 0 80, //lvl 1 220, //lvl 2 370, //lvl 3 600, //lvl 4 1500, //lvl 5 5000 //lvl 6 }
new g_exp[33],g_lvl[33]; new XP_Kill,XP_Knife,XP_Hs,syncObj
public plugin_init() { register_plugin("XpMod", "1.0", "JustGo") register_event("DeathMsg", "eDeath", "a") XP_Kill=register_cvar("XP_per_kill", "2") XP_Hs=register_cvar("XP_hs_bonus","3") XP_Knife=register_cvar("XP_knife_bonus","3") syncObj = CreateHudSyncObj() }
public eDeath() //function name { // Create a variable to store the attacker's id new attacker = read_data( 1 ) // We create the victim variable, so that this function can check // if a player was killed new iVictim = read_data( 2 ) // If a player was killed by a HeadShot, this will be used for the cvar Xp_Hs new headshot = read_data( 3 ) if(attacker == iVictim) { return PLUGIN_HANDLED } //which weapon was used new clip, ammo, weapon = get_user_weapon(attacker,clip,ammo); // used for the xp_hs cvar // it checks if the victim was killed by a headshot if(headshot) { g_exp[attacker] += get_pcvar_num(XP_Hs) } else if(weapon == CSW_KNIFE) { g_exp[attacker] += get_pcvar_num(XP_Knife) } else { g_exp[attacker] += get_pcvar_num(XP_Kill) } while(g_exp[attacker] >= LEVELS[g_lvl[attacker]]) { g_lvl[attacker] += 1 ColorChat(attacker, NORMAL, "^4[Nex] ^4Congratulations! ^1You are level^3 %i ", g_lvl[attacker]) } SaveExp(attacker) return PLUGIN_HANDLED }
public show(id) { new target[32],body; new szName[ 32 ] get_user_aiming( id, target, body ) get_user_name( target, szName, charsmax( szName ) ) set_hudmessage(0, 255, 0, -1.0, 0.9, 0, 6.0, 12.0) if( target > 0 ) { ShowSyncHudMsg(id,syncObj, "Name: %s | Level: %i | Exp: %i/%i", szName, g_lvl[ target ], g_exp[ target ], LEVELS[g_lvl[ target ]]) } }
public client_putinserver(plr) { if( !is_user_hltv(plr) && !is_user_bot(plr) ) { LoadExp(plr); } set_task(1.0, "show", plr, _, _, "b") }
public client_disconnect(plr) { if( g_exp[plr] > 0 ) { SaveExp(plr); g_exp[plr] = 0; } }
SaveExp(plr) { new authid[35]; get_user_authid(plr, authid, sizeof(authid) - 1); new data2[16]; num_to_str(g_lvl[plr], data2, sizeof(data2) - 1); fvault_set_data(g_vault_lvl, authid, data2); new data[16]; num_to_str(g_exp[plr], data, sizeof(data) - 1); fvault_set_data(g_vault_name, authid, data); }
LoadExp(plr) { new authid[35]; get_user_authid(plr, authid, sizeof(authid) - 1); new data2[16]; if( fvault_get_data(g_vault_lvl, authid, data2, sizeof(data2) - 1) ) { g_lvl[plr] = str_to_num(data2); } else { g_lvl[plr] = 0; } new data[16]; if( fvault_get_data(g_vault_name, authid, data, sizeof(data) - 1) ) { g_exp[plr] = str_to_num(data); } else { g_exp[plr] = 0; } }
Try this.. I do not know if it compiles at all since i don't have the fvault include.. But hopefully it works
|
Code:
get_user_aiming( id, target, body )
Error: Array must be indexed (variable "target") on line 77
Error: Argument type mismatch (argument 2) on line 72
Error: Argument type mismatch (argument 1) on line 73
Error: Array must be indexed (variable "target") on line 75
*Edit:*
But if i Alive if you can make like this
Level | exp
if im spec on someone i mean if im dead so Name | level | exp
|