AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hooking bots hurt (https://forums.alliedmods.net/showthread.php?t=105030)

Exolent[jNr] 10-01-2009 17:03

Re: Hooking bots hurt
 
Quote:

Originally Posted by ConnorMcLeod (Post 949451)
PHP Code:

public plugin_putinserverid 


Omg, where'd you get that function? :D

ConnorMcLeod 10-02-2009 01:08

Re: Hooking bots hurt
 
New forward i've found while searching offsets in my kitchen garden.

Doc-Holiday 10-02-2009 03:30

Re: Hooking bots hurt
 
Quote:

Originally Posted by ConnorMcLeod (Post 949782)
New forward i've found while searching offsets in my kitchen garden.

LMFAO


so then something like this would work using your methond of hooking bots


PHP Code:

/*
* Thanks to Conor for hooking bots
* to allow for Ham_TakeDamage to work on them
*  
*/

#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

#define VERSION "1.0"

//Conors news
new g_iFhUpdateClientDatag_iFirstBotId;

//My news
new dmg_reduce

public plugin_init()
{
    
register_plugin("Variable Friendly Fire"VERSION"=(GrG)=");
    
    
dmg_reduce register_cvar("dmg_var""0.0");
    
    new 
szModName[6];
    
get_modname(szModNamecharsmax(szModName));
    if( !
equal(szModName"czero") || cvar_exists("pb_version") )
    {
        
g_iFhUpdateClientData = -1;
    }
    
    
RegisterHam(Ham_TakeDamage"player""Player_TakeDamage");
}

public 
client_putinserverid )
{
    if( !
g_iFhUpdateClientData && is_user_bot(id) )
    {
        
g_iFirstBotId id;
        
g_iFhUpdateClientData register_forward(FM_UpdateClientData"UpdateClientData");
    }
    
}

public 
UpdateClientData(id)
{
    if( 
id == g_iFirstBotId )
    {
        
unregister_forward(FM_UpdateClientDatag_iFhUpdateClientData);
        
RegisterHam(Ham_TakeDamage"player""Player_TakeDamage");
    }
}

public 
Player_TakeDamageid iInflictor iAttackerFloat:fDamage iDamageType )
{
    
    if(
is_user_alive(id) && is_user_alive(iAttacker) && cs_get_user_team(id) == cs_get_user_team(iAttacker))
    {
        
SetHamParamFloat(4fDamage get_pcvar_float(dmg_reduce));
    }


This would multiply all friendly fire by the mulitplier right?

Arkshine 10-02-2009 06:24

Re: Hooking bots hurt
 
It should be RegisterHamFromEntity()

ConnorMcLeod 10-02-2009 13:16

Re: Hooking bots hurt
 
Ops :down:

Doc-Holiday 10-02-2009 18:04

Re: Hooking bots hurt
 
Quote:

Originally Posted by Arkshine (Post 949904)
It should be RegisterHamFromEntity()

whats that?

Doc-Holiday 10-05-2009 14:17

Re: Hooking bots hurt
 
By the way it still didnt work :(

vittu 10-05-2009 19:54

Re: Hooking bots hurt
 
Quote:

Originally Posted by NcB_Sav (Post 953233)
By the way it still didnt work :(

Did you fix your code in the UpdateClientData function for RegisterHamFromEntity instead of RegisterHam like was discussed above? Connor did fix his example, you may not have noticed.

ConnorMcLeod 10-06-2009 14:39

Re: Hooking bots hurt
 
And if still doesn't work, replace :

g_iFhUpdateClientData = register_forward(FM_UpdateClientData, "UpdateClientData")

with

g_iFhUpdateClientData = register_forward(FM_UpdateClientData, "UpdateClientData", 1)

WATCH_D0GS UNITED 02-27-2024 18:01

Re: Hooking bots hurt
 
Quote:

Originally Posted by ConnorMcLeod (Post 954206)
And if still doesn't work, replace :

g_iFhUpdateClientData = register_forward(FM_UpdateClientData, "UpdateClientData")

with

g_iFhUpdateClientData = register_forward(FM_UpdateClientData, "UpdateClientData", 1)

Not and will not, because you are trying to register ham for bots in a forward which is not called for bots, lol.


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

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