AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   City Temperature on join | Updated Nov 26th 2022 (https://forums.alliedmods.net/showthread.php?t=314896)

DJEarthQuake 03-12-2019 11:45

City Temperature on join | Updated Nov 26th 2022
 
3 Attachment(s)

Quote:

Originally Posted by tarsisd2 (Post 2615885)
your plugin could detect from what city is the player from and get the weather right for him!

Quote:

Originally Posted by tarsisd2 (Post 2615885)
"Player" connected from "City", temperature right now is "temp°"

Translations.
&Checksums.
Spoiler

Requires:
  • GeoIP+ module or AMXX 1.9+.
  • GeoLite2 database.

    Debian based Linux systems symbolic link from apt install geoipupdate.

    GeoLite2-City.mmdb -> /var/lib/GeoIP/GeoLite2-City.mmdb
    GeoLite2-Country.mmdb -> /var/lib/GeoIP/GeoLite2-Country.mmdb


    Cron code for automatic update of database.
    @weekly geoipupdate
Directions:
  1. Download the 3 files and compare checksums.
  2. Compile and place SMA that is now an AMXX file in plugins directory.
  3. Place TXT in lang directory of amxmodx.
  4. Edit modules.ini and remove the semi-colon from in front of geoip2
  5. Unzip WAV file and place in sound/misc directory.
  6. As an admin the MOTD will prompt you where to go to get a key for CVAR: sv_openweather-key.

SMA URL
https://github.com/djearthquake/amxx.../clientemp.sma

Original without the temp. Geo data on connect Amxx 182++

ORIGINAL VERSION ARCHIVE
Includes windage. If shot the cross hair points to where the wind is blowing in real life. Have to duck or heal to straighten it. The humor.

The infamously named TRAFFIC(ID) reniced by iceeedr.
Spoiler

fysiks 03-12-2019 22:17

Re: TrafficID
 
So, why is the title of your thread "TrafficID"? Makes no sense. Also, are you saying that none of the other plugins that do this exact same thing no longer work?

DJEarthQuake 03-12-2019 23:53

Re: TrafficID
 
Quote:

Originally Posted by fysiks (Post 2643048)
So, why is the title of your thread "TrafficID"? Makes no sense. Also, are you saying that none of the other plugins that do this exact same thing no longer work?


Thanks for your feedback. This is reposted and answered later.

smurfavr 03-13-2019 08:03

Re: TrafficID
 
AMX Mod X v1.8.2-d server Hl1 eror
Code:

//// named.sma
// D:\server-2\valve\addons\amxmodx\scripting\named.sma(21) : error 017: undefin
ed symbol "geoip_city"
// D:\server-2\valve\addons\amxmodx\scripting\named.sma(23) : error 017: undefin
ed symbol "client_print_color"
// D:\server-2\valve\addons\amxmodx\scripting\named.sma(36) : error 017: undefin
ed symbol "geoip_city"
// D:\server-2\valve\addons\amxmodx\scripting\named.sma(38) : error 017: undefin
ed symbol "client_print_color"

Here it also gives, error.
http://aghl.ru/webcompiler/webcompiler.php

<VeCo> 03-13-2019 11:54

Re: TrafficID
 
Quote:

Originally Posted by smurfavr (Post 2643083)
AMX Mod X v1.8.2-d server Hl1 eror

you'd need 1.9 to run this

DJEarthQuake 03-13-2019 11:55

Re: TrafficID
 
This is definitely not for 1.8.2.

thEsp 03-13-2019 14:48

Re: TrafficID
 
Attach a zip file if it doesn't compile. Not everyone viewing this forums or thread is capable of coding, in this case compiling locally.

OciXCrom 03-13-2019 16:00

Re: TrafficID
 
Quote:

Originally Posted by thEsp (Post 2643137)
Attach a zip file if it doesn't compile. Not everyone viewing this forums or thread is capable of coding, in this case compiling locally.

Everyone should know how to compile locally.

DJEarthQuake 03-13-2019 18:24

Re: TrafficID
 
Updates were made.

fysiks 03-13-2019 22:39

Re: TrafficID
 
Quote:

Originally Posted by DJEarthQuake (Post 2643055)
Since when did you become a nominalist? I did not know you were multi-talented! Now that makes absolutely no sense. This identifies the network traffic and places it into log file. Follow? Sure there are others similar albeit unmaintained and unnecessarily convoluted big code. This works. One tiny sma. Void of tons of other files and instructions. Just drop it in and it works. You cannot force me to use other scripts or discourage me from sharing fix with sample code especially when GeoIP is packaged wrong leaving bad code on the street on a much more grandiose scale than you can fathom. I was the first one to point out the problem with GeoIP here if you take the time to read the details. It was packaged wrong. Why not use the code from the guy who got it working? Use it on your DoD server and let me know what it does to it. =P If you have any players you will know where your traffic is coming from. Identified. There are more issues with GeoIP and this was not intended to be released as is. It was going to have the weather pushed to it also of each new connection IE traffic. The so-called 'Traffic', I am not the only one to call it that buddy. Wikiapedia has an entire page dedicated to it. The ID? Really? Okay. Thanks for helping me be patient and explain what this does if the name ambiguates it some how please suggest a new name now. I see it as unique and that was what I named it. It is actually called named.sma. Not to confuse you. Name like a name server, a DNS server, resolves the IP through name server say to alliedmods.net. Similarly TrafficID called name was like my name server for my GoldSource farm. I had alpha version name a b c d e was for element. Left pending. This stable version is D name D. named.sma. D is combo of the B and C version. C was for counter-strike. The GeoIP IP ID which is an abbreviation for identify. Identifies the connector by country, region, and city. Region is state for U.S. and region for everybody else so I just called it region. It is in your destiny to test the D for DoD. Please let me know if you do not see colored messages like on CS. If not I will tell you it is WW2.

https://en.wikipedia.org/wiki/Internet_traffic

Wow, what in the world is this nonsensical post? Your plugin does not log "internet traffic", it only logs the location from which a player is connecting based on their IP address (so not "traffic" and not an "id"). Also, the title of your thread doesn't exist in your post nor is it the name of your .sma file (which is named nonsensical). It's just confusing and should be reasonably consistent for people to even take you seriously.

DJEarthQuake 03-14-2019 08:51

Re: TrafficID
 
Thanks for the feedback. While I get the point of descriptive names let's not be too pushy.

DJEarthQuake 03-14-2019 14:00

Re: TrafficID
 
Quote:

Originally Posted by fysiks (Post 2643048)
So, why is the title of your thread "TrafficID"? Makes no sense. Also, are you saying that none of the other plugins that do this exact same thing no longer work?

What other plugins?

This works?

Traffic 6:*a concentration of participants or players and especially defensive players

ID 1a:*an act of*identifying*:*the state of being*identified

iceeedr 03-14-2019 20:42

Re: 𝕋𝕣𝔸𝔽𝔽𝕀ℂ𝕚𝕕 for AMX 1.8.3+
 
Good .. you already will support the amx 1.9 I think you could have written the plugin so.

Spoiler


Some notes:
Steamid should be set to 35 or in amx 1.9 MAX_AUTHID_LENGHT
Nothing against using get_user_name, however you can set the name [MAX_NAME_LENGHT], or as I did in the example "% n".
Always use charsmax, it does not change much, but it is a healthy practice, and finally, in the client_disconnected (id) you get the "ip" but never use it.

It's just a suggestion, good night.

DJEarthQuake 03-14-2019 21:40

Re: 𝕋𝕣𝔸𝔽𝔽𝕀ℂ𝕚𝕕 for AMX 1.8.3+
 
lol thx for the tips and tricks, hate occasional blank readings on connections, charsmax will also be a good exercise for me. Definitely a beer. It was so dinky I was wondering if it belonged in the snippets section until I saw how tiny the gamename changer is. That is off the hook.

Oh shoot you rewrote the alpha code. Thanks man.

Real quick why the Unions on the bot to hltv please? I thought that means if the bot is coming in from hltv exclusively.

iceeedr 03-14-2019 22:06

Re: 𝕋𝕣𝔸𝔽𝔽𝕀ℂ𝕚𝕕 for AMX 1.8.3+
 
Quote:

Originally Posted by DJEarthQuake (Post 2643356)
lol thx for the tips and tricks, hate occasional blank readings on connections, charsmax will also be a good exercise for me. Definitely a beer. It was so dinky I was wondering if it belonged in the snippets section until I saw how tiny the gamename changer is. That is off the hook.

Oh shoot you rewrote the alpha code. Thanks man.

Real quick why the Unions on the bot to hltv please? I thought that means if the bot is coming in from hltv exclusively.

|| means "or", that is, if it is bot "or" hltv, then return. It does not affect your original code, it's just a way to check all conditions for "return" on a single line.

Godofwar 03-15-2019 14:44

Re: 𝕋𝕣𝔸𝔽𝔽𝕀ℂ𝕚𝕕 for AMX 1.8.3+
 
SXGEO Module do the self way ....

DJEarthQuake 03-15-2019 21:07

Re: 𝕋𝕣𝔸𝔽𝔽𝕀ℂ𝕚𝕕 for AMX 1.8.3+
 
I added a tested geoip module from 1.83 dev to OP along with a inc from 1.9. It will poll geoip coordinates whereas 1.9 is not on Linux. That is the next direction of this plugin is coordinates for displaying weather. Long story city, country can poll 5 locations whereas lon and lat is exact. iceeedr thank you again for your time and refresher. Last not least also everybody else for speaking up!

DJEarthQuake 10-12-2019 02:38

Re: 𝕋𝕣𝔸𝔽𝔽𝕀ℂ𝕚𝕕 for AMX 1.8.3+
 
Posting a variation of this plugin that tells the temperature of the players as they connect as well as city. Requirements: 1.9.0 and free openweathermap api key.

tarsisd2 10-15-2019 08:18

Re: 𝕋𝕣𝔸𝔽𝔽𝕀ℂ𝕚𝕕 for AMX 1.8.3+
 
Quote:

Originally Posted by DJEarthQuake (Post 2669550)
Posting a variation of this plugin that tells the temperature of the players as they connect as well as city. Requirements: 1.9.0 and free openweathermap api key.

Can you make a simple version, just name/city/temperature

"Player" connected from "City", temperature right now is "temp°"

Since 99% of the players is from the same country here, and mostly friends, so steamid only on log

Pretty sure will be handy for a lot of people
Thanks

DJEarthQuake 10-15-2019 15:06

Re: 𝕋𝕣𝔸𝔽𝔽𝕀ℂ𝕚𝕕 for AMX 1.8.3+
 
Quote:

Originally Posted by tarsisd2 (Post 2615885)
your plugin could detect from what city is the player from and get the weather right for him!


Quote:

Originally Posted by tarsisd2 (Post 2669795)
Can you make a simple version, just name/city/temperature

"Player" connected from "City", temperature right now is "temp°"

Since 99% of the players is from the same country here, and mostly friends, so steamid only on log

Pretty sure will be handy for a lot of people
Thanks

The OP is updated. You are welcome and thank you for the great idea and feedback.

Quote:

///#define DEBUG
That will minimize the log and client print as requested.

tarsisd2 10-17-2019 12:30

Re: City Temperature on join. | Updated (10/12/2019)
 
great work as always
more suggestions in case you want it

- make it multilingual
- make it colored messages, cromchat is great but any will be nice
like
"Player" connected from "City", temperature right now is "temp°" use blue for cold temp from -15° to 14°, and red for warm from 15°

- play a sound when player connect, like buttons/bell1.wav (cvar for on off)
- options for msg in chat or hud
- option for client to disable notifications like /connect

will think of a few more ideas

thanks

iceeedr 10-17-2019 13:07

Re: City Temperature on join. | Updated (10/12/2019)
 
Quote:

Originally Posted by tarsisd2 (Post 2669974)
great work as always
more suggestions in case you want it

- make it multilingual
- make it colored messages, cromchat is great but any will be nice
like
"Player" connected from "City", temperature right now is "temp°" use blue for cold temp from -15° to 14°, and red for warm from 15°

- play a sound when player connect, like buttons/bell1.wav (cvar for on off)
- options for msg in chat or hud
- option for client to disable notifications like /connect

will think of a few more ideas

thanks

The plugin is 1.9 amxx, so cromchat not needed.

tarsisd2 10-17-2019 13:22

Re: City Temperature on join. | Updated (10/12/2019)
 
Quote:

Originally Posted by iceeedr (Post 2669977)
The plugin is 1.9 amxx, so cromchat not needed.

client_print_color works, but with my idea of blue and red for different temperature would be easier with cromchat, since client_print_color x03 uses teamcolors, and with cromchat its easier to use &x07 = red and &x06 = blue
player and city green color, text default yellow, and temp blue or red depending on the value, i guess it can be done

maybe i am mistaken

DJEarthQuake 10-17-2019 14:55

Re: City Temperature on join. | Updated (10/12/2019)
 
TE_TEXTMESSAGE can accomplish multi-color and make the words look on fire or ice even with 1.8.2! What I thought would be great possibly is to have vox say 'the temperature now is whatever degrees' then have te_text take it from there on extreme temp ranges. ML support and the weather get sound is done. There are so many connect sounds on other plugins. What I picked and saved on OP definitely sounds like the weather and only plays when it gets the weather. That's close to connect but not on top eliminating any interference.

Fuck For Fun 10-17-2019 15:04

Re: City Temperature on join. | Updated ML (10/17/2019)
 
nice sharing, any image?

An undefined location is incorrect at the IP address or region or IP has changed and will show another region?

I forgot how to check by dialer area

DJEarthQuake 10-17-2019 16:03

Re: City Temperature on join. | Updated ML (10/17/2019)
 
Quote:

Originally Posted by Fuck For Fun (Post 2669990)
nice sharing, any image?

An undefined location is incorrect at the IP address or region or IP has changed and will show another region?

I forgot how to check by dialer area

Depends. Check the IP on a individual basis. Occasionally somebody will show an IP of 127.0.0.1 as they join, then a real IP as they exit. In that case the IP would be the reason. Then there is the case that the IP is valid and it is not in free GeoIP database. The Core 1.9.0 had a bug in Linux GeoIP for a year. So IP can be valid and in the database while core GeoIP module wasn't polling longitude and latitude. It's fixed now. I optimized feed to retry instead of pass-on-fail. That should stop a lot of the nulls on my end.

tarsisd2 10-20-2019 08:47

Re: City Temperature on join. | Updated ML (10/18/2019)
 
portuguese translation

PHP Code:

[bp]
CLIENTEMP_PRINT ""%s" conectou de "%s", temperatura de %s° graus" 


DJEarthQuake 10-21-2019 21:13

Re: City Temperature on join. | Updated ML (10/21/2019)
 
Thank you @tarsisd2 for the portuguese translation.
The color version is ready. It needs some testing and tuning.
https://i.kym-cdn.com/photos/images/...10/479/1d4.gifhttps://i.kym-cdn.com/photos/images/...10/432/468.gif

Snake. 10-26-2019 19:52

Re: City Temperature on join. | Updated ML (10/22/2019)
 
Code:

[tr]
HUD_CLIENTEMP_PRINT = "%s "%s" yerinden baglandi, sicaklik suan %i°"
LOG_CLIENTEMP_PRINT = ""%s" "%s" yerinden baglandi, sicaklik suan "%i°""
CS_CLIENTEMP_PRINT = "^4%s ^3%s ^1yerinden baglandi, ^1sicaklik suan ^3%i°"
HL_CLIENTEMP_PRINT = "%s sicaklik suan %i derece."


DJEarthQuake 10-26-2019 23:57

Re: City Temperature on join. | Updated ML (10/26/2019)
 
Thank you once again Snake. for your Turkish translation work!

DJEarthQuake 11-02-2019 09:09

Re: City Temperature on join. | Updated ML (11/02/2019)
 
Remade a bunch of stuff. Most notably the plugin won't crash if it is installed without the databases or other files.

Napoleon_be 04-07-2020 12:21

Re: City Temperature on join. | Updated ML (Sat 04/04/2020)
 
Add measure units such as Farenheit or Celsius. 15° farenheit is pretty cold, as 15° Celcius is a whole lot warmer.

DJEarthQuake 04-09-2020 11:47

Re: City Temperature on join. | Updated ML (Sat 04/04/2020)
 
Quote:

Originally Posted by Napoleon_be (Post 2691494)
Add measure units such as Farenheit or Celsius. 15° farenheit is pretty cold, as 15° Celcius is a whole lot warmer.

Have you looked at the script? Both already exist.
Code:
92     g_cvar_units = register_cvar("sv_units", "imperial"); 254     get_pcvar_string(g_cvar_units, buf, charsmax(buf)); 255     if (containi(buf, "imperial") > -1 ) 256     { 257     iRED_TEMP = 70; 258     iBLU_TEMP = 45; 259     iGRN_HI = 69; 260     iGRN_LO = 46; 261     } 262     else if (containi(buf, "metric") > -1 ) 263     { 264     iRED_TEMP = 15; 265     iBLU_TEMP = -15; 266     iGRN_HI  = 14; 267     iGRN_LO = -14; 268     }

Napoleon_be 04-10-2020 04:50

Re: City Temperature on join. | Updated ML (Sat 04/04/2020)
 
Add it to your description or screenshot.

DJEarthQuake 04-10-2020 06:47

Re: City Temperature on join. | Updated ML (Sat 04/04/2020)
 
Taken care of. What else?

Napoleon_be 04-10-2020 06:50

Re: City Temperature on join. | Updated ML (Sat 04/04/2020)
 
Quote:

Originally Posted by DJEarthQuake (Post 2692146)
Taken care of. What else?

That was all :p

DJEarthQuake 01-17-2021 10:00

Re: City Temperature on join | Updated 10/04/2020
 
Gave plugin a queue. It cuts down on socket turbulence. Socket is set to busy with a boolean and the queue runs every so often to assure all the players' temps have been read and not duplicated. The socket function independently makes itself busy when being used and later reschedules other calls for temp readings on other players if pinged when in use. If in debugging mode, the sockets are a lot more descriptive in console with what player is using the socket and what point through the process are they.


new cvars
temp_long 0|1 is for acquiring temperature off longitude and latitude instead of city. Amxx182 cannot do that with GeoIP+ module so it is set to city by default.
temp_debug 0|1 Debugging is at the convenience of a CVAR instead of the nuisance of recompiling.

Old news but worth mentioning in case it is new to you.
  • Chinese translation
  • Speaks the temp (updated to handle sub zero)
  • Dynamically switches units Celsius or Fahrenheit on a per player basis as they connect instead of CVAR.


Developer footnote.
Next version. Stream-lining player by steamID like this. Instead of PLAYER_INDEX+CONSTANT_INTEGER. Minimizes data meshing. Sometimes Amxx never closes the socket right and the netstat will show CLOSE_WAIT indefinitely until process is killed not restarted. kILLeD!

Spoiler

DJEarthQuake 06-23-2021 23:50

Re: City Temperature on join | Updated 06/20/2021
 
Found a socket related crash bug even with a queue locking down the socket so no other players can get their temp simultaneous. The timing needed advanced. Posting much needed update. Feel free to PM me.


All times are GMT -4. The time now is 23:55.

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