AlliedModders

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

Zenith77 10-12-2005 23:04

nVault help...
 
Basically I need help with the eniter thing.


How would i look up a players, lets say for the sake of this post xp.



e.g. I want to looks up player Jon's xp through his steamid .


thnx

v3x 10-12-2005 23:22

This should help you:
Code:
#include <amxmodx> #include <nvault> #define VAULTNAME "MyVault" // The name of your vault file new g_VaultHandle; public plugin_init() {   // ... } public savexp( id ) {   g_VaultHandle = nvault_open(VAULTNAME);   // Check if the vault opens properly?   if( g_VaultHandle == INVALID_HANDLE )   {     log_amx("Error opening nVault file: %s", VAULTNAME);   }   // Create some vars and get the player's auth id   new szAuthID[33], szXP[21], TimeStamp;   get_user_authid(id, szAuthID, 32);   // Get their XP   nvault_lookup(g_VaultHandle, szAuthID, szXP, 20, TimeStamp)   // Add XP   new iXPamt, iXPcurrent;   iXPamt = str_to_num(szXP); // Their current amount of stored XP   iXPamt += iXPcurrent // Add 2 totals together, iXPcurrent being their current XP amount   // Now we need to convert iXPamt to a string   new szXPamt[21];   num_to_str(iXPamt, szXPamt, 20);   // Save the XP to vault   nvault_set(g_VaultHandle, szAuthID, szXPamt); }
NOTE: nvault_close is still broken so all of the data will be reset if the server crashes or restarts!

jtp10181 10-12-2005 23:24

actually nvault_close.... doesn;t crash anymore like it used to, but the nvault is totally useless in 1.60 because it doesn;t really save anything to the vault file.

v3x 10-12-2005 23:27

I wasn't saying it did :P

I was saying IF the server happened to crash it would reset/erase the data.


All times are GMT -4. The time now is 23:46.

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