Raised This Month: $ Target: $400
 0% 

ExecuteHamB on Ham_Killed player post won't reset deadflag.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
luxor
Member
Join Date: Jan 2014
Old 01-04-2016 , 06:38   ExecuteHamB on Ham_Killed player post won't reset deadflag.
Reply With Quote #1

Code:
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>

public plugin_init()
{
	register_plugin
	(
		.plugin_name = "Test respawn",
		.version     = "1.0",
		.author      = "meow"
	);

	RegisterHam(Ham_Killed, "player", "playerKilled", 1);
}

public playerKilled(VictimIndex, AttackerIndex, ShouldGib)
{
	ExecuteHamB(Ham_CS_RoundRespawn, VictimIndex);
	set_pev(Index, pev_deadflag, DEAD_NO); // won't help
        set_task(1.0, "recalibrate", VictimIndex); // even that too
}

public recalibrate(Index)
{
	set_pev(Index, pev_deadflag, DEAD_NO);
}
Simple explanation : If someone die he will respawn but in scoreboard he will have deadflag on, and i could not reset it.

example :
Spoiler
luxor is offline
PartialCloning
Senior Member
Join Date: Dec 2015
Old 01-04-2016 , 07:25   Re: ExecuteHamB on Ham_Killed player post won't reset deadflag.
Reply With Quote #2

I don't think it's a bug, it's likely just the order of operations. Why don't you use a 0.1 task to respawn the player rather than doing it during the hamkilled call? That should do the trick. Otherwise you'll need to resend a scoreattrib message.
PartialCloning is offline
Old 01-04-2016, 07:35
HamletEagle
This message has been deleted by HamletEagle.
wickedd
Veteran Member
Join Date: Nov 2009
Old 01-04-2016 , 08:10   Re: ExecuteHamB on Ham_Killed player post won't reset deadflag.
Reply With Quote #3

PHP Code:
#include < amxmodx >
#include < hamsandwich >

public plugin_init()
{
    
    
RegisterHamHam_Killed"player""playerKilled");
}    

public 
playerKilledVictimIndexAttackerIndexShouldGib )
{
  
    
    if( 
is_user_connectedVictimIndex ) )
    {
        
set_task0.9"revive_you"VictimIndex )
    }
}

public 
revive_youid )
{
    
ExecuteHamHam_CS_RoundRespawnid )

This works for me
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-04-2016 , 08:13   Re: ExecuteHamB on Ham_Killed player post won't reset deadflag.
Reply With Quote #4

Or you can send in Killed() post a new score attrib message. This also works.
__________________
HamletEagle is offline
luxor
Member
Join Date: Jan 2014
Old 01-04-2016 , 08:26   Re: ExecuteHamB on Ham_Killed player post won't reset deadflag.
Reply With Quote #5

i don't want to delay the spawn, anyway i solved with attrib message
but still, i think this should not happen, i'm waiting for someone who can strongly analysis the situation
luxor is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 01-04-2016 , 08:45   Re: ExecuteHamB on Ham_Killed player post won't reset deadflag.
Reply With Quote #6

Setting pev_ values don't imply it's sent to client instantly.

Also dead status on scoreboard needs to be updated with a msg. If I remember correctly it's ScoreAttrib
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 01-04-2016 , 08:51   Re: ExecuteHamB on Ham_Killed player post won't reset deadflag.
Reply With Quote #7

Quote:
Originally Posted by luxor View Post
i don't want to delay the spawn, anyway i solved with attrib message
but still, i think this should not happen, i'm waiting for someone who can strongly analysis the situation
It's most likely that the ScoreAttrib message is not sent in the same frame that player gets killed, and you are spawning the player again in the same frame. I don't see why you can't delay the spawn even 0.1 seconds, it's hardly noticeable.
klippy is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 01-04-2016 , 15:28   Re: ExecuteHamB on Ham_Killed player post won't reset deadflag.
Reply With Quote #8

Quote:
Originally Posted by luxor View Post
i don't want to delay the spawn, anyway i solved with attrib message
but still, i think this should not happen, i'm waiting for someone who can strongly analysis the situation
It respawn instantly and after respawn it sets the dead flag.

I had a quick look in CSSDK and this is what i can tell so far:
- When you die you get the flag dying
- Later, it sets the flag dead on death think
- It will only change flag to dead, if current flag is dying.

So, the solution is quite simple, just do this:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

public plugin_init() {
    
register_plugin("Respawn""0.0.1""Author")
    
RegisterHam(Ham_Killed"player""Player__Killed_Post"1)
}

public 
Player__Killed_Post(iVictimiKillercrap)
{
    if(
is_user_connected(iVictim))
        
__RespawnPlayer(iVictim)
}

__RespawnPlayer(id)
{
    
set_pev(idpev_deadflagDEAD_RESPAWNABLE)
    
ExecuteHamB(Ham_CS_RoundRespawnid)

Not tested, but should work.

Last edited by Jhob94; 01-04-2016 at 16:50.
Jhob94 is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 01-04-2016 , 16:21   Re: ExecuteHamB on Ham_Killed player post won't reset deadflag.
Reply With Quote #9

@Jhob94

PHP Code:
set_pev(idpev_deadflagDEAD_RESPAWNABLE
I don't know where got your info from, but that is not needed when using Ham to respawn players.

It's need when you're spawning players using fakemeta

PHP Code:
set_pev(idpev_deadflagDEAD_RESPAWNABLE)    
dllfunc(DLLFunc_Thinkid
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 01-04-2016 , 17:01   Re: ExecuteHamB on Ham_Killed player post won't reset deadflag.
Reply With Quote #10

Well, if hamsandwich already does that, than idk why it sets dead flag.

What i understood from cssdk was:
- Prethink it check deadflag, if >= DEAD_DYING, calls deaththink
- On deaththink it will change the deadflag to dead

What i noticed now, it only sends the message on killed, no matter when it changes deadflag.

So, i guess the best thing to do is:
- ExecuteHamB(Ham_CS_RoundRespawn, id)
- set_pev(id, pev_deadflag, DEAD_NO)
- Send new message
Jhob94 is offline
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 22:58.


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