AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   ELEMENT|Live Weather with windage cvar. (Updated AUG 14TH 2022.) (https://forums.alliedmods.net/showthread.php?t=245120)

DJEarthQuake 07-28-2014 15:44

ELEMENT|Live Weather with windage cvar. (Updated AUG 14TH 2022.)
 
3 Attachment(s)
Click below for Snow demo.
https://i.imgur.com/2wpV1d0.gif
Modern Amxx weather feed and generation for all mods.

This is a fork of Autoweather by TeddyDesTodes.

Some things that makes this weather plugin unique.
  • It works on all mods.
  • Attempts to make weather on mods that do not have it in the dll have been strenuously made.
  • Sophisticated debugger.
  • Windage.
  • Companion plugin 'clientemp' gets the temperature for clients as they connect and speaks it. Same API token.
https://i.imgur.com/nkEUUL4.gif

Rain, snow, skies, dusk, dawn, and wind are all brought into your server.


Commands, Cvars, FAQ, and known limits.
Spoiler

QUICK INSTALL INSTRUCTIONS AND OVERVIEW
Download Script
Get this from Github.
Compile script locally and install the skies as well as plugin.

Once running plugin checks if there is an openweathermap.org key added as CVAR.
Server will then produce weather automatically based on locale from CVAR, sv_region.
Incompatible with Amxx 1.82.

internel 07-28-2014 18:05

Re: Element
 
Thank you so much for updating that plugin. I couldn't answer your PM, but you know, If you want to add ML support, I'll be glad to help with Spanish ^^

I'm going to test it!

DJEarthQuake 07-28-2014 22:01

Re: Element
 
You are most welcome internal.

internel 07-29-2014 17:42

Re: Element
 
This is AWESOME!! I just tested it, and it works perfectly!! :D, you sir did a great job here ! :crab:

thank ye!

Vivo 07-29-2014 22:34

Re: Element
 
Sounds great :D

DJEarthQuake 07-31-2014 04:49

Re: Element
 
Ironically I almost forgot the earthquake condition. I have seen maps with such an effect that will be perfect here. Those are rare. Therefore this is placed at an extremely low priority.

A proposed windy condition will make us have to check the wind direction and compensate at range.

Already existing plugin Shot Administration (by Nomexous) or similar will be used to handle the trigger of high wind.
Accuracy fix could be used then disabled when it gets windy. I also noticed ever since CS 1.6 got to Steam it wasn't accurate.

The sky is off at noon and shows a night sky still. This will be corrected too. Let me know what else. I appreciate the salutations.

zmd94 08-01-2014 21:43

Re: Element
 
Quote:

Originally Posted by DJEarthQuake (Post 2176634)
Ironically I almost forgot the earthquake condition.

A proposed windy condition will make us have to check the wind direction and compensate at range.

So, epic. :up:

I will wait for this update. Just let we all know, when it is ready.

DJEarthQuake 08-22-2014 15:40

Re: Element
 
I made an update to the source. Debugging was enabled. Now it is disabled. Majority of the log is currently too cryptic. I had an update earlier this week. I promptly took it down. Sky tuning is still underway. IE | Night sky showing at noon.

DJEarthQuake 08-26-2014 01:15

Re: Element
 
I like how OpenWeatherMap.org has current wind condition.

$~telnet api.openweathermap.org 80
Trying 162.243.53.59...
Connected to api.openweathermap.org.
Escape character is '^]'.
[
Code:

GET /data/2.5/weather?id=4887398&units=imperial&APPID=register-for-a-openweathermap&u=c HTTP/1.0
...PRESS ENTER TWICE...

HTTP/1.1 200 OK
Server: openresty
Date: Sun, 02 Apr 2017 00:57:51 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 438
Connection: close
X-Cache-Key: /data/2.5/weather?APPID=register-for-a-openweathermap=4887398&u=c&units=imperial
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST

{"coord":{"lon":-87.65,"lat":41.85},"weather":[{"id":800,"main":"Clear","description":"cl ear sky","icon":"01n"}],"base":"stations","main":{"temp":50,"pressur e":1022,"humidity":46,"temp_min":46.4,"temp_m ax":53.6},"visibility":16093,"wind":{"speed":6.93,"deg" :110},"clouds":{"all":1},"dt":1491093300,"sys":{" type":1,"id":1007,"message":0.1218,"country": "US","sunrise":1491132670,"sunset":1491178654 },"id":4887398,"name":"Chicago","cod":200}
Connection closed by foreign host.

This is a good start. If anybody else wanted to collaborate or spin-off with the sniping section! Hint hint wink wink nudge n u d g e.

Dare.Devil 08-27-2014 15:54

Re: Element
 
where exactly in yahoo can I find the region code??..

you said in first post e.g chicago 2379574 ..

how do I get this serial code??

thanks in advance

DJEarthQuake 08-27-2014 19:50

Re: Element
 
Go to Yahoo, click weather, or weather.yahoo.com, enter city. Number appears at end of address.

Dare.Devil 08-28-2014 02:14

Re: Element
 
Quote:

Originally Posted by DJEarthQuake (Post 2190649)
Go to Yahoo, click weather, or weather.yahoo.com, enter city. Number appears at end of address.

found it thanks :).. by the way great app hope the weather changes soon :) in London don't want to wait until December :P

xairgeo 10-26-2014 04:37

Re: Element
 
Players, weapons and some objects are very dark how do i fix this? the cvars minlight and maxlight only makes the game bright.

Edit: okay, when i step into a shadow or when im inside a building i can see my weapon and other players perfectly but as soon as i step outside into the light my gun model becomes very dark and when players move into the light they also become very dark, again the cvars don't help.

DJEarthQuake 10-26-2014 13:47

Re: Element
 
If night vision or flashlight isn't available use weather_minlight 20.

juanjotoronja 04-10-2015 15:58

Re: Element
 
Hi this can be used directly with CS 1.6 or is it only for half-life?

DJEarthQuake 04-10-2015 16:45

Re: Element
 
It works best with 1.6 and similar.

juanjotoronja 04-10-2015 16:57

Re: Element
 
This is my weather info https://weather.yahoo.com/argentina/...-aires-468739/ So should i put those 6 digits in this line?
Code:

g_cvar_region    = register_cvar("region","2379574");
When i use the command say /mytemp it says in the motd that it couldn't recognize my IP and then shows google search results, also in the game i think time zone is wrong because when i tested it was 4 pm and in game was night. I don't know if this has anything to do with this error but in windows in regional settings for unicode i have english united states and not spanish argentina how it should be.

DJEarthQuake 04-11-2015 13:46

Re: Element
 
  • rcon region 468739 sets locale as buenos aires.
  • That daily eclipse is being fixed.
  • /mytemp initializes: "If we can not determine your country off your IP then this will display generic weather page..." Google weather loads in any event.
  • AMXX uses GEOIP. WHOIS over SOCKETS resolves GEOIP antiquation.
Code:

GET http://api.hackertarget.com/whois/?q=8.8.8.8 | grep -w "Country"
Country:        US
Country:        US

GET http://api.hackertarget.com/whois/?q=8.8.8.8 | grep -w "City"
City:          Broomfield
City:          Mountain View


DJEarthQuake 03-20-2017 15:24

Re: Element
 
Since Yahoo got exploited they treat petty weather feeds like something they are not it disabled the plug-in!

SAN FRANCISCO — For sale: one billion accounts, $200,000 or best offer. The passwords don’t work, but the dates of birth, telephone numbers and security questions could still be useful to an adept cyberthief.

edon1337 03-20-2017 15:52

Re: Element
 
I haven't tested but this sounds cool :)

DJEarthQuake 04-01-2017 17:56

Re: Element
 
Eclipse is fixed. A run-time error and segment fault are both now eliminated.
Weather is in real time for the Spring of 2017. Last release was hourly in 2014. Original was 3 day a decade ago.

Openweathermap has an ID to register for and use like Yahoo but easier to code.
Epoch.inc that might be augmented into this in near future.

Chicago tested.

PHP Code:

region  "4887398&units=imperial&APPID=getyourown32-bitregistration" 

Mets Masrik, Armenia tested.

Code:

region "616411&units=metric&APPID=getyourown32-bitregistration"
We have to use this long string now instead of a simple region due to New World Order of weather feed security!

Krtola 04-04-2017 08:50

Re: Element
 
map name from first post please?

JusTGo 05-12-2017 09:07

Re: Element
 
afaik that bug got fixed long time ago what hlds version you use ?

SpawnerF 07-12-2017 18:52

Re: Element
 
The idea is good but the code is messy, you need to clean it first.

DJEarthQuake 07-25-2017 07:31

Re: Element
 
Will do.

FR0NTLINE 08-13-2017 01:29

Re: Element
 
I thought Okapi was never working correctly?
and what kind of file is this? extract in cstrike_folder.tar.lzma

DJEarthQuake 04-10-2018 00:45

Re: Element
 
Since major upgrade of server I had to use amxmodx-1.8.3-dev-git5151-base instead of amxmodx-1.8.2-base-linux. First time using Apple Hardware for server. I like grepping with amx_search so much I prefer it over the non-developer version. If you are using PC this might not ever happen. Apple's chips are 'unique'.

chuttenjr 09-15-2018 12:29

Re: Element
 
#DJEarthQuake ,have you found a fix for the silent footsteps while outside bug??,i experienced it and thought my pl_steps where corrupted or that they were of a very high bitrate annd frequency and did a fresh vanilla cs reinstall and after that i read that know bug.... hehehe

Cheers

Eduardo

DJEarthQuake 09-15-2018 15:33

Re: Element
 
There's more inherited stuff that's wrong. When it is raining I hear snow steps instead of puddle splashes. I really hadn't been bothered by it enough to resolve it yet.

chuttenjr 09-16-2018 17:15

Re: Element
 
No problem at all,i understand it.
Getting my cs back to normal mod madness wasnt that hard at all.
Also tested again both auto weather and auto weather yahoo and they both have the same issue with the outside muted footsteps.
I will post a request to see if someone wants to dig into the code (doubt it) to see where the problem is.
It was a joy to see the different light settings, skies and such , a really great idea for such a limited game engine :(.

DJEarthQuake 09-16-2018 17:52

Re: Element
 
There aren't any Yahoo versions out there with working weather feeds which is what the mod is about not footsteps. I was the one looking for a stats plugin, found this and changed it from BBC to Yahoo, then to openweathermap. If the feed does not work then the weather is static and never changes. The footsteps work great outside only when it's snowing. I wasn't joking about it being an inherited bug within plugin. I gave my shot out to Autoweather on front page here.

HamletEagle 09-17-2018 09:15

Re: Element
 
I can review it, but please intend it properly first. It's a total mess.
Also use spaces in functions. A function should not be just one huge block of code. It's completely unreadable(example daylight).

HamletEagle 09-17-2018 11:39

Re: Element
 
I find it hard to believe you were a developer for so many years and think this is fine:
PHP Code:

     log_amx("darkness %d",light);
        
//log_amx("%s %s %s",g_LightLevel[get_pcvar_num(g_cvar_minlight)],g_LightLevel[light],g_LightLevel[get_pcvar_num(g_cvar_maxlight)]); // old works all ltrs
    
log_amx("dark %d phase %d lums %d",get_cvar_num("dark"),light,get_cvar_num("lums"));
    
log_amx("darkness added to max light is %d out of 25 total darkness",light); 

PHP Code:

new num[10];
                        
num_to_str(g_sunrise,num,10);
                        
nvault_set(g_vault,"sunrise",num);
g_sunrise str_to_num(out); 

PHP Code:

new num[1];
                        
num_to_str(g_env,num,1);
                        
nvault_set(g_vault,"env",num); 

PHP Code:

if(containi(buf,"temp_min")>= && g_temp_min == 0) {
            new 
out[32];
            
copy(out,4,buf[strfind(buf,"temp_min")+10]);
            
replace(out,4,",",""); //was 5 both
            
replace(out,4,"#","");
            
#if defined DEBUG
                
log_amx("Low of: %s",out);
            
#endif
            
nvault_set(g_vault,"mintemp",out);
            
g_temp_min str_to_num(out);
        }
                if(
containi(buf,"visibility")>= 0){
                        new 
out[32];
                        
copyc(out,32,buf[containi(buf,"visibility")+12],'"');
                        
#if defined DEBUG
                            
log_amx("Visibility: %s",out);
                        
#endif
            
nvault_set(g_vault,"visi",out);
                        
g_visi str_to_num(out);
                }
                if(
containi(buf,"humidity")>= && g_hum == 0) {
                        new 
out[32];
                        
copyc(out,32,buf[containi(buf,"humidity")+10],'"'); // was 10
                        #if defined DEBUG
                            
log_amx("Humidity: %s",out);
                        
#endif
                        
nvault_set(g_vault,"humidity",out);
                        
g_hum str_to_num(out);

        } 

I also don't see the point in that wall of text, mentioning what plugins you did before or what other people did or didn't do. It's off-topic.
You asked for a review. The first thing that should be fixed is the indentation, make it consistent.

edon1337 09-17-2018 13:06

Re: Element
 
Quote:

Originally Posted by HamletEagle (Post 2615555)
You asked for a review.

Why can't everyone ask for that?

HamletEagle 09-17-2018 13:55

Re: Element
 
Quote:

Originally Posted by edon1337 (Post 2615567)
Why can't everyone ask for that?

Can you elaborate? Everyone can ask.

edon1337 09-17-2018 14:53

Re: Element
 
Quote:

Originally Posted by HamletEagle (Post 2615573)
Can you elaborate? Everyone can ask.

What I was pointing at was that you agreed to review his code just because he asked for a review meanwhile there's tons of older or quicker-to-review codes out there, not my problem but just saying.

Improvements:

1. Give your variables better naming, for ex: g_cvar_uplink should be g_szCvar_Uplink as it holds a string meanwhile g_cvar_maxlight should be g_iCvar_Maxlight because it holds an integer.

2. The same goes to your functions, you should give some special attention to naming your functions, as it's going to help the readers a lot if the functions are named accordingly.

3.
PHP Code:

public fwd_PlayerPreThink(id)
{
    if(!
is_user_alive(id))
        return 
FMRES_IGNORED;
    static 
Float:fGmTime fGmTime get_gametime();
    if(
g_fNextStep[id] < fGmTime)
    {
        if(
fm_get_user_speed(id) && (pev(idpev_flags) & FL_ONGROUND) && is_user_outside(id))
        {
            
set_pev(idpev_flTimeStepSound999);
            if(
g_env == 3){
                
engfunc(EngFunc_EmitSoundidCHAN_AUTOg_szSnowStepSound[random_num(0sizeof g_szSnowStepSound 1)], 0.5ATTN_NORM0PITCH_NORM);
            }
            
g_fNextStep[id] = fGmTime STEP_DELAY;
        }
    }
    return 
FMRES_IGNORED;


Playing sounds on PreThink? Is that really needed?

4.
PHP Code:

stock Float:fm_get_user_speed(id)
{
    if(!
is_user_connected(id))
        return 
0.0;
    static 
Float:fVelocity[3];
    
pev(idpev_velocityfVelocity);
    
fVelocity[2] = 0.0;
    return 
vector_length(fVelocity);


get_user_maxspeed?

5.
PHP Code:

}
public 
ClCmd_TemP(idlevelcid) {
new 
motd[512];
format(motd511"<html><meta http-equiv='Refresh' content='0; URL=https://google.com/search?q=weather'><body BGCOLOR='#FFFFFF'><br><center>If we can not determine your country off your IP then this will display generic weather page...</center></HTML>");
show_motd(idmotd"Weather Browser");


a. Use formatex
b. Use charsmax() instead of directly putting the size.

edon1337 09-17-2018 14:58

Re: Element
 
Quote:

Originally Posted by DJEarthQuake (Post 2615584)
If it's not broken then don't fix it. 5 years ago I cared. Now a day late and dollar short. It's amusing you picked the source I fixed and stopped the divide by zero and noon eclipse of why not to approve. I will work on known issue but not the prose. I did the port and some refinements. Try playing with mod first then critique please. Adding windage is all that interests me now.

Just because it works, doesn't mean it's good.

JusTGo 09-17-2018 16:15

Re: Element
 
Quote:

Originally Posted by edon1337 (Post 2615583)
Improvements:

1. Give your variables better naming, for ex: g_cvar_uplink should be g_szCvar_Uplink as it holds a string meanwhile g_cvar_maxlight should be g_iCvar_Maxlight because it holds an integer.

this is a bad advice. read this :
https://github.com/alliedmodders/amx...ment-420452301

edon1337 09-17-2018 16:21

Re: Element
 
Quote:

Originally Posted by JusTGo (Post 2615596)

It depends on each coder, but what he stated doesn't really make sense, size can be integer, float or even a string, it really depends on your situation.

JusTGo 09-17-2018 16:24

Re: Element
 
Quote:

Originally Posted by edon1337 (Post 2615597)
It depends on each coder, but what he stated doesn't really make sense, size can be integer, float or even a string, it really depends on your situation.

did you read the other posts your question is answered too


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

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