Raised This Month: $ Target: $400
 0% 

amx->amxx change plugin


Post New Thread Reply   
 
Thread Tools Display Modes
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
blaah
Member
Join Date: Jun 2004
Location: germany
Old 07-03-2004 , 08:15  
Reply With Quote #2

well i dont understand, why this dont works


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

#include <amxmodx> 
#include <amxmisc> 
#include <mysql>




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

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

//declare input variables
new wonid[32]
new clientname[64]
new mysqltime[32]
new monat[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",monat,10)
	new qd[513] 
	format(qd,513,"SELECT * FROM amx_logtime WHERE name='%s' and monat='%s'",clientname,monat)
	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 monat='%s'",mysqltime,wonid,clientname,monat) 
	mysql_query(mysql,qd) 
	client_cmd(id, "echo ^"updating your info^"")
	//client_print(id,print_chat,"%s,%s,%s,%s",wonid,clientname,mysqltime,monat)
	
	}else{
	
	format(qd,513,"INSERT INTO amx_logtime (name,wonid,game_time,monat) VALUES ('%s','%s','%s','%s')",clientname,wonid,mysqltime,monat) 
	mysql_query(mysql,qd) 
	
	}
}
return PLUGIN_CONTINUE
}

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

//initiating mysql connect

public start()
{
	get_cvar_string("amx_mysql_host",mhost,63) 
	get_cvar_string("amx_mysql_user",muser,31) 
	get_cvar_string("amx_mysql_pass",mpass,31) 
	get_cvar_string("amx_mysql_db",mdb,31)	
	
	mysql=mysql_connect(mhost,muser,mpass,mdb,merror,127)
	
	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/amxx/configs/mysql.cfg")
set_task(5.0,"start")
return PLUGIN_HANDLED
}

i have changed the path to the mysql.cfg and replaced the var month (as i got an shadow error).

if i install the plugin and restart the server, amx is getting "freezed" or something in this way..
if i type amx_plugins in the konsole there is no result.. and all other plugins aren't working anymore.. :'(

if i comment public start() all other plugins work well again.
whats wrong about this start function?
blaah is offline
Send a message via ICQ to blaah
rjlan82
Member
Join Date: May 2004
Old 07-03-2004 , 15:02  
Reply With Quote #3

for starters, change
Code:
#include <amxmod>
to
Code:
#include <amxmodx>
rjlan82 is offline
blaah
Member
Join Date: Jun 2004
Location: germany
Old 07-03-2004 , 15:41  
Reply With Quote #4

*argh*! thanks a lot!!

hm, now i have an other error:
if i type amx_plugins..
Code:
Admin Commands     0.16     AMXX Dev Team     admincmd.amx     running  
tccident             0.1         tcc                  tcc.amx          running 
playtime mysql     0.1      Neosheep          logtime.amx      running  
unknown            unknown  unknown           amx_match.amx    running  
unknown            unknown  unknown           server_rules.am  running  
unknown            unknown  unknown           awplimit.amx     running  
unknown            unknown  unknown           amx_shake.amx    running  
unknown            unknown  unknown           swear_filter.am  running  
unknown            unknown  unknown           admin_gag.amx    running  
unknown            unknown  unknown           psychosound.amx  running  
unknown            unknown  unknown           admin_allinone.  running  
unknown            unknown  unknown           slots_reservati  running  
unknown            unknown  unknown           menufront.amx    running  
unknown            unknown  unknown           cmdmenu.amx      running  
unknown            unknown  unknown           plmenu.amx       running  
unknown            unknown  unknown           restmenu.amx     running  
unknown            unknown  unknown           telemenu.amx     running  
unknown            unknown  unknown           mapsmenu.amx     running  
unknown            unknown  unknown           antiflood.amx    running  
unknown            unknown  unknown           adminchat.amx    running  
[....]
31 plugins, 31 running
playtime mysql is the above mentioned plugin..

all plugins are displayed, but they dont work ..
blaah is offline
Send a message via ICQ to blaah
kingpin
Veteran Member
Join Date: Apr 2004
Location: kpsforum.com
Old 07-03-2004 , 16:15  
Reply With Quote #5

try the following version.
Attached Files
File Type: amx hello_world.amx (2.6 KB, 257 views)
__________________
kingpin is offline
Send a message via ICQ to kingpin Send a message via AIM to kingpin Send a message via MSN to kingpin Send a message via Yahoo to kingpin Send a message via Skype™ to kingpin
blaah
Member
Join Date: Jun 2004
Location: germany
Old 07-03-2004 , 19:26  
Reply With Quote #6

omg, what should that do?
if i install your plugin, amx doesn't start any more... its the same like with the old plugin before i changed #include <amxmod> to #include <amxmodx> ..
blaah is offline
Send a message via ICQ to blaah
kingpin
Veteran Member
Join Date: Apr 2004
Location: kpsforum.com
Old 07-03-2004 , 19:41  
Reply With Quote #7

what error does it give u?
__________________
kingpin is offline
Send a message via ICQ to kingpin Send a message via AIM to kingpin Send a message via MSN to kingpin Send a message via Yahoo to kingpin Send a message via Skype™ to kingpin
blaah
Member
Join Date: Jun 2004
Location: germany
Old 07-03-2004 , 20:00  
Reply With Quote #8

Code:
Currently loaded plugins:
      description      stat pend  file              vers      src  load  unlod
 [ 1] Cheating-Death   RUN   -    cdmod_i586.so     v4.15.0   ini  Chlvl Chlvl
 [ 2] AMX Mod X        RUN   -    amxx_mm_i386.so   v0.16     ini  ANY   ANY
 [ 3] Fun              RUN   -    fun_amx_i386.so   v0.16     cmd  ANY   ANY
 [ 4] Counter-Strike   RUN   -    cstrike_amx_i386  v0.16 WO  cmd  Pause Pause
 [ 5] CS Stats         RUN   -    csstats_amx_i386  v0.16     cmd  ANY   ANY
[...]
maxplayers cannot be changed while a server is running.
[...]

couldn't exec addons/amx/mysql.cfg        (shouldn't hat be ../amxx/configs/..?)

[...]
[AMX] Playtime MySQL error : could not connect to the database : 'unknown error'
blaah is offline
Send a message via ICQ to blaah
kingpin
Veteran Member
Join Date: Apr 2004
Location: kpsforum.com
Old 07-03-2004 , 20:05  
Reply With Quote #9

yes here is the different version ...
Attached Files
File Type: amx hello_world.amx (2.6 KB, 253 views)
__________________
kingpin is offline
Send a message via ICQ to kingpin Send a message via AIM to kingpin Send a message via MSN to kingpin Send a message via Yahoo to kingpin Send a message via Skype™ to kingpin
blaah
Member
Join Date: Jun 2004
Location: germany
Old 07-03-2004 , 20:12  
Reply With Quote #10

Code:
[AMX] Playtime Mysql : Connection established to the database
but if i type amx_plugins in the HLSW console there dont comes any result..

and the database stays also empty :/
blaah is offline
Send a message via ICQ to blaah
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 14:39.


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