Hey.
I'm trying to make a "pointsystem" you get xx points for killing then shows your points instead of rank..
wen i write /points it print out "* You have Points - [v0.0.1]" and i dont know what i've done wrong etc, please help me.
Thanks in advance.
PHP Code:
/* Plugin generated by AMXX-Studio */
new const PLUGIN[] = "Point"
new const VERSION[] = "0.0.1"
new const AUTHOR[] = "hannes"
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <chatcolor>
new Points[33]
new XP_Kill,XP_Knife,XP_Hs,SaveXP,g_vault
new PointStart
new g_iAuthID[33][36]
new g_first_time[32];
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("DeathMsg", "eDeath", "a")
XP_Kill=register_cvar("XP_per_kill", "20")
XP_Hs=register_cvar("XP_hs_bonus","20")
XP_Knife=register_cvar("XP_knife_bonus","20")
g_vault = nvault_open("point")
PointStart = register_cvar ( "amx_startpoints", "20" )
register_clcmd("say /points", "SayPoints")
register_clcmd("say_team /points", "SayPoints")
}
public eDeath( )
{
new attacker = read_data( 1 )
new headshot = read_data( 3 )
new clip, ammo, weapon = get_user_weapon(attacker,clip,ammo);
Points[attacker] += get_pcvar_num(XP_Kill)
if(headshot)
Points[attacker] += get_pcvar_num(XP_Hs)
if(weapon == CSW_KNIFE)
Points[attacker] += get_pcvar_num(XP_Knife)
SaveData(attacker)
}
public SayPoints(id)
{
ColorChat(id, GREY, "^4*^3 You have ^4%s^3 Points -^3 [^4v%s^3]", Points , VERSION);
}
public client_authorized( id )
{
get_user_authid(id, g_iAuthID[ id ] , charsmax( g_iAuthID[] ) );
Load(id);
}
public Load(id)
{
static data[256], timestamp;
if( nvault_lookup(g_vault, g_iAuthID[id], data, sizeof(data) - 1, timestamp) )
{
LoadData(id);
}
else
{
NewUser(id);
}
}
public NewUser(id)
{
g_first_time[id] = 1;
new start = get_pcvar_num ( PointStart )
Points[id] = start;
}
public client_disconnect(id)
{
if(get_pcvar_num(SaveXP) == 1)
{
SaveData(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#",Points[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#",Points[id])
nvault_get(g_vault,vaultkey,vaultdata,255)
replace_all(vaultdata, 255, "#", " ")
new points[32]
parse(vaultdata, points, 31)
Points[id] = str_to_num(points)
return PLUGIN_CONTINUE
}
__________________