Raised This Month: $ Target: $400
 0% 

amx->amxx change plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
blaah
Member
Join Date: Jun 2004
Location: germany
Old 06-29-2004 , 09:30   amx->amxx change plugin
Reply With Quote #1

hi,
can someone change this amx plugin to an amxx plugin? )

Code:
/* 
Hello world, v0.1 
By JGHG 
*/ 

#include <amxmod> 
#include <amxmisc> 
#include <mysql>




//-------------------------------------------------------------------------------------------

//declare mysql variables
new mysql = 0
new mysql_test = 0
new mhost[64], muser[32], mpass[32], mdb[32], merror[256]

//declare input variables
new wonid[32]
new clientname[64]
new mysqltime[32]
new month[10]
//-------------------------------------------------------------------------------------------

//save time into mysql
public client_disconnect(id){
if (mysql_test)  //si la connexion à la base est ok

	{
	//declare fonction var
	
	//get commands
	get_user_name(id,clientname,32)
	get_user_authid(id,wonid,32)
	new newplaytime = get_user_time(id,1)
	get_time("%m",month,10)
	new qd[513] 
	format(qd,513,"SELECT * FROM amx_logtime WHERE name='%s' and month='%s'",clientname,month)
	mysql_query(mysql,qd)
	num_to_str(newplaytime,mysqltime,32)
	
	if (mysql_nextrow(mysql) > 0){
	
	format(qd,513,"UPDATE amx_logtime SET game_time=game_time+%s, wonid=%s WHERE name='%s' and month='%s'",mysqltime,wonid,clientname,month) 
	mysql_query(mysql,qd) 
	//client_cmd(id, "echo ^"updating your info^"")
	//client_print(id,print_chat,"%s,%s,%s,%s",wonid,clientname,mysqltime,month)
	
	}else{
	
	format(qd,513,"INSERT INTO amx_logtime (name,wonid,game_time,month) VALUES ('%s','%s','%s','%s')",clientname,wonid,mysqltime,month) 
	mysql_query(mysql,qd) 
	
	}
}
return PLUGIN_CONTINUE
}

//-------------------------------------------------------------------------------------------

//initiating mysql connect
public init_function()
{
	get_cvar_string("amx_mysql_host",mhost,64) 
	get_cvar_string("amx_mysql_user",muser,32) 
	get_cvar_string("amx_mysql_pass",mpass,32) 
	get_cvar_string("amx_mysql_db",mdb,32)
	
	
	mysql=mysql_connect(mhost,muser,mpass,mdb,merror,255)
	
	if (mysql > 0)
	{
		server_print("[AMX] Playtime Mysql : Connection established to the database")
		mysql_test = 1
		
		
	} else {
		server_print("[AMX] Playtime MySQL error : could not connect to the database : '%s'",merror)
	} 
	return PLUGIN_CONTINUE
 
}  

//-------------------------------------------------------------------------------------------
	
//baisc plugin stuff ^_^
public plugin_init() 
{
register_plugin("playtime mysql","0.1","Neosheep") 
register_cvar("amx_mysql_host","")
register_cvar("amx_mysql_user","")
register_cvar("amx_mysql_pass","")
register_cvar("amx_mysql_db","")
server_cmd("exec addons/amx/mysql.cfg")
set_task(5.0,"init_function")
return PLUGIN_HANDLED
}
blaah is offline
Send a message via ICQ to blaah
 



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 14:39.


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