This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Is this execution correct?


Post New Thread Reply   
 
Thread Tools Display Modes
Krystek.
Member
Join Date: May 2022
Old 07-23-2022 , 04:05   Re: Is this execution correct?
Reply With Quote #11

Quote:
Originally Posted by fysiks View Post
Did you remove both of them? It also looks like you haven't fixed the amx_log arguments that I mentioned. I think that will probably cause an error and prevent the loop from working like it should.
Forgive the confusion, edited my previous post, would you please take another look?
Krystek. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-23-2022 , 17:09   Re: Is this execution correct?
Reply With Quote #12

Ok, so I think I misunderstood what the original code was doing so my suggestions won't work correctly. If the original code was working, I'd simply go with that.

If the original code wasn't working then you'll need to explain, with words, how you're wanting this function/code to behave.
__________________
fysiks is offline
Krystek.
Member
Join Date: May 2022
Old 07-23-2022 , 17:24   Re: Is this execution correct?
Reply With Quote #13

Quote:
Originally Posted by fysiks View Post
Ok, so I think I misunderstood what the original code was doing so my suggestions won't work correctly. If the original code was working, I'd simply go with that.

If the original code wasn't working then you'll need to explain, with words, how you're wanting this function/code to behave.

PHP Code:
    if(cod_get_user_perk(vid) == || cod_get_user_perk(vid) == || cod_get_user_perk(vid) == || cod_get_user_perk(vid) == || cod_get_user_perk(vid) == || cod_get_user_perk(vid) == 13) {
        
durability_perks[vid] -= (durability_perks[vid] > damage_better_items)? damage_better_itemsdurability_perks[vid];
    } else {
        
durability_perks[vid] -= (durability_perks[vid] > damage_items)? damage_itemsdurability_perks[vid];
    } 
It's supposed to work the same as above but with the code changed to this one.

PHP Code:
    new const perks_id[] = { 1234713 };
    new 
perk_player cod_get_user_perk(id);

    for( new 
0sizeof(perks_id); ++) {
        if( 
perk_player == perks_id[i] ) {
            
log_amx("Better Durability: %i | PerkID %i"durability_perks[id], perks_id[i]);
            
durability_perks[id] -= (durability_perks[id] > damage_better_items)? damage_better_itemsdurability_perks[id];
            
log_amx("Better Durability: %i | PerkID %i"durability_perks[id], perks_id[i]);
        } else {
            
log_amx("Durability: %i"durability_perks[id], perks_id[i]);
            
durability_perks[id] -= (durability_perks[id] > damage_items)? damage_itemsdurability_perks[id];
            
log_amx("Durability: %i"durability_perks[id], perks_id[i]);
        }
    } 
Krystek. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-23-2022 , 17:58   Re: Is this execution correct?
Reply With Quote #14

Right, so the only thing your changing is the dynamic search of the perks_id array. I've been analyzing it for a since my last post and I came up with this:

PHP Code:
    new damage_better_items random_num(312);
    new 
damage_items         random_num(16);

    new 
perks_id[] = { 1234713 };

    new 
bool:bFound false;
    for( new 
isizeof(perks_id); i++ )
    {
        if( 
cod_get_user_perk(vid) == perks_id[i] )
        {
            
bFound true;
            break;
        }
    }

    
durability_perks[vid] = max(0durability_perks[vid] - (bFound damage_better_items damage_items)) // The max() simply enforces a minimum of 0 
__________________
fysiks 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 07:52.


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