Raised This Month: $ Target: $400
 0% 

drop dead body


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 05-20-2010 , 15:07   drop dead body
Reply With Quote #1

Is it possible, when a player dies, to make his body go up in the air for about 100 units, and then drop down until it touches the ground, and then remove it?
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-20-2010 , 19:36   Re: drop dead body
Reply With Quote #2

1. Block the ClCorpse messages.
2. Hook when player dies.
3. When player dies, create an entity with the player's model and set it to the death sequence.
4. You can then play with the entity how you want.
__________________
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 , 19:49   Re: drop dead body
Reply With Quote #3

sounds like a lot of new things for me.
but new things == new challenge
and new challenge == lots of fun.

Thanks exolent.
__________________

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-20-2010 , 20:48   Re: drop dead body
Reply With Quote #4

I make this, but it give runtime error 4: index out of bounds.

normally i would check if he is alive and if he is a player to fix this, but this is none of those, and idea how i can fix this. And if this sucks, tell it and i'll do something else instead.

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>

new Floatheight[33]

new 
boolFirstThink[33] = false
new boolStopThink[33] = false

public plugin_init()
{    
    
register_plugin("Mario Bros Death""1.0""Drekes")
    
    
register_event("ClCorpse""Event_ClCorpse""b")
    
register_event("DeathMsg""Event_DeathMsg""b")
    
    
register_forward(FM_Think"Fw_Think")
}

public 
Event_ClCorpse(id)
    return 
PLUGIN_HANDLED
    
public Event_DeathMsg(id)
{
    
// Get info from real corpse
    
new model[12]
    
cs_get_user_model(idmodel11)

    new 
Floatorigin[3]
    
pev(idpev_originorigin)
    
    
make_new_corpse(idmodelFloatorigin)
}

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"fake_corpse")

    
engfunc(EngFunc_SetModelcorpsemodel)
    
set_pev(corpsepev_solid2)
    
set_pev(corpsepev_originorigin)

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

    
FirstThink[corpse] = true
    StopThink
[corpse] = false
}

public 
Fw_Think(corpse)
{
    if(
StopThink[corpse])
        return

    if(
FirstThink[corpse])
    {    
        
height[corpse] = 0.0
        FirstThink
[corpse] = false
    
}

    new 
classname[32]
    new 
FloatDeadOrigin[3]

    
pev(corpsepev_classnameclassname31)
    
pev(corpsepev_originDeadOrigin)


    if (!
equal(classname"fake_corpse"))
        return

    
set_pev(corpsepev_nextthinkget_gametime() + 0.1)
    
dllfunc(DLLFunc_Thinkcorpse)

    
height[corpse] += 0.5

    
if(height[corpse] >= 100.0)
    {
        
drop_corpse(corpse)
        
StopThink[corpse] = true
    
}
}

public 
drop_corpse(corpse)
{
    if(
FirstThink[corpse])
    {    
        
height[corpse] = 0.0
        FirstThink
[corpse] = false
    
}

    new 
classname[32]
    new 
FloatDeadOrigin[3]

    
pev(corpsepev_classnameclassname31)
    
pev(corpsepev_originDeadOrigin)


    if (!
equal(classname"fake_corpse"))
        return

    
height[corpse] -= 0.5

    
if(height[corpse] <= -100.0)
    {
        
drop_corpse(corpse)
    }

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-20-2010 , 20:56   Re: drop dead body
Reply With Quote #5

http://forums.alliedmods.net/showthread.php?t=127156
__________________
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 , 21:07   Re: drop dead body
Reply With Quote #6

i looked at it, but i don't understand it. I have almost no experience with engine.

And i also say this:
Quote:

It would be better to use special entity values, like pev_[i|f|v|e]user[1|2|3|4].
but i don't understand that to. Could you explain your example code a bit?

EDIT: I just saw i made a big mistake in Event_DeathMsg to.
__________________

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

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

For your code:
Code:
#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 )

Example:
Code:
public FwdThink( iEntity ) {     if( CheckStopThink( iEntity ) )     {         return;     }         if( CheckFirstThink( iEntity ) )     {         SetFirstThink( iEntity, 0 );     }         new Float:flHeight = GetHeight( iEntity );         flHeight += 0.5;         SetHeight( iEntity, flHeight ); }
__________________
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 , 21:19   Re: drop dead body
Reply With Quote #8

I don't understand how i should use these.
I think i'll beter stop with this, it's looks to complicated.

EDIT: I think i understand it now, i'm gonna try some stuff and let you know how it goes
__________________

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

Last edited by drekes; 05-20-2010 at 21:27.
drekes is offline
Send a message via MSN to drekes
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 05-20-2010 , 21:27   Re: drop dead body
Reply With Quote #9

Quote:
Originally Posted by drekes View Post
I think i'll beter stop with this, it's looks to complicated.
Follow the leadership of Exolent, thou will prevail.
__________________
Hi.
Kreation is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 05-20-2010 , 22:01   Re: drop dead body
Reply With Quote #10

i now got this code and it crashes my game as soon as i spawn.

i don't know what i did wrong.
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <cstrike>

#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 ) 

// new Float: height[33]

new boolcorpse_up
new boolcorpse_down

public plugin_init()
{    
    
register_plugin("Mario Bros Death""1.0""Drekes")
    
    
register_event("ClCorpse""Event_ClCorpse""b")
    
register_event("DeathMsg""Event_DeathMsg""b")
    
    
register_forward(FM_Think"Fw_Think")
}

public 
Event_ClCorpse(id)
    return 
PLUGIN_HANDLED
    
public Event_DeathMsg(id)
{
    
// Get info from real corpse
    
new model[12]
    
cs_get_user_model(idmodel11)

    new 
Floatorigin[3]
    
pev(idpev_originorigin)
    
    
make_new_corpse(idmodelFloatorigin)
    
}

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"fake_corpse")

    
engfunc(EngFunc_SetModelcorpsemodel)
    
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))
        return 
        
    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)
        
remove_entity(corpse)

__________________

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