Raised This Month: $ Target: $400
 0% 

drop dead body


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-20-2010 , 22:27   Re: drop dead body
Reply With Quote #1

DeathMsg is a global event, not per player.

http://wiki.amxmodx.org/Half-Life_1_...vents#DeathMsg

----------------------------

You never set the entity to think.

----------------------------

Why are you using more global variables for the entity instead of the examples I gave you with those functions?

----------------------------

That global variable is redundant.
If one is true, it is expected that the other is false.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 05-20-2010 , 22:45   Re: drop dead body
Reply With Quote #2

i've been thinking but i don't know how to check if he has been up 100 units and down -100 units without using the bools. Could you give an example how to do that?

And can i even check a model and origin on victim in DeathMsg?
Or should i use Ham_Killed in pre?

I changed my code a bit:
now it spawns the model, but he won't go up. I still have the bools because idk how to do it otherwise.
And the original body still spawns to.
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <cstrike>
#include <hamsandwich>

#define SetFirstThink(%1,%2) entity_set_int( %1, EV_INT_iuser1, %2 ) 
#define CheckFirstThink(%1) entity_get_int( %1, EV_INT_iuser1 ) 

#define SetStopThink(%1,%2) entity_set_int( %1, EV_INT_iuser2, %2 ) 
#define CheckStopThink(%1) entity_get_int( %1, EV_INT_iuser2 ) 

#define SetHeight(%1,%2) entity_set_float( %1, EV_FL_fuser1, %2 ) 
#define GetHeight(%1) entity_get_float( %1, EV_FL_fuser1 ) 

#define IsPlayer(%1)    (1<=%1<=g_maxplayers)

// new Float: height[33]

new boolcorpse_up
new boolcorpse_down

// new g_maxplayers

public plugin_init()
{    
    
register_plugin("Mario Bros Death""1.0""Drekes")

    
register_event("ClCorpse""Event_ClCorpse""b")
    
RegisterHam(Ham_Killed"player""Event_Ham_Killed_Pre"0)

    
register_think("dead","Fw_Think")
    
    
// g_maxplayers = get_maxplayers()
}

public 
plugin_precache()
{
/*
    precache_model("models/player/arctic/arctic.mdl")
    precache_model("models/player/terror/terror.mdl")
    precache_model("models/player/leet/leet.mdl")
    precache_model("models/player/guerilla/guerilla.mdl")
    precache_model("models/player/urban/urban.mdl")
    precache_model("models/player/gign/gign.mdl")
    precache_model("models/player/gsg9/gsg9.mdl")
    precache_model("models/player/sas/sas.mdl")*/
    
precache_model("models/player/mario/mario.mdl")
}

public 
Event_ClCorpse(id)
    return 
PLUGIN_HANDLED
    
public Event_Ham_Killed_Pre(victimattacker)
{
/*
    if(IsPlayer(victim))
        return*/

    // Get info from real corpse
    
new model[12]
    
cs_get_user_model(victimmodel11)

    new 
Floatorigin[3]
    
pev(victimpev_originorigin)

    
make_new_corpse(victimmodelFloatorigin)
}

public 
make_new_corpse(idmodel[12], Floatorigin[3])
{
    
// Start making new corpse
    
new corpse engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"));

    
set_pev(corpsepev_classname"dead")

    
engfunc(EngFunc_SetModelcorpse"models/player/mario/mario.mdl")
    
set_pev(corpsepev_solid2)
    
set_pev(corpsepev_originorigin)

    
set_pev(corpsepev_animtime2.0)
    
set_pev(corpsepev_framerate1.0)
    
set_pev(corpsepev_sequence54)

    
corpse_up true
}

public 
Fw_Think(corpse)
{
    if(!
is_valid_ent(corpse))
        
SetStopThink(corpse1)
        
    if(
CheckStopThink(corpse))
        return

    if(
CheckFirstThink(corpse))
        
SetFirstThink(corpse0)

    new 
FloatflHeight GetHeight(corpse)

    if(
corpse_up)
    {
        if(
GetHeight(corpse) >= 100.0)
        {
            
corpse_up false
            corpse_down 
true
        
}
        
flHeight += 0.5
    
}

    if(
corpse_down)
    {
        if(
GetHeight(corpse) <= -100.0)
        {
            
corpse_down false
        
}
        
flHeight -= 0.5
    
}

    
SetHeight(corpseflHeight)
    
    if(!
corpse_up && !corpse_down)
    {
        
SetStopThink(corpse1)
        
remove_task(corpse)
        
remove_entity(corpse)
    }

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.

Last edited by drekes; 05-20-2010 at 23:18.
drekes is offline
Send a message via MSN to drekes
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-21-2010 , 00:14   Re: drop dead body
Reply With Quote #3

Code:
#include < amxmodx > #include < engine > new const g_szCorpseClassName[ ] = "fake_corpse"; public plugin_init( ) {     register_event( "DeathMsg", "EventDeathMsg", "a", "1>0" );         register_think( g_szCorpseClassName, "FwdCorpseThink" );         set_msg_block( get_user_msgid( "ClCorpse" ), BLOCK_SET ); } public EventDeathMsg( ) {     new iEntity = create_entity( "info_target" );         if( !is_valid_ent( iEntity ) )     {         return;     }         new iVictim = read_data( 2 );         new szModel[ 64 ];     entity_get_string( iVictim, EV_SZ_model, szModel, charsmax( szModel ) );         new Float:vecOrigin[ 3 ];     entity_get_vector( iVictim, EV_VEC_origin, vecOrigin );         new Float:vecVelocity[ 3 ];     //vecVelocity[ 2 ] = floatsqroot( 2.0 * get_cvar_float( "sv_gravity" ) * entity_get_float( iVictim, EV_FL_gravity ) * 100.0 );     vecVelocity[ 2 ] = 400.0; // the result if sv_gravity=800, gravity=1.0         entity_set_string( iEntity, EV_SZ_classname, g_szCorpseClassName );     entity_set_int( iEntity, EV_INT_solid, SOLID_TRIGGER );     entity_set_model( iEntity, szModel );     entity_set_size( iEntity, Float:{ -16.0, -16.0, -8.0 }, Float:{ 16.0, 16.0, 8.0 } );     entity_set_origin( iEntity, vecOrigin );     entity_set_vector( iEntity, EV_VEC_velocity, vecVelocity );     entity_set_int( iEntity, EV_INT_movetype, MOVETYPE_TOSS );     entity_set_float( iEntity, EV_FL_animtime, 2.0 );     entity_set_float( iEntity, EV_FL_framerate, 1.0 );     entity_set_int( iEntity, EV_INT_sequence, 54 );     entity_set_float( iEntity, EV_FL_nextthink, get_gametime( ) + 0.1 ); } public FwdCorpseThink( iEntity ) {     if( !is_valid_ent( iEntity ) )     {         return;     }         if( entity_get_int( iEntity, EV_INT_flags ) & FL_ONGROUND )     {         remove_entity( iEntity );     }     else     {         entity_set_float( iEntity, EV_FL_nextthink, get_gametime( ) + 0.01 );     } }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 05-21-2010 at 00:17.
Exolent[jNr] is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 05-21-2010 , 09:21   Re: drop dead body
Reply With Quote #4

Thanks exolent, works perfect except the original corpse is still there. I'll search around for that. Thanks

Edit: I moved his original origin -100 so the body won't show.

Is there a way to make the dead player's camera follow the flying body to?
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.

Last edited by drekes; 05-21-2010 at 11:10.
drekes is offline
Send a message via MSN to drekes
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-21-2010 , 20:09   Re: drop dead body
Reply With Quote #5

Quote:
Originally Posted by drekes View Post
Is there a way to make the dead player's camera follow the flying body to?
I'm not sure.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 05-21-2010 , 20:57   Re: drop dead body
Reply With Quote #6

maybe i could use the original body to do this stuff?
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 05-22-2010 , 07:37   Re: drop dead body
Reply With Quote #7

after killing, clcorpse was called after 5 seconds
__________________
Join US - custom Zombie Server - Custom Addons:



Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 05-22-2010 , 07:41   Re: drop dead body
Reply With Quote #8

Quote:
Originally Posted by Sn!ff3r View Post
after killing, clcorpse was called after 5 seconds
I don't understand what you mean
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 05-22-2010 , 16:37   Re: drop dead body
Reply With Quote #9

i think i found a better way to get rid of the original body, instead of setting it origin -100 units lower, i use ham_killed in pre and set_user_rendering to make him invisible
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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