Raised This Month: $ Target: $400
 0% 

Check for date from sql connection


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Zenyai
Junior Member
Join Date: Dec 2007
Old 10-01-2009 , 21:34   Re: Check for date from sql connection
Reply With Quote #3

Ah for more info about what I making

This is my plugin right now

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <sqlx>
new Handle:g_SqlTuple
new g_Error[512]
public 
plugin_init()
{
register_plugin("Zenyai Plugin","1.0","Zenyai")
 
// we tell the API that this is the information we want to connect to,
// just not yet. basically it's like storing it in global variables
g_SqlTuple SQL_MakeDbTuple("127.0.0.1","user","pass","db")
}
public 
client_connect(id)

// ok, we're ready to connect
new ErrorCode,Handle:SqlConnection SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)
if(
g_SqlTuple == Empty_Handle)
// stop the plugin with an error message
set_fail_state(g_Error)
 
// run a random query
new userid[32]
get_user_name(id,userid,31)
new 
Handle:Query SQL_PrepareQuery(SqlConnection,"SELECT * FROM shotlog WHERE Name='%s'"userid)
 
if(!
SQL_Execute(Query))
{
// if there were any problems
SQL_QueryError(Query,g_Error,511)
set_fail_state(g_Error)
}
else if (!
SQL_NumResults(Query)) {
server_cmd("kick #%d ^"%L^""get_user_userid(id), id"NOT_FOUND")

else
{
 
}
 
 
// of course, free the handle
SQL_FreeHandle(Query)
 
// and of course, free the connection
SQL_FreeHandle(SqlConnection)

I making a client that will update the value of time in sql for every 25 seconds and I want the script to check every 25 second for the difference of time .If the difference of time between the sql and server time more than 25 sec. The player get kick out.

If this not too hard please write the code for me. That would be nice but if it take alot of time please show me the way

Sorry for my bad english (English is not my main lang)

Last edited by Zenyai; 10-01-2009 at 21:38.
Zenyai is offline
 



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 22:41.


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