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

Grenade no effect if armor is above 500


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 04-07-2021 , 11:31   Grenade no effect if armor is above 500
Reply With Quote #1

Hello, so i cant figure it out how do i make that if armor is above 500 the infection bomb wont do anything to a player. Also the glow doesnt seem to appear for me... What im doing wrong? Can someone help? Thanks in advance.

Infection grenade -
PHP Code:
while ((victim engfunc(EngFunc_FindEntityInSpherevictimoriginFNADE_EXPLOSION_RADIUS)) != 0)
    {
        
// Only effect alive non-spawnprotected humans
        
if (!is_user_valid_alive(victim) || g_zombie[victim] || g_nodamage[victim])
            continue;
            
        static 
Float:armor
        pev
(victimpev_armorvaluearmor)
        
        
// If he has above 500 reduce it - it also infects a player with it, idk why
        
if (get_user_armor(victim) <= 500)
        {
        
set_pev(victimpev_armorvaluefloat(min(pev(victimpev_armorvalue)-5000)))
        
fm_set_rendering(victimkRenderFxGlowShell02550kRenderNormal25);
        
set_task(5.0"remove_armor_glow"victim__"b")
        }
            
        
        
/* Last human is killed
        if (fnGetHumans() == 1)
        {
            ExecuteHamB(Ham_Killed, victim, attacker, 0)
            continue;
        }*/
        
        // Infected victim's sound
        
ArrayGetString(grenade_infect_playerrandom_num(0ArraySize(grenade_infect_player) - 1), soundcharsmax(sound))
        
emit_sound(victimCHAN_VOICEsound1.0ATTN_NORM0PITCH_NORM)
        
        
// Turn into zombie
        
zombieme(victimattacker0011)
    } 
Here is the glow what should appear but it doesnt.
PHP Code:
public remove_armor_glow(id)
{
        
fm_set_rendering(idkRenderFxGlowShell000kRenderNormal25);


Last edited by HowToRuski; 04-07-2021 at 11:32.
HowToRuski is offline
LondoN
Senior Member
Join Date: Dec 2015
Location: Roman, Romania.
Old 04-07-2021 , 12:54   Re: Grenade no effect if armor is above 500
Reply With Quote #2

Code:
static Float: armor;
pev(victim, pev_armorvalue, armor);

if(armor >= 500.0)
{
	set_pev(victim, pev_armorvalue, 0.0);
	break;
}
in while() just do somethink like this. using break will stop the function.
__________________
LondoN is offline
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 04-07-2021 , 13:07   Re: Grenade no effect if armor is above 500
Reply With Quote #3

Quote:
Originally Posted by LondoN View Post
Code:
static Float: armor;
pev(victim, pev_armorvalue, armor);

if(armor >= 500.0)
{
	set_pev(victim, pev_armorvalue, 0.0);
	break;
}
in while() just do somethink like this. using break will stop the function.
so but if i want not to set it 0? how do i make it just remove 500 armor not set it to 0?
HowToRuski is offline
LondoN
Senior Member
Join Date: Dec 2015
Location: Roman, Romania.
Old 04-07-2021 , 13:11   Re: Grenade no effect if armor is above 500
Reply With Quote #4

Quote:
Originally Posted by HowToRuski View Post
so but if i want not to set it 0? how do i make it just remove 500 armor not set it to 0?
set_pev(victim, pev_armorvalue, armor-500.0);
__________________
LondoN is offline
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 04-07-2021 , 13:18   Re: Grenade no effect if armor is above 500
Reply With Quote #5

Quote:
Originally Posted by LondoN View Post
set_pev(victim, pev_armorvalue, armor-500.0);
Nice. Thanks ;)

Last edited by HowToRuski; 04-07-2021 at 13:30.
HowToRuski is offline
Reply


Thread Tools
Display Modes

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 00:36.


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