PDA

View Full Version : Show Time!


doondook
02-10-2015, 04:25
Show Time!
version 1.0 (February 11, 2015)


Description
Shows user's timezone based real time instead of round time.
Installation
Compile it locally. For AMX version 1.8.2 and older you have to use additional module: geoip (https://forums.alliedmods.net/showthread.php?t=95665).
Copy GeoTimezones.txt to your amxmodx/data folder.
Note
The plugin does not change actual round time, it changes the HUD which shows it. Round time will continue ticking at the background.
Since there is no API in geoip (https://forums.alliedmods.net/showthread.php?t=95665) to determine UTC offsets by timezone, the plugin gets this information from the plain-text file based on http://en.wikipedia.org/wiki/List_of_tz_database_time_zones.

tousif
02-10-2015, 05:06
Errors :/


Plugin failed to compile! Please try contacting the author.
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team
/home/forums/content/files/1/0/1/7/2/6/142279.attach(69) : error 017: undefined symbol "geoip_timezone"
/home/forums/content/files/1/0/1/7/2/6/142279.attach(69) : error 088: number of arguments does not match definition
2 Errors.
Could not locate output file /home/groups/amxmodx/public_html/compiled3/142279.amx (compile failed).


Author plzz Mention to compile it locally

JusTGo
02-10-2015, 05:14
Errors :/


Plugin failed to compile! Please try contacting the author.
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team
/home/forums/content/files/1/0/1/7/2/6/142279.attach(69) : error 017: undefined symbol "geoip_timezone"
/home/forums/content/files/1/0/1/7/2/6/142279.attach(69) : error 088: number of arguments does not match definition
2 Errors.
Could not locate output file /home/groups/amxmodx/public_html/compiled3/142279.amx (compile failed).

i guess you need this modules installed https://forums.alliedmods.net/showthread.php?t=95665
btw you amxx version is out dated update to 1.8.2 better.

tousif
02-10-2015, 05:16
i guess you need this modules installed https://forums.alliedmods.net/showthread.php?t=95665
btw you amxx version is out dated update to 1.8.2 better.


I used online compiler ^_^ and its comping locally :P author didnt mention too compile locally

Arkshine
02-10-2015, 06:14
@doondook:

You should said clearly it requires a third-party module for <1.8.2 users.

- Parsing file each time a client connects is likely not a good idea, cache datas. A Trie seems appropriate.
- For permanent task, this would be recommended to use either one task with "b" flag (insertion is slow) or better create an entity to play timer's role (more precise).
- Is it really necessary to retrieve each time server time instead of adding +0.5? Using an entity as timer, this should be enough precise.
- Cleanup your code, you don't use *UserAlive.

This is really too bad we can't provide a negative number and RoundTime would increase time.

JusTGo
02-10-2015, 06:26
also MAXPLAYERS already defined in amx 1.8.3dev so you should add a check for amxx version.

Arkshine
02-10-2015, 06:28
It's okay, compiler won't whine. You would get a warning if such define would be redefined in plugin with different value than the one in 1.8.3 include, but this is not the case anymore.

Jhob94
02-10-2015, 06:37
This is really too bad we can't provide a negative number and RoundTime would increase time.

In CZ offline missions there is a timer upside round time that actually goes up instead of down.
Idk if such message exists in cs and if it is hookable.

Arkshine
02-10-2015, 07:56
Not sure why you quoted something unrelated to what you say.

It's probably TaskTime, but yeah it seems like it would work only if you're running single missions.

Jhob94
02-10-2015, 08:54
Not sure why you quoted something unrelated to what you say.

It's probably TaskTime, but yeah it seems like it would work only if you're running single missions.

It's related, if tasktime works for cs and can be hooked in mp, then this plugin could simply disable round time and use task time.

Arkshine
02-10-2015, 09:29
CS binary is the same as CZ binary. Just stuffs for CZ are locked for CS. In case of TaskTime, it will be executed only if client finds an interface which CZ Singleplayer loads. So, probably impossible to do something from server.

doondook
02-10-2015, 09:31
It was part of another plugin, just decided to quickly separate it. I was curious, if it needs anyone or not. Obviously, that not the most proper methods are used. I'll clean description and code then.

doondook
02-11-2015, 04:53
@doondook:

You should said clearly it requires a third-party module for <1.8.2 users.

- Parsing file each time a client connects is likely not a good idea, cache datas. A Trie seems appropriate.
- For permanent task, this would be recommended to use either one task with "b" flag (insertion is slow) or better create an entity to play timer's role (more precise).
- Is it really necessary to retrieve each time server time instead of adding +0.5? Using an entity as timer, this should be enough precise.
- Cleanup your code, you don't use *UserAlive.

This is really too bad we can't provide a negative number and RoundTime would increase time.

Updated.

I believe that I did not misunderstand your suggestion about using entity. Check it out, please.
And I see 1 disadvantage in using timer instead of retrieving server time (not critical). If a server or plugin is paused, the plugin won't continue its work. I can handle plugin pause/unpause events and use get_time() there again, but I haven't found any information about hooking server pause/unpause event. And also it's related to entity vs task. I will need to force entity think on unpause, whereas task will continue working by itself.

Arkshine
02-11-2015, 05:29
For [un]pause, you have 2 forwards: plugin_pause() and plugin_unpause(). It's easy to find: http://www.amxmodx.org/api/ and just type "pause".

About your last concern, I'm not to understand the issue.

doondook
02-11-2015, 06:05
As I said:
I can handle plugin pause/unpause events and use get_time() there again, but I haven't found any information about hooking server pause/unpause event.
I mean these forwards do not handle server pause events (no idea why).

Since I didn't find a way to hook server pause events, task will be more useful. Because task will automatically executed again after unpause, but entity think won't.

Jhob94
02-11-2015, 06:39
As I said:

I mean these forwards do not handle server pause events (no idea why).

Since I didn't find a way to hook server pause events, task will be more useful. Because task will automatically executed again after unpause, but entity think won't.

Have you read what arkshine said?
There are 2 forwards in amxx that allows you to hook pause/unpause

public plugin_pause()
{
// blablabla
}

public plugin_unpause()
{
// blablabla
}

They are forwards, like plugin_init, plugin_precache or client_connect for example, but without index.

doondook
02-11-2015, 07:54
I will repeat it 3rd time. For you.

plugin_pause() and plugin_unpause() forwards handle "plugin pause" events, commonly from pausecfg.sma:
register_concmd("amx_pausecfg", "cmdPlugin", ADMIN_CFG, "- list commands for pause/unpause management")
register_clcmd("amx_pausecfgmenu", "cmdMenu", ADMIN_CFG, "- pause/unpause plugins with menu")
#if defined DIRECT_ONOFF
register_concmd("amx_off", "cmdOFF", ADMIN_CFG, "- pauses some plugins")
register_concmd("amx_on", "cmdON", ADMIN_CFG, "- unpauses some plugins")
#endif


But they don't handle "server pause" event, commonly from admincmd.sma:

register_concmd("amx_pause", "cmdPause", ADMIN_CVAR, "- pause or unpause the game")

Arkshine
02-11-2015, 08:06
Is there really admin having "pausable" to 1, so anyone can pause game when they feel to do it? lol

That's said, like I said, a task is fine too, it will just less precise.

Kz1.0
02-17-2015, 08:22
Hi doondook, sorry for off-topic but can you give me your soccerjam multi-ball plugin :fox:
Thanks in advance.

PartialCloning
12-24-2015, 08:51
Try to figure out how the game pauses the timer when you pause the server, perhaps you can trick the server timer into thinking the server is paused. I'm not sure if it is possible but if it is, that would be much better than sending a roundtime message several times a second.

NarQuisH
09-26-2022, 14:28
Is there any chance to show this time in HUD or DHUD? Instead of round timer, I would like to show this geo time in HUD. But I have no idea how to do this. Thanks