Raised This Month: $ Target: $400
 0% 

[Help] point system


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
hannes
Member
Join Date: Sep 2010
Old 10-20-2014 , 03:09   Re: [Help] point system
Reply With Quote #11

Quote:
Originally Posted by zmd94 View Post
Please close your nVault.
PHP Code:
public plugin_end()
{
    
nvault_close(g_vault)


Had to edit
Code:
public client_authorized( id )
{
    get_user_authid(id, g_iAuthID[ id ] , charsmax( g_iAuthID[] ) );
    LoadData(id)
}
Edit:
Now the code looks like this :
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 g_iAuthID[33][36]
new 
Points[33]
new 
XP_Kill
new XP_Knife
new XP_Hs
new g_vault


public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
 
    
register_event("DeathMsg""eDeath""a") ;
    
    
XP_Kill register_cvar("XP_per_kill""2");
    
XP_Hs register_cvar("XP_hs_bonus","2");
    
XP_Knife register_cvar("XP_knife_bonus","2");
    
g_vault nvault_open("point");
    
    
register_clcmd("say /points""SayPoints");
    
register_clcmd("say_team /points""SayPoints");
}

public 
eDeath(  ) 
{
    new 
attacker read_data)
    new 
headshot read_data)
    new 
clipammoweapon 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 
plugin_end()
{
    
nvault_close(g_vault)
}

public 
SayPoints(id)
{
    
ColorChat(idGREY"^4*^3 You have ^4%d^3 Points -^3 [^4v%s^3]" Points[id] , VERSION );
}

public 
client_authorizedid )
{
    
get_user_authid(idg_iAuthIDid ] , charsmaxg_iAuthID[] ) );
    
LoadData(id)
}

public 
client_disconnect(id)
{
    
SaveData(id)
}

public 
SaveData(id)
{
    new 
AuthID[35]
    
get_user_authid(id,AuthID,34)

    new 
vaultkey[64]
    new 
vaultdata[256]

    
format(vaultkey,63,"%s-Mod",AuthID)
    
format(vaultdata,255,"%i#",Points[id])

    
nvault_setg_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(vaultdata255"#"" ")
 
    new 
points[32]
 
    
parse(vaultdatapoints31)
 
    
Points[id] = str_to_num(points)
 
    return 
PLUGIN_CONTINUE

Should i change anything? or isit good like this?
thanks!
__________________

Last edited by hannes; 10-20-2014 at 03:41.
hannes is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:49.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode