Raised This Month: $ Target: $400
 0% 

nvault problems


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 10-15-2015 , 10:30   nvault problems
Reply With Quote #1

Hello i got some nvault problems.
So i been working on this plugin which makes so you can marry other people on the server.

The saving works great it saves the users SteamID and the user steamid + name he is married. The thing that is not working is the loading part. It works whenever you are alone in the server or with other people you are not married to.

But when the guy/girl you are married to joins the server the plugin will loads my marriage + theirs marriage information. I just want it just to load their marriage information.
When it loads my marriage information too it messes up the names. How could i solve this?


This is the nvault code im currently using.
Code:
When someone gets married i save it like this
	SaveData( id, g_iPlayer[id]);
	SaveData( g_iPlayer[id], id );

public client_disconnect(id) 
{
	if(g_iMarriedSteamID[id] != 0 )
		UpdateName(id)
}
	
public client_putinserver(id)
	LoadData(id)


public UpdateName(id) 
{	
	new szSteamID[32], szName[32]
	get_user_authid(id, szSteamID, charsmax(szSteamID))
	get_user_name(id, szName, charsmax(szName))
	
	formatex(g_VaultData, charsmax(g_VaultData), "%s %s", szSteamID, szName)
	nvault_set(g_Vault, g_iMarriedSteamID[id], g_VaultData)

	return PLUGIN_HANDLED
}
public SaveData(id, id2) 
{
	new szSteamID[32], szName[32], szName2[32], szSteamID2[32]
	get_user_authid(id, szSteamID, charsmax(szSteamID))
	get_user_authid(id2, szSteamID2, charsmax(szSteamID2))
	
	get_user_name(id, szName, charsmax(szName))
	get_user_name(id2, szName2, charsmax(szName2))
	
	copy(g_iMarriedSteamID[id2], 32, szSteamID)
	copy(g_iMarriedName[id2], 32, szName)
	
	copy(g_iMarriedSteamID[id], 32, szSteamID2)
	copy(g_iMarriedName[id], 32, szName2)

	formatex(g_VaultData, charsmax(g_VaultData), "%s %s", szSteamID2, szName2)
	nvault_set(g_Vault, szSteamID, g_VaultData)
	
	server_print("SAVE steamid: %s. Marriedsteamid: %s marriedname: %s", szSteamID, g_iMarriedSteamID[id], g_iMarriedName[id])
}
public LoadData(id) 
{
	new szSteamID[32]
	get_user_authid(id, szSteamID, charsmax(szSteamID))
	
	new iTimeStamp
	if(!nvault_lookup(g_Vault, szSteamID, g_VaultData, charsmax(g_VaultData), iTimeStamp) )
		return PLUGIN_HANDLED

	new MarriedSteamID[32], MarriedName[32]
	nvault_get(g_Vault, szSteamID, g_VaultData, charsmax(g_VaultData))
	parse(g_VaultData, MarriedSteamID, charsmax(MarriedSteamID), MarriedName, charsmax(MarriedName))
	
	copy(g_iMarriedSteamID[id], 32, MarriedSteamID)
	copy(g_iMarriedName[id], 32, MarriedName)
	
	server_print("LOAD steamid: %s. Marriedsteamid: %s marriedname: %s", szSteamID, g_iMarriedSteamID[id], g_iMarriedName[id])
	
	return PLUGIN_HANDLED
}
Ps. I dont want to switch to SQL
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.

Last edited by ironskillz1; 10-15-2015 at 10:33.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:10.


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