AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Introduction to vaults (https://forums.alliedmods.net/showthread.php?t=82564)

Jon 12-25-2008 19:34

Introduction to vaults
 
So I'm total new to vaults and I've decided to use FVault since PS uses it. I just need a little kick in the ass to understand how it works, things are so much easier with examples. So if someone could give me a little example which contains this:
  • Create the vault
  • Save a players steamid and name
  • Retrive the info
It would have been extremely helpful. And btw, where did those crabs come from? :O :crab::crab:

Exolent[jNr] 12-25-2008 23:24

Re: Introduction to vaults
 
You could use PointSystem plugin as an example.

Code:
#include <amxmodx> #include <amxmisc> #include <fvault> new const g_vault_name[] = "test_vault"; new g_name[33][35]; new g_steamid[33][35]; public client_authorized(client) {     get_user_authid(client, g_steamid[client], sizeof(g_steamid[]) - 1);         if( !LoadUserName(client) )     {         get_user_name(client, g_name[client], sizeof(g_name[]) - 1);         SaveUserName(client);     }         client_print(0, print_chat, "%s has connected!", g_name[client]); } public client_disconnect(client) {     if( !g_steamid[client][0] )     {         // client disconnected before authorizing         return;     }         client_print(0, print_chat, "%s has disconnected!", g_name[client]);         g_name[client][0] = 0;     g_steamid[client][0] = 0; } LoadUserName(client) {     return fvault_get_data(g_vault_name, g_steamid[client], g_name[client], sizeof(g_name[]) - 1); } SaveUserName(client) {     fvault_set_data(g_vault_name, g_steamid[client], g_name[client]); }

This code saves the player's name that the player used the first time they joined the server, and prints it to everyone when the player [dis]connects.

Jon 12-26-2008 09:15

Re: Introduction to vaults
 
Thanks alot, working on the plugin now :)

Still, where did the crabs come from?


All times are GMT -4. The time now is 09:17.

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