Raised This Month: $51 Target: $400
 12% 

ELEMENT|Live Weather with windage cvar. (Updated AUG 14TH 2022.)


Post New Thread Reply   
 
Thread Tools Display Modes
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 09-16-2018 , 17:52   Re: Element
Reply With Quote #31

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.

Last edited by DJEarthQuake; 09-16-2018 at 17:53. Reason: interuption
DJEarthQuake is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-17-2018 , 09:15   Re: Element
Reply With Quote #32

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).
__________________

Last edited by HamletEagle; 09-17-2018 at 09:17.
HamletEagle is offline
Old 09-17-2018, 11:04
DJEarthQuake
This message has been deleted by DJEarthQuake. Reason: Comment was a reaction based off of typo. NVM!!
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-17-2018 , 11:39   Re: Element
Reply With Quote #33

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.
__________________

Last edited by HamletEagle; 09-17-2018 at 11:45.
HamletEagle is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 09-17-2018 , 13:06   Re: Element
Reply With Quote #34

Quote:
Originally Posted by HamletEagle View Post
You asked for a review.
Why can't everyone ask for that?
__________________
edon1337 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-17-2018 , 13:55   Re: Element
Reply With Quote #35

Quote:
Originally Posted by edon1337 View Post
Why can't everyone ask for that?
Can you elaborate? Everyone can ask.
__________________
HamletEagle is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 09-17-2018 , 14:53   Re: Element
Reply With Quote #36

Quote:
Originally Posted by HamletEagle View Post
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.
__________________

Last edited by edon1337; 09-17-2018 at 14:54.
edon1337 is offline
Old 09-17-2018, 14:57
DJEarthQuake
This message has been deleted by DJEarthQuake. Reason: omit
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 09-17-2018 , 14:58   Re: Element
Reply With Quote #37

Quote:
Originally Posted by DJEarthQuake View Post
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.
__________________
edon1337 is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 09-17-2018 , 16:15   Re: Element
Reply With Quote #38

Quote:
Originally Posted by edon1337 View Post
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
__________________
JusTGo is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 09-17-2018 , 16:21   Re: Element
Reply With Quote #39

Quote:
Originally Posted by JusTGo View Post
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.
__________________
edon1337 is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 09-17-2018 , 16:24   Re: Element
Reply With Quote #40

Quote:
Originally Posted by edon1337 View Post
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
__________________
JusTGo is offline
Old 09-17-2018, 18:47
DJEarthQuake
This message has been deleted by DJEarthQuake. Reason: nvm again
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 20:25.


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