AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   nvault code help (https://forums.alliedmods.net/showthread.php?t=56921)

fxfighter 06-24-2007 06:48

nvault code help
 
this code dosent load can you help me and plz only post back if you can help me..

Code:


#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <fun>
#include <cstrike>
 
#define PLUGIN "nVault"
#define VERSION "1.0"
#define AUTHOR "...."
 
new g_vault
new IP[33]
new XP[33]
new CLASS[33]
public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    g_vault = nvault_open("VAULT")
    register_event("ResetHUD","event_spawn","be")
    register_event( "DeathMsg", "eDeath", "a" )
}
public client_putinserver(id)
{
    LoadData(id)
}
public client_disconnect(id) {
    SaveData(id)
 
    XP[id] = 0
    CLASS[id] = 0
    IP[id] = 0
}
public SaveData(id)
{
    new AuthID[35]
    get_user_authid(id,AuthID,34)
 
    new vaultkey[64],vaultdata[256]
    format(vaultkey,63,"%s-FX",AuthID)
    format(vaultdata,255,"%i#%i#",XP[id],CLASS[id])
    nvault_set(g_vault,vaultkey,vaultdata)
    return PLUGIN_HANDLED
}
public LoadData(id)
{
    new AuthID[35]
    get_user_authid(id,AuthID,34)
 
    new vaultkey[64],vaultdata[256]
    format(vaultkey,63,"%s-FX",AuthID)
    format(vaultdata,255,"%i#%i#",XP[id],CLASS[id])
    nvault_get(g_vault,vaultkey)
    return PLUGIN_HANDLED
}
public event_spawn(id)
{
ShowHud(id)
}
public eDeath( )

new attacker = read_data(1)
XP[attacker] += 20
ShowHud(attacker)
}
public ShowHud(id)
{
set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)
show_hudmessage(id, "CLASS: %i^nXP: %i",CLASS[id],XP[id])
}


mateo10 06-24-2007 07:09

Re: nvault code help
 
I think this will work.
Replace your loading function with this:
Code:
public LoadData(id) {     new AuthID[35]     get_user_authid(id,AuthID,34)       new vaultkey[64],vaultdata[256]     format(vaultkey,63,"%s-FX",AuthID)     format(vaultdata,255,"%i#%i#",XP[id],CLASS[id])     nvault_get(g_vault,vaultkey,vaultdata,255)     replace_all(vaultdata, 255, "#", " ")     new playerxp[32], playerclass[32]     parse(vaultdata, playerxp, 31, playerclass, 31)     XP[id] = str_to_num(playerxp)     CLASS[id] = str_to_num(playerclass)     return PLUGIN_HANDLED }

fxfighter 06-24-2007 07:20

Re: nvault code help
 
Thx it worked i never give karma but you deserve it :)

mateo10 06-24-2007 08:25

Re: nvault code help
 
No problem. I'm glad to help.


All times are GMT -4. The time now is 21:28.

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