Raised This Month: $32 Target: $400
 8% 

[INC] SQLVault


Post New Thread Reply   
 
Thread Tools Display Modes
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-30-2012 , 00:33   Re: [INC] SQLVault
Reply With Quote #61

No need to format the key, just use the Steam ID.

Also, there are special sqlv_get_num() and sqlv_set_num() methods if you are using numbers instead of strings.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 04-30-2012 , 10:14   Re: [INC] SQLVault
Reply With Quote #62

This way?

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <sqlvault>

#define PLUGIN "Random"
#define VERSION "1.0"
#define AUTHOR "Epic"

new randomdata[33], SQLVault:g_hVault;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
g_hVault sqlv_open_local("Test")
}

public 
plugin_end()
{
    
sqlv_close(g_hVault)
}

public 
client_disconnect(id)
{
    
Save(id)
}

public 
client_putinserver(id)
{
    
Load(id)
}

public 
Save(id)
{    
    new 
szAuthID[35];
    
get_user_authid(idszAuthIDcharsmax(szAuthID))
    
sqlv_set_num(g_hVaultszAuthIDrandomdata[id])
    
    return 
PLUGIN_CONTINUE
}

public 
Load(id)
{    
    new 
szAuthID[35];
    
get_user_authid(idszAuthIDcharsmax(szAuthID))
    
sqlv_get_num(g_hVaultszAuthID)

EpicMonkey is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-30-2012 , 11:18   Re: [INC] SQLVault
Reply With Quote #63

Almost, except you never store the value when you load.

PHP Code:
sqlv_get_num(g_hVaultszAuthID

PHP Code:
randomdata[id] = sqlv_get_num(g_hVaultszAuthID
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 04-30-2012 , 12:15   Re: [INC] SQLVault
Reply With Quote #64

Quote:
Originally Posted by Exolent[jNr] View Post
Almost, except you never store the value when you load.

PHP Code:
sqlv_get_num(g_hVaultszAuthID

PHP Code:
randomdata[id] = sqlv_get_num(g_hVaultszAuthID
tried that ... didnt load for some reasons , it saves fine
EpicMonkey is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 04-30-2012 , 12:25   Re: [INC] SQLVault
Reply With Quote #65

Quote:
Originally Posted by EpicMonkey View Post
tried that ... didnt load for some reasons , it saves fine
Use client_authorized instead of client_putinserver.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 04-30-2012 , 12:40   Re: [INC] SQLVault
Reply With Quote #66

As usual , saves but doesnt load , here's what am trying :
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <sqlvault>

#define PLUGIN "Random"
#define VERSION "1.0"
#define AUTHOR "Epic"

new randomdata[33], SQLVault:g_hVault;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /data""ShowData")
    
g_hVault sqlv_open_local("Test")
}

public 
plugin_end()
{
    
sqlv_close(g_hVault)
}

public 
client_disconnect(id)
{
    
Save(id)
    
remove_task(id)
}

public 
client_authorized(id)
{
    
Load(id)
    
set_task(10.0"RandomData",id,_,_"b")
}

public 
RandomData(id)
{
    new 
szName[33];
    
randomdata[id] += 1
    get_user_name
(idszNamecharsmax(szName))
    
client_print(0print_chat"%s has been awarded 1 random data"szName)
}

public 
ShowData(id)
{
    
client_print(idprint_chat"You have %i random data"randomdata[id])
}

public 
Save(id)
{    
    new 
szAuthID[35];
    
get_user_authid(idszAuthIDcharsmax(szAuthID))
    
sqlv_set_num(g_hVaultszAuthIDrandomdata[id])
    
    return 
PLUGIN_CONTINUE
}

public 
Load(id)
{    
    new 
szAuthID[35];
    
get_user_authid(idszAuthIDcharsmax(szAuthID))
    
randomdata[id] = sqlv_get_num(g_hVaultszAuthID)


Last edited by EpicMonkey; 04-30-2012 at 12:46.
EpicMonkey is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-30-2012 , 12:51   Re: [INC] SQLVault
Reply With Quote #67

How do you even know if it's saving?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 04-30-2012 , 15:05   Re: [INC] SQLVault
Reply With Quote #68

Quote:
Originally Posted by Exolent[jNr] View Post
How do you even know if it's saving?
i open the sql file with word pad and search for my steamid , if it doesnt save it shows a 0 next to my name , when it saves it shows the number saved
EpicMonkey is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-30-2012 , 15:08   Re: [INC] SQLVault
Reply With Quote #69

Your code above looks fine. If you are still having problems when I get home tonight, I'll test it myself.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 04-30-2012 , 16:18   Re: [INC] SQLVault
Reply With Quote #70

Quote:
Originally Posted by Exolent[jNr] View Post
Your code above looks fine. If you are still having problems when I get home tonight, I'll test it myself.
i would really appreciate that ^.^
EpicMonkey is offline
Reply


Thread Tools
Display Modes

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 03:06.


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