Jump to content
MrSisterFister

Cleanup of dead players bodys

Recommended Posts

Hi Guys

Sorry if this is in the wrong section, but does anyone know what i need to change to make a dead body and its loot despawn very fast like 30 seconds from them dying?

Again sorry if this cannot be answered here.

Share this post


Link to post
Share on other sites

pls consider that u are member of a forum where u can give/get help to/from others and to give your solution free to all others finding this thread in the future.

thnx

Share this post


Link to post
Share on other sites
Guest
15 hours ago, MrSisterFister said:

Never mind i found it!

Mmm... Could you at least show us how to change this? :)

Share this post


Link to post
Share on other sites

This is you MrSisterFister...

https://xkcd.com/979/

If you ask for help and then figure something out, maybe I don't know, uh, share that knowledge? 

if you won't, then don't bother asking for help.

Gave you the benefit of the doubt, you could've gone to sleep, who knows. But it's now been over 24 hours and you have not shared any information.

 

For those that still want to know, you would have to have to override the 'OnClientRespawnEvent' function in missionServer.c and just use 'GetGame().ObjectDelete( player )' where player is one of the parameters of the overridden function.

Edited by Jacob_Mango
  • Thanks 1
  • Beans 1

Share this post


Link to post
Share on other sites
12 hours ago, Jacob_Mango said:

For those that still want to know, you would have to have to override the 'OnClientRespawnEvent' function in missionServer.c and just use 'GetGame().ObjectDelete( player )' where player is one of the parameters of the overridden function.

Where is missionServer.c located?

Share this post


Link to post
Share on other sites

Check this video to get a proper mod installation.

 

Then you can unpbo the files in dta/scripts and get some examples over there, like missionServer.c and a bunch of other files.

Share this post


Link to post
Share on other sites

Found the file- so what's the proper way to modify this function to change the time before despawn?

 

    void OnClientRespawnEvent(PlayerIdentity identity, PlayerBase player)
    {
        if(player)
        {
            if (player.IsUnconscious() || player.IsRestrained())
            {
                player.SetHealth("", "", 0.0);
            }
        }
    }

Edited by GhostIeader

Share this post


Link to post
Share on other sites
On 27/09/2018 at 7:06 AM, Jacob_Mango said:

This is you MrSisterFister...

https://xkcd.com/979/

If you ask for help and then figure something out, maybe I don't know, uh, share that knowledge? 

if you won't, then don't bother asking for help.

Gave you the benefit of the doubt, you could've gone to sleep, who knows. But it's now been over 24 hours and you have not shared any information.

 

For those that still want to know, you would have to have to override the 'OnClientRespawnEvent' function in missionServer.c and just use 'GetGame().ObjectDelete( player )' where player is one of the parameters of the overridden function.

Thank you Jacob for pointing that out, but it doesn't work. Are you sure PlayerBase class represent the player "world object" ? Tried by both overriding the method in init.c and directly with unpacked scripts in missionServer.c.

TrylGUu.png

Share this post


Link to post
Share on other sites

yes it works in playerbase, but to be sure the body will be deleted (imagine he doesnt respawn and rage quit) i've done this cleanup into the `EEKilled` method

Edited by Sentepu

Share this post


Link to post
Share on other sites
On 28/09/2018 at 1:12 PM, GrosTon1 said:

Thank you Jacob for pointing that out, but it doesn't work. Are you sure PlayerBase class represent the player "world object" ? Tried by both overriding the method in init.c and directly with unpacked scripts in missionServer.c.

TrylGUu.png

 

You can override on Inic.c, but you need to call this way:

override void OnClientRespawnEvent(PlayerIdentity identity, PlayerBase player)
	{
		// note: player is now killed in db right after the actual kill happens 
		/*if (GetHive() && player)
		{
			GetHive().CharacterKill(player);
		}*/
		if(player)
		{
			if (player.IsUnconscious() || player.IsRestrained())
			{
				// kill character
				player.SetHealth("", "", 0.0);
			}
		}
		
		// DELETE THE CORPSE AFTER RESPAWN
		GetGame().ObjectDelete(player);
		
	}

 

Share this post


Link to post
Share on other sites

@SilvioDoHOTS how to make sure that what was in the hands is also lost?

override void OnClientRespawnEvent(PlayerIdentity identity, PlayerBase player)
	{
		// note: player is now killed in db right after the actual kill happens 
		/*if (GetHive() && player)
		{
			GetHive().CharacterKill(player);
		}*/
		if(player)
		{
			if (player.IsUnconscious() || player.IsRestrained())
			{
				// kill character
				player.SetHealth("", "", 0.0);
			}
		}
		
		// DELETE THE CORPSE AFTER RESPAWN
		GetGame().ObjectDelete(player);
		
	}

 

Share this post


Link to post
Share on other sites

Sorry never got any notifications of reply's, and i was busy creating my own server, i didn't even come back to look at post, them went on holiday! Also i have a real life... if you wanna know anything "Kill feeds", "Active Player Counts", "Kill Streaks",  "Dead Body Cleanup" etc PM me, or add me on steam (same username and icon) or Discord..

I also created a random death messages and suicides so its not just the same one all the time and added a kill streak to the end.

I created the Battle for Cherno PVP server and you will see most of the scripts in action there.

Don't want to hide info so just PM me if you need anything and ill make sure i look at this website once a day!

Edited by MrSisterFister
Shitty spelling and better read

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×