AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   edit hook jump on players head by Connor (https://forums.alliedmods.net/showthread.php?t=317426)

Meelo 07-12-2019 17:24

edit hook jump on players head by Connor
 
Hello, i have this simple plugin from Connor's last post:
https://forums.alliedmods.net/showthread.php?p=1906203
and it works fine but i have problem with xpmod

PHP Code:

public OnCBasePlayer_PostThinkid )
{
    if( 
is_user_alive(id) )
    {
        new 
Float:flFallVelocity get_pdata_float(idm_flFallVelocity)
        if( 
flFallVelocity 10.0 )
        {
            new 
target pev(idpev_groundentity)
            if( 
IsPlayer(target) && is_user_alive(target) )
            {
                
iExp[id] += gNumExp// nothing happend ( i want give exp to player on the top)
                
iExp[target] += gNumExp// now player on the bottom receives exp
              //  ExecuteHam(Ham_TakeDamage, target, id, id, flFallVelocity * 0.1, DMG_FALL)
            
}
        }
    }



Natsheh 07-12-2019 18:15

Re: edit hook jump on players head by Connor
 
If you have no experience in coding pawn please post in the suggestion requests otherwise everything we will tell you is a nonsense.

Meelo 07-12-2019 18:56

Re: edit hook jump on players head by Connor
 
however, maybe some tips how to do it? i would rather do it by myself

Natsheh 07-12-2019 19:11

Re: edit hook jump on players head by Connor
 
First you need to describe what is the problem in order to solve it, what you have commented inside the script has nothing g to do with describing the problem.

Meelo 07-12-2019 19:28

Re: edit hook jump on players head by Connor
 
I need to give exp to the player who is standing/jumping on the second player. I tested this plugin and this works:
iExp[target] += gNumExp;
but target = player on the bottom, not on the top. The problem is if i change
iExp[target] += gNumExp;
to
iExp[id] += gNumExp;

nothing happens

OciXCrom 07-12-2019 20:27

Re: edit hook jump on players head by Connor
 
"id" is the player on the top. If it's not working, the problem is elsewhere.

PS: I suggest you have a look at my Goomba Stomp plugin - it does what you want in a much better way + it has a built-in option to give XP.

Natsheh 07-13-2019 02:11

Re: edit hook jump on players head by Connor
 
Quote:

Originally Posted by OciXCrom (Post 2658921)
"id" is the player on the top. If it's not working, the problem is elsewhere.

PS: I suggest you have a look at my Goomba Stomp plugin - it does what you want in a much better way + it has a built-in option to give XP.

I don't think he needs a plugin detects when a player fall damage on another player's head...

OP : you can hook touch its much better on the other hand you can work with your method but I don't recommend using player thinking but if you want to work with your method you must do debug printing...

And see if the array cell is getting increased.

Also declare the variables as static in this kind of forwards.

edon1337 07-14-2019 16:13

Re: edit hook jump on players head by Connor
 
Quote:

Originally Posted by Meelo (Post 2658908)
Hello, i have this simple plugin from Connor's last post:
https://forums.alliedmods.net/showthread.php?p=1906203
and it works fine but i have problem with xpmod

PHP Code:

public OnCBasePlayer_PostThinkid )
{
    if( 
is_user_alive(id) )
    {
        new 
Float:flFallVelocity get_pdata_float(idm_flFallVelocity)
        if( 
flFallVelocity 10.0 )
        {
            new 
target pev(idpev_groundentity)
            if( 
IsPlayer(target) && is_user_alive(target) )
            {
                
iExp[id] += gNumExp// nothing happend ( i want give exp to player on the top)
                
iExp[target] += gNumExp// now player on the bottom receives exp
              //  ExecuteHam(Ham_TakeDamage, target, id, id, flFallVelocity * 0.1, DMG_FALL)
            
}
        }
    }



Show me how iExp is created and where it's used. I also advice you to put a log print to see if that part of the code even gets called.


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

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