AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   I need help in Saving Data :P (https://forums.alliedmods.net/showthread.php?t=65329)

flyeni6 01-06-2008 00:41

I need help in Saving Data :P
 
This is the only thing i didnt care to learn about lol.
anyways how can i save data, for example
"2 xp for each headshot made"
"1 xp for each kill made"
and then they can be loaded and saved in valut or a separate file
and i can just type "/xpstats"
then a hud will tell me how much xp i have or a MoTD

Is there any recent tutorials? or can someone show me how to do this?

thank you :)

taheri6 01-06-2008 02:21

Re: I need help in Saving Data :P
 
This isnt a tutorial, but you can look here
http://forums.alliedmods.net/showthr...highlight=SQLX

This one isnt recent, but its still very relevant. I used this to convert uwc3 mod to sqlx from the old DBI

http://forums.alliedmods.net/showthread.php?t=46779

flyeni6 01-06-2008 02:38

Re: I need help in Saving Data :P
 
Thanks for replying :)
well mostly what im asking for is a tutorial that can tell me how i can code plugins and save them in Nvault or something

taheri6 01-06-2008 04:16

Re: I need help in Saving Data :P
 
Check into this for SQLite
http://forums.alliedmods.net/showthr...ghlight=SQLite

Drak 01-06-2008 04:35

Re: I need help in Saving Data :P
 
Quote:

Originally Posted by flyeni6 (Post 570782)
Thanks for replying :)
well mostly what im asking for is a tutorial that can tell me how i can code plugins and save them in Nvault or something

I don't think there is one. But it's not that hard.
Code:
#include <amxmodx> #include <nvault> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "Drak" new g_Vault public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)             /*     * It's best to open a vault on plugin start     * and close it on "plugin_end"     * This also creates a vault file in "amxmodx/data/vault" automatically.     */     g_Vault = nvault_open("my_vault"); } SaveSomeInfo(id) {     //Save some random info, by a players SteamID     new SteamID[36]     get_user_authid(id,SteamID,35)         // The vault file would now hold a value similar to this:     // STEAM_ID_BLAH 123     nvault_set(g_Vault,SteamID,"123"); } // Let's load what we just saved LoadSomeInfo(id) {     new SteamID[36]     get_user_authid(id,SteamID,35);         // If the key was found, continue.     if(nvault_lookup(g_Vault,SteamID,data,255,timestamp))     {         new AuthID[36],Value[33]         parse(data,AuthID,35,Value,32);                 new ValueNum = str_to_num(Value);                 // AUTHID would return are saved SteamID         // ValueNum now holds "123"         // Value holds the string "123"     }     // No Data was found with that key     else     {     } } public plugin_end()     nvault_close(g_Vault);
It's commented.. Kinda.. It might help some.

flyeni6 01-06-2008 18:24

Re: I need help in Saving Data :P
 
thanks ill add some more code to what you did and post it here to see if it is good enough


All times are GMT -4. The time now is 11:05.

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