Raised This Month: $ Target: $400
 0% 

save connections with nvault


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Afro-Ankan
Member
Join Date: Jul 2009
Location: Sweden
Old 07-29-2010 , 18:39   Re: save connections with nvault
Reply With Quote #1

thank you. it works
Afro-Ankan is offline
Send a message via MSN to Afro-Ankan
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-29-2010 , 19:31   Re: save connections with nvault
Reply With Quote #2

When using nvault_get to retrieve a string, you need to pass the string variable along w\ maxlen value. Passing only 3 parameters will make the function think you are trying to retrieve a float byref. In this instance, it would be best to use nvault_get to retrieve an integer (only pass vault handle and key). Also, make sure to close the vault. There is a tutorial in the code snippets\tuts section.

How nvault_get functions based on # params:
2 parameters - function returns integer value
3 parameters - function sets float byref
4 parameters - function sets string byref for maxlen chars

Untested
PHP Code:
#include <amxmodx>
#include <nvault>

new gConnectVault

public plugin_init()
{
    
gConnectVault nvault_open("ConnectVault")
    
    if(
gConnectVault == INVALID_HANDLE)
        
set_fail_state("nVault failed to open")
}

public 
plugin_end()
{
    
nvault_closegConnectVault );
}

public 
client_putinserverid )
{
    static 
szAuthID34 ] , szName33 ] , szTemp] , iConnections;
    
get_user_authidid szAuthID charsmaxszAuthID ) );
    
get_user_nameid szName charsmaxszName ) );

    
iConnections nvault_getgConnectVault szAuthID );
    
    
num_to_str( ++iConnections szTemp charsmaxszTemp ) );
    
nvault_setgConnectVault szAuthID szTemp );

    
client_printprint_chat "* %s has connected and now has %d connections" szName iConnections );

__________________

Last edited by Bugsy; 07-29-2010 at 19:34.
Bugsy is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 07-29-2010 , 19:45   Re: save connections with nvault
Reply With Quote #3

Using client_authorized() is not better than client_putinserver() for the SteamID ?
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Reply



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 00:18.


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