This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

SQL Saving Method


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 12-29-2011 , 19:51   SQL Saving Method
Reply With Quote #1

Since i have absolutly no understanding of SQL

I would like some help in creating the SQL saving method for my plugin. if you can help the .sma's and the rest of the files are in the zip file attatched
Attached Files
File Type: zip Battlefield 2.0.5.zip (86.8 KB, 60 views)
Doc-Holiday is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 12-29-2011 , 20:10   Re: SQL Saving Method
Reply With Quote #2

Check out SQLVault. It's really useful, and allows you to use vault style of coding (like you are using now), and still use SQL saving.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 12-29-2011 , 21:09   Re: SQL Saving Method
Reply With Quote #3

Quote:
Originally Posted by nikhilgupta345 View Post
Check out SQLVault. It's really useful, and allows you to use vault style of coding (like you are using now), and still use SQL saving.
For some reason when i try to connect to my DB it doesnt work.. Says it cant connect. Thats using the vault my exo and bugsy's nsqlx
Doc-Holiday is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 12-30-2011 , 14:13   Re: SQL Saving Method
Reply With Quote #4

Is the connection information correct? On some servers SQL fails the first time it's loaded, try changing the map - that should sort the connection out (if the connection info is correct in the first place).

The nSQLx include by Bugsy should work just fine and fit your needs by the looks of it - but you could check out SQLVault if you would ever happen to need a paired key saving mechanism.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 12-30-2011 , 19:00   Re: SQL Saving Method
Reply With Quote #5

Quote:
Originally Posted by Xellath View Post
Is the connection information correct? On some servers SQL fails the first time it's loaded, try changing the map - that should sort the connection out (if the connection info is correct in the first place).

The nSQLx include by Bugsy should work just fine and fit your needs by the looks of it - but you could check out SQLVault if you would ever happen to need a paired key saving mechanism.
its correct and added to my remote sql thing. However no matter how many times it restarts or changes the map it wont connect.

Ive used both the ip and web address....
Doc-Holiday is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 12-30-2011 , 19:38   Re: SQL Saving Method
Reply With Quote #6

test this and post console prints:
PHP Code:
#include <amxmodx>
#include <sqlx>

new Handle:g_sql_tuple

public plugin_init(){
    
register_plugin("SQL test""1.0""Sylwester")
    
register_clcmd("amx_sql_test""sql_test")
    
    
g_sql_tuple SQL_MakeDbTuple("mysql_server_ip""username""password""database")
    
SQL_SetAffinity("mysql")
}

public 
sql_test(id){
    new 
data[1]
    
data[0] = id
    SQL_ThreadQuery
(g_sql_tuple"qh_sql_test""SELECT 10;"data1)
    
client_print(idprint_console"[SQL test] query sent")
    return 
PLUGIN_HANDLED
}

public 
qh_sql_test(FailState,Handle:Query,Error[],Errcode,Data[],DataSize){
    new 
id Data[0]
    if(!
is_user_connected(id))
        return
    if(
FailState){
        
client_print(idprint_console"[SQL test] SQL Error : %s"Error)
        return
    }
    
client_print(idprint_console"[SQL test] SQL query successful, retrieved value: %d"SQL_ReadResult(Query0))

__________________
Impossible is Nothing
Sylwester is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 12-31-2011 , 20:03   Re: SQL Saving Method
Reply With Quote #7

Quote:
Originally Posted by Sylwester View Post
test this and post console prints:
Code:
] amx_sql_test
[SQL test] query sent
[SQL test] SQL query successful, retrieved value:
Seems to connect fine... I guess ill have to look into why battlefield wont connect to it then. Thanks.

Edit:
Well i got it to connect using Exolents SQL vault. I also have it use the default amx_sql settings which will allow for easier setup (less on my part haha)

Edit x2: I would rather just use Sql X.. I think i can do all the part where it connects and what not. Is there a way to loop through my xp data like i do in vault to save each class as its own set of ranks.

i.e. You can be a Special Ops General but if you switch to assault your only a Private.

Last edited by Doc-Holiday; 01-01-2012 at 00:51.
Doc-Holiday 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:31.


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