AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Name of the attacker of an entity (https://forums.alliedmods.net/showthread.php?t=84980)

Speed! 02-03-2009 19:15

Name of the attacker of an entity
 
i wish to know how to get the id of the player who attacks an entity, and the one who break it. im using fakemeta.
i have not much knoweldage with fakemeta, with other modules yes, but fakemeta isnt my strong point at all LOL

Emp` 02-03-2009 19:46

Re: Name of the attacker of an entity
 
You'll probably want to use the ham sandwich module for this.

Look into Ham_TakeDamage and Ham_Killed

Speed! 02-03-2009 19:49

Re: Name of the attacker of an entity
 
Quote:

Originally Posted by Emp` (Post 755260)
You'll probably want to use the ham sandwich module for this.

Look into Ham_TakeDamage and Ham_Killed

does ham_killed work for entitys? O.o

should be like this?
RegisterHam(Ham_Killed, "entity", "fw_PlayerKilled")

Emp` 02-03-2009 20:00

Re: Name of the attacker of an entity
 
Pretty sure it does.

If you plan on replacing "entity" with the classname, yes.

Speed! 02-03-2009 20:05

Re: Name of the attacker of an entity
 
thank you very much emp :D your help is to useful here :D
+k

Speed! 02-03-2009 20:43

Re: Name of the attacker of an entity
 
it isnt working :S
im doint this

PHP Code:

RegisterHam(Ham_KilledENT_CLASS_NAME"fw_somethingKilled"

PHP Code:

public fw_somethingKilled(victimattackershouldgib)
{
    new 
owner;
    
owner pev(victim,LASERMINE_OWNER);
    new 
name1[2];
    new 
name2[2];
    
get_user_name(ownername1sizeof name1 1);
    
get_user_name(attackername2sizeof name2 1);
    
client_print(ownerprint_chat,"%s blablabla %s"name2name1);
    
client_print(attackerprint_chat,"%s blablabla %s"name2name1);


PHP Code:

    set_pev(i_Ent,pev_classname,ENT_CLASS_NAME);

    
engfunc(EngFunc_SetModel,i_Ent,ENT_MODELS);

    
set_pev(i_Ent,pev_solid,SOLID_NOT);
    
set_pev(i_Ent,pev_movetype,MOVETYPE_FLY);

    
set_pev(i_Ent,pev_frame,0);
    
set_pev(i_Ent,pev_body,3);
    
set_pev(i_Ent,pev_sequence,TRIPMINE_WORLD);
    
set_pev(i_Ent,pev_framerate,0);
    
    
set_pev(i_Ent,pev_takedamage,DAMAGE_YES);
    
    
set_pev(i_Ent,pev_dmg,100.0);
    
set_user_health(i_Ent,get_pcvar_num(g_LHEALTH)); 

message is never shown

Exolent[jNr] 02-03-2009 22:36

Re: Name of the attacker of an entity
 
If "ENT_CLASS_NAME" is not a normal classname for entities, then you will need to use RegisterHamFromEntity().

Speed! 02-03-2009 22:54

Re: Name of the attacker of an entity
 
Quote:

Originally Posted by Exolent[jNr] (Post 755342)
If "ENT_CLASS_NAME" is not a normal classname for entities, then you will need to use RegisterHamFromEntity().

will try :D thnks for the help

Speed! 02-03-2009 23:10

Re: Name of the attacker of an entity
 
doesent work O.o
im doing this (probably wrong coz y never used this LOL)

Code:

public spawn (id)
{
new i_Ent = engfunc(EngFunc_CreateNamedEntity,g_EntMine);
...
...
RegisterHamFromEntity(Ham_Killed, i_Ent, "fw_SomethingKilled")
}


Exolent[jNr] 02-04-2009 14:47

Re: Name of the attacker of an entity
 
Show the full code.


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

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