Raised This Month: $ Target: $400
 0% 

Timeleft in hostname


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vl@d
Senior Member
Join Date: Dec 2006
Location: Romania
Old 09-02-2007 , 15:00   Timeleft in hostname
Reply With Quote #1

Code:
#include <amxmodx>
#include <string>

static const NumeSRV[] = "Cs 1.6 Hl.DarkStriKe.Ro"

public plugin_init(){ 
    register_plugin("LiveUpdate","1.0","FireW@ll")
    set_task(0.0, "live",_,_,_,"b")
    return PLUGIN_CONTINUE 
}

public live(){
    new map[32] 
    new numenou[255]
    new formated[32]
    new timeleft = get_timeleft()
    get_mapname(map,31)
    format(formated,254,map[3])
    strtoupper(formated)
    format(numenou,254,"[%s]-=-[Acum Este:%s]-=-[Timp Ramas:%d:%02d]", NumeSRV, formated,timeleft / 60,timeleft * 60)
    set_cvar_string("hostname", numenou)
    return PLUGIN_CONTINUE
}
It works but the timeleft is like this:
[Cs 1.6 Hl.DarkStriKe.Ro]-=-[Acum EsteUST2]-=-[Timp Ramas8:136980]

Any idea?
__________________


I hate Spammers....
vl@d is offline
Old 09-02-2007, 15:18
Alka
This message has been deleted by Alka. Reason: nvm
X-Script
BANNED
Join Date: Jul 2007
Location: (#504434)
Old 09-02-2007 , 15:19   Re: Timeleft in hostname
Reply With Quote #2

you need to have %d in there.

edit: Alka got it first.
X-Script is offline
vl@d
Senior Member
Join Date: Dec 2006
Location: Romania
Old 09-02-2007 , 15:21   Re: Timeleft in hostname
Reply With Quote #3

ok and what about the timeleft?
__________________


I hate Spammers....
vl@d is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 09-02-2007 , 15:22   Re: Timeleft in hostname
Reply With Quote #4

Oh sorry, now i get it what you want to do , this is the correct way :

Code:
public live()
{
 new const server_name[] = "nume server";
 
 new mapname[32];
 get_mapname(mapname, sizeof mapname - 1);
 
 new time_left = get_timeleft();
 
 new Buffer[256];
 format(Buffer, sizeof Buffer - 1, "[%s]-=-[Harta: %s]-=-[Timp Ramas: %d:%d]", server_name, mapname, time_left / 60, time_left % 60);
 
 set_cvar_string("hostname", Buffer);
}
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 09-02-2007 at 15:29.
Alka is offline
X-Script
BANNED
Join Date: Jul 2007
Location: (#504434)
Old 09-02-2007 , 15:23   Re: Timeleft in hostname
Reply With Quote #5

take out %02d

edit: damnit alka
X-Script is offline
vl@d
Senior Member
Join Date: Dec 2006
Location: Romania
Old 09-02-2007 , 16:03   Re: Timeleft in hostname
Reply With Quote #6

nice.
very competitiv
thx alka for that one

edit: omg is this right
[Cs 1.6 Hl.DarkStriKe.Ro]-=-[Acum Este:80]-=-[Timp Ramas:41:149460]
the map is 35hp
Edit: nevermind i rr the server it works. thx
__________________


I hate Spammers....

Last edited by vl@d; 09-02-2007 at 16:21.
vl@d 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 16:06.


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