AlliedModders

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

v3x 04-23-2005 07:49

Vault, help?
 
Alright, I've given up on MySQL totally.. Now here's my little test thing-a-ma-do.. But whenever I say "vault_test", it always comes up with "Vault data entered!". What I'm trying to do is check and see if the current data exists in the file, if it doesn't, then it enters a new line or whatever; if it does, it won't touch the current data. Thanks for the help. ;)
Code:
#include <amxmodx> public plugin_init() {     register_plugin("Vault data test","0.1","v3x")     register_clcmd("say vault_test","Vault_Test") } public Vault_Test(id) {     new authID[30]     get_user_authid(id,authID,29)     new name[33]     get_user_name(id,name,32)     new vData[78]     format(vData,77,"%s_%s_1337",authID,name)     if(!vaultdata_exists(vData)) {         set_vaultdata(vData)         client_print(id,print_chat,"Vault data entered!")     }     else if(vaultdata_exists(vData)) {         //set_vaultdata(vData2)         client_print(id,print_chat,"Vault data already exists!")     }     return PLUGIN_HANDLED }

XxAvalanchexX 04-23-2005 12:19

a) You never actually used set_vaultdata

b) Why are you saving it with their name? o_O

v3x 04-23-2005 12:21

a) Huh?

b) It's just a simple plugin to get me used to using Vault.

:)

BioHazardousWaste 04-23-2005 15:04

V3x.. you screwed up on this line here.. suprised you didn't get a missing parameter error:

set_vaultdata(vData)

what you need to do is save some data INTO the key vData. I would do it like this.

Code:
#include <amxmodx> public plugin_init() {     register_plugin("Vault data test","0.1","v3x")     register_clcmd("say vault_test","Vault_Test") } public Vault_Test(id) {     new authID[30]     get_user_authid(id,authID,29)     new name[33]     get_user_name(id,name,32)     //adding here     new vKey[78]     format(vKey,77, "%s", authID)     //this ^^ will be your key (or reference)     new vData[78]     format(vData,77,"%s_%s_1337",authID,name)     //this ^^ will be the data you are actually saving     if(!vaultdata_exists(vData)) {         set_vaultdata(vKey, vData)//fixed this line, to save vData into vKey         client_print(id,print_chat, "User %s (SteamID %s) saved to vault!", name, authID)//adding a better msg lol     }     else if(vaultdata_exists(vData)) {         //set_vaultdata(vData2)         client_print(id,print_chat,"User %s (SteamID %s) already exists!", name, authID)//adding another better message :P         client_print     }     return PLUGIN_HANDLED }


That should fix it up for you :)

XxAvalanchexX 04-23-2005 16:29

Oh, okay, rofl you did, you just didn't put anything into it. ;-) Nice catch Bio.

BioHazardousWaste 04-23-2005 16:51

:) Usually not too hard to find someone else's error. Just not your own lol

v3x 04-23-2005 20:57

Damn Bio, you're doin good so far for a week of coding.. :) Thanks for the PM btw, I'll read it when my brain is more awake cause I just woke up.

BioHazardousWaste 04-23-2005 21:29

Thanx :) done programming in VB and Java so that really helps. You just woke up? What time zone are you in? It's 9:30 here lol

v3x 04-23-2005 21:30

Yep, 9:30 here, too. I pulled an all-nighter, then fell asleep (not WENT to sleep!) around 3ish.

BioHazardousWaste 04-23-2005 21:42

lmao, i was up till about 3:30 and up around 2:00... 11 hours is enough for me :P


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

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