AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ExecuteHamB, inflictor. (https://forums.alliedmods.net/showthread.php?t=116692)

xbatista 01-25-2010 14:04

ExecuteHamB, inflictor.
 
When I create an entity and player is killed it writes : killed with "worldspawn" , why?
My weaponDescription[] for example is 'mega_knife'

PHP Code:

public Dmg_Kill_Player(idattackerFloat:damageweaponDescription[])
{
    if( 
is_user_alive(attacker) ) 
    {
        new 
Ent create_entity(weaponDescription);
        
ExecuteHamBHam_TakeDamageidEntattackerdamageDMG_GENERIC );
        
remove_entity(Ent);
    }



ConnorMcLeod 01-25-2010 14:13

Re: ExecuteHamB, inflictor.
 
Because you cant create an entity with a custom classname, so the ent is not created.
Create a info_target, and then alter the classname.
Actually you pass Ent == 0 == world.

If you need this at different places in your plugin and with different classes you can use this stock :

PHP Code:

create_custom_entity(const weaponDescription[])
{
    new 
iEnt create_entity("info_target")
    if( 
iEnt )
    {
        
set_pev(iEntpev_classnameweaponDescription)
    }
    return 
iEnt


Then :

new Ent = create_custom_entity(weaponDescription);

Exolent[jNr] 01-25-2010 14:14

Re: ExecuteHamB, inflictor.
 
You can't use create_entity() with an invalid entity classname.

EDIT: Hi, Connor :)

xbatista 01-25-2010 14:21

Re: ExecuteHamB, inflictor.
 
Thanks and:

PHP Code:

public Dmg_Kill_Player(idattackerFloat:damageweaponDescription[])
{
    if( 
is_user_alive(attacker) ) 
    {
        new 
FakeEnt create_entity("info_target");
        
entity_set_stringFakeEntEV_SZ_classnameweaponDescription)
        
ExecuteHamBHam_TakeDamageidFakeEntattackerdamageDMG_GENERIC );
        
remove_entity(FakeEnt);
     }


Client's cs 1.6 stucks with this code :shock:

EDIT: I used your type Connor, same, client's cs freezes.
Omg why?

Arkshine 01-25-2010 15:21

Re: ExecuteHamB, inflictor.
 
Probably because you have an infine loop. Dmg_Kill_Player is called from TakeDamage?

Owyn 01-25-2010 15:24

Re: ExecuteHamB, inflictor.
 
just edit death_msg if you want custom kill message ( not icon )

xbatista 01-25-2010 15:52

Re: ExecuteHamB, inflictor.
 
No Arkshine.
Owyn I don't need it ^^

Btw this Dmg_Kill_Player registered as native ,3-rd parameter is 1 ^_^
I will remove it as native tommorow and try without it, now I go sleep.
And yes 'xbatista killed PODBOT[100] with t.mdl' ... I tested now with non-steam, btw I have that model precached, what the hell happens...
With non-steam no crash, with steam crashes the client's cs

ConnorMcLeod 01-25-2010 16:38

Re: ExecuteHamB, inflictor.
 
Quote:

Originally Posted by xbatista (Post 1067334)
No Arkshine.
Owyn I don't need it ^^

Btw this Dmg_Kill_Player registered as native ,3-rd parameter is 1 ^_^
I will remove it as native tommorow and try without it, now I go sleep.
And yes 'xbatista killed PODBOT[100] with t.mdl' ... I tested now with non-steam, btw I have that model precached, what the hell happens...
With non-steam no crash, with steam crashes the client's cs

You would have better no talk about nosteam, even if you are using it for testing purpose.
What happens if you don't remove the custom ent ? (you may create 1 at map start, and alter its classname when you need to use it)
Also, try to set pev_owner to attacker, it may help for the death msg.

And like arkshine said, to be sure, try also with ExecuteHam and not ExecuteHamB

01101101 01-25-2010 19:29

Re: ExecuteHamB, inflictor.
 
@xbatista

You better edit that before yami captures your crab.

xbatista 01-25-2010 20:04

Re: ExecuteHamB, inflictor.
 
Ok Connor will try.
About non-steam is for testing purpose.


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

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