AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   HAM_TAKEDAMAGE problem (https://forums.alliedmods.net/showthread.php?t=121664)

Lure.d 03-18-2010 11:31

HAM_TAKEDAMAGE problem
 
Well i started learning hamsandwich module, and i got idea for one plugin.
So now i try to make a test function to print the victim into the chat :P

PHP Code:

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

public 
fw_TakeDamage(inflictorvictim) {
    new 
v_name[32];
    
get_user_name(victimv_namesizeof(v_name) - 1);
    
    
client_print(inflictorprint_chat"You've just hit %s! Nice work."v_name);


So i don't know about this, but it only prints out the message when i hit myself o_0.
So can you help me?

minimiller 03-18-2010 11:37

Re: HAM_TAKEDAMAGE problem
 
public fwdTakeDamage(iVictim, iWeapon, iAttacker, Float:flDamage, iDmgBits)

Lure.d 03-18-2010 11:42

Re: HAM_TAKEDAMAGE problem
 
still same.

ConnorMcLeod 03-18-2010 11:46

Re: HAM_TAKEDAMAGE problem
 
Quote:

Originally Posted by minimiller (Post 1121492)
public fwdTakeDamage(iVictim, iWeapon, iAttacker, Float:flDamage, iDmgBits)

This is wrong, second param is not the weapon, it's in most cases the same as attacker. It can be the nade id when it is a HE.

PHP Code:

#include <amxmodx>
#include <hamsandwich>

new const VERSION[] = "0.0.1"

public plugin_init()
{
    
register_plugin("Regeneration"VERSION"ConnorMcLeod")

    
RegisterHam(Ham_TakeDamage"player""CBasePlayer_TakeDamage")
}

public 
CBasePlayer_TakeDamage(id eInflictoreAttackerFloat:flDamagebitsDamageType )
{
    
// First check if attacker is a player
    
if( eAttacker != id && is_user_connectedeAttacker ) )
    {
        new 
szName[32]
        
get_user_name(idszNamecharsmax(szName))
        
client_print(eAttackerprint_chat"You've just hit %s! Nice work."szName)
    }



Lure.d 03-18-2010 11:56

Re: HAM_TAKEDAMAGE problem
 
good for self detection but not good for output, still no message if i hit a player :|

EDIT: NVM using csx for the damage...

ConnorMcLeod 03-18-2010 13:28

Re: HAM_TAKEDAMAGE problem
 
You use cs1.6 steam ?

Lure.d 03-18-2010 13:38

Re: HAM_TAKEDAMAGE problem
 
well yes... i can screenshot and you can always go to my steam page ^_^ ...

What a DUMB question though, non steam isn't alloved here.

wrecked_ 03-18-2010 13:43

Re: HAM_TAKEDAMAGE problem
 
Quote:

Originally Posted by Lure.d (Post 1121572)
What a DUMB question though, non steam isn't alloved here.

No it's not. Non-Steam isn't allowed here but it's still attempted to be used here.

ConnorMcLeod 03-18-2010 14:22

Re: HAM_TAKEDAMAGE problem
 
I guess then you miss the file hamdata.ini in configs folder, or that file is wrong.

Lure.d 03-18-2010 15:08

Re: HAM_TAKEDAMAGE problem
 
Quote:

Originally Posted by ConnorMcLeod (Post 1121604)
I guess then you miss the file hamdata.ini in configs folder, or that file is wrong.

You were right, my fault :|


All times are GMT -4. The time now is 08:47.

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