Raised This Month: $ Target: $400
 0% 

Timeleft in Hostname


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cccpsmiley
Senior Member
Join Date: Mar 2006
Location: Los Angeles, CA
Old 04-06-2007 , 08:58   Timeleft in Hostname
Reply With Quote #1

Can this pretty please be made. I want it to be soemthing like "SERVER NAME (Timeleft 223)"

Now i know some of u will say USE THE SEARCH button because this was already created...but no it was created and then erased.
cccpsmiley is offline
Send a message via AIM to cccpsmiley
Deviance
Veteran Member
Join Date: Nov 2004
Location: Sweden
Old 04-06-2007 , 09:29   Re: Timeleft in Hostname
Reply With Quote #2

I dunno if this work, didn't have time to test
Code:
/*
--------------------------------------------------------------
----------------------  Made by Deviance ---------------------
--------------------- www.the-place.co.nr --------------------
--------------------------------------------------------------
*/

#include <amxmodx>
#include <amxmisc>

#define Plugin "Time left in hostname"
#define Version "1.0"
#define Author "Doombringer"

public plugin_init()
{
	register_plugin(Plugin, Version, Author)
	set_task(1.0, "update_time",_,_,_,"b")
}

public update_time()
{
	new hostname[64], new_hostname[132]
	get_cvar_string("hostname", hostname, 63)
	
	format(new_hostname, 131, "%s (Timeleft %s)", hostname, get_timeleft())
	set_cvar_string("hostname", new_hostname)
}
Deviance is offline
cccpsmiley
Senior Member
Join Date: Mar 2006
Location: Los Angeles, CA
Old 04-06-2007 , 09:44   Re: Timeleft in Hostname
Reply With Quote #3

nope lol it does some weird thing this is wat it looks like

+:*:+|| IVXXCLAN.NET || +:*:+ (Timele (Timeleft ò)

and the little "ò" would get replaced by millions of other things like A,b,1,y,!,*,_ every second
cccpsmiley is offline
Send a message via AIM to cccpsmiley
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 04-06-2007 , 13:13   Re: Timeleft in Hostname
Reply With Quote #4

get_timeleft() returns the time left in seconds. Therefore, at the very least you need to change the %s to a %i in "(Timeleft %s)". However, kinda crappy to just see the number of seconds left. It'd be much better looking in a "hh:mm:ss" layout.

Also, Deviance's code will keep appending "(Timeleft blah)" over and over every second as opposed to replacing the previous one.
__________________
Brad is offline
cccpsmiley
Senior Member
Join Date: Mar 2006
Location: Los Angeles, CA
Old 04-06-2007 , 13:30   Re: Timeleft in Hostname
Reply With Quote #5

yea thats how it always worked when that plugin was around
its a great plugin i dunno why the author requested it be deleted
cccpsmiley is offline
Send a message via AIM to cccpsmiley
pizzahut
Senior Member
Join Date: Oct 2004
Old 04-06-2007 , 15:03   Re: Timeleft in Hostname
Reply With Quote #6

Code:
#include <amxmodx> #include <amxmisc> #define Plugin "Time left in hostname" #define Version "1.1" #define Author "Doombringer,pizzahut" new g_hostname[64] public plugin_init() {     register_plugin(Plugin, Version, Author)     get_cvar_string("hostname", g_hostname, 63)     set_task(1.0, "update_time", 1, "", 0, "b") } public update_time() {     new new_hostname[64]     new h,m,s     s = get_timeleft()     m = s/60     h = m/60     s = s-m*60     m = m-h*60     format(new_hostname, 63, "%s (Timeleft %d:%d:%d)", g_hostname, h,m,s)     set_cvar_string("hostname", new_hostname) }
You might want to use a persistent cvar for setting the hostname, although it's not critical.
http://www.amxmodx.org/funcwiki.php?...cvar&go=search
Hm - actually there's no pcvar function to set a string?
__________________
My AMXX plugins (content date 2007-03-29, link check 2017-04-26)

Plugins for the Royston Vasey TFC server - These are UNSUPPORTED, except those which have been published at AMX Mod X.

Last edited by pizzahut; 04-06-2007 at 15:15.
pizzahut is offline
cccpsmiley
Senior Member
Join Date: Mar 2006
Location: Los Angeles, CA
Old 04-06-2007 , 16:45   Re: Timeleft in Hostname
Reply With Quote #7

if the code u provided suppose to work, which im not sure wat was the intention of ur post, it doesnt compile

/home/groups/amxmodx/tmp3/textzJ9lq2.sma(10) : error 001: expected token: ";", but found "-identifier-"
/home/groups/amxmodx/tmp3/textzJ9lq2.sma(10) : error 001: expected token: ";", but found "-identifier-"
/home/groups/amxmodx/tmp3/textzJ9lq2.sma(10) : error 001: expected token: ";", but found "}"
/home/groups/amxmodx/tmp3/textzJ9lq2.sma(10) : fatal error 107: too many error messages on one line
cccpsmiley is offline
Send a message via AIM to cccpsmiley
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 04-06-2007 , 17:17   Re: Timeleft in Hostname
Reply With Quote #8

Compiles fine for me:
DL: http://www.amxmodx.org/webcompiler.cgi?go=dl&id=102075
Styles is offline
Send a message via AIM to Styles
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 21:07.


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