AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   friendlynade help (https://forums.alliedmods.net/showthread.php?t=242350)

Administrator 06-18-2014 02:08

friendlynade help
 
Hi guys.
I have a problem, does not put his grenade damage.

Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>

public plugin_init() {
        register_plugin("Friendly grenade damage","0.1","omnipotent")
        register_event("Damage","damage","b")
}

public damage(victim)
{
                new attacker, health
                health = 100 - read_data(2)
                get_user_attacker(victim)
                if (get_user_team(attacker) == get_user_team(victim))
                {
                        set_user_health(victim,health)
                }
}


jimaway 06-18-2014 05:53

Re: friendlynade help
 
get_user_attacker(victim) - returns attacker and it is not stored anywhere, does this plugin even compile?

Administrator 06-18-2014 21:45

Re: friendlynade help
 
pls, help me fix this plugin

Bladell 06-19-2014 04:15

Re: friendlynade help
 
PHP Code:

#include <amxmodx> 
#include <amxmisc> 
#include <fun>

public plugin_init() { 
    
register_plugin("Friendly grenade damage","0.1","omnipotent"
    
register_event("Damage","damage","b")


public 
damage(victim)
{
        new 
attackerhealth
        health 
100 read_data(2)
        
attacker get_user_attacker(victim)
        if (
get_user_team(attacker) == get_user_team(victim)) 
        {
            
set_user_health(victim,health)
        }


Not tested...

Flick3rR 06-19-2014 04:23

Re: friendlynade help
 
Where exactly is the part with the grenade? And, Bladell, you actually provided the same code. And I thi.k it's better to use Ham_TakeDamage and return it.

Bladell 06-19-2014 05:24

Re: friendlynade help
 
Quote:

Originally Posted by Flick3rR (Post 2153926)
Where exactly is the part with the grenade? And, Bladell, you actually provided the same code. And I thi.k it's better to use Ham_TakeDamage and return it.

I actually didn't provided the same code...

I changed
get_user_attacker(victim) to attacker = get_user_attacker(victim)

Flick3rR 06-19-2014 05:27

Re: friendlynade help
 
Оh, I see. My bad. But still, where is the grenade part? Also, try to make it with Ham_TakeDamage and return, it will be more efficient and won't set HP on each shoot.

hornet 06-19-2014 19:56

Re: friendlynade help
 
Guys please test your plugins before you post them. The given example doesn't make any sense as it is not related at all to grenade damage. You should hook TakeDamage() and manipulate the team / damage there.

Flick3rR 06-19-2014 20:11

Re: friendlynade help
 
If I got it right, you don't want to make a grenade damage on teammates? Or in other words - when you hit some teammate with HE grenade, he won't get any damage. Here is something like this.
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <hamsandwich>

#define PLUGIN "Friendly Nade No Damage"
#define VERSION "1.0"
#define AUTHOR "Flicker"

#define DMG_NADE (1<<24)

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_TakeDamage"player""Damage")
}

public 
Damage(victiminflictorattackerFloat:damagedmgbits
{
    if(
is_user_connected(attacker
    && 
get_user_team(attacker) == get_user_team(victim
    && (
dmgbits DMG_NADE))
        
SetHamParamFloat(40.0)
        
//or
        //return HAM_SUPERCEDE
        
    
return HAM_IGNORED



Administrator 06-20-2014 04:00

Re: friendlynade help
 
I need to hurt his grenade


All times are GMT -4. The time now is 21:17.

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