Raised This Month: $ Target: $400
 0% 

Solved Spawn a player during respawn timer (DOD)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cmndrfello
Junior Member
Join Date: Jan 2022
Old 01-02-2022 , 12:06   Spawn a player during respawn timer (DOD)
Reply With Quote #1

Hello, I've recently been trying to create a zombie plague style plugin for Day of Defeat.
I'm trying to make it so when an Allied player dies he will instantly be switched to Axis and respawn and moved to his last position.
But for some reason when I try to respawn the player after death it is unable to do it.

Even after creating a task with 'set_task' to try and respawn the player after the death animation it just won't work.

Is there a potential fix for this? Or would I have to settle for a timed respawn

Code:
public plugin_init()
{
RegisterHam(Ham_Killed, "player", "Ham_OnKilled_Post");
}

public Ham_OnKilled_Post(id, killer)
{
	new Float:value; 
	new string[MAX_STRING];
	
	//pev_deadflag of 'id' is 0 (DEAD_NO)

	if( get_user_team(id) == TEAM_HUMANS ) {
		new deathpos[3];

		get_user_origin(id, deathpos);
		dod_set_user_team(id, 2, 0);
                
                set_pev(id, pev_deadflag, DEAD_RESPAWNABLE);
                //pev_deadflag of 'id' is 3 (DEAD_RESPAWNABLE)
                DispatchSpawn(id);

		set_user_origin(id, deathpos);
	}
}

Last edited by cmndrfello; 01-04-2022 at 14:33.
cmndrfello is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 01-02-2022 , 13:22   Re: Spawn a player during respawn timer (DOD)
Reply With Quote #2

Code:
public Ham_OnKilled_Post(id, killer)
{
	new Float:value; 
	new string[MAX_STRING];
	
	//pev_deadflag of 'id' is 0 (DEAD_NO)

	if( get_user_team(id) == TEAM_HUMANS ) {
		new deathpos[3];

		get_user_origin(id, deathpos);
		dod_set_user_team(id, 2, 0);
				
		//set_pev(id, pev_deadflag, DEAD_RESPAWNABLE);
		//pev_deadflag of 'id' is 3 (DEAD_RESPAWNABLE)
		//DispatchSpawn(id);
		
		ExecuteHamB(Ham_RoundRespawn, id)

		set_user_origin(id, deathpos);
	}
}
__________________









Last edited by CrazY.; 01-02-2022 at 13:23.
CrazY. is offline
cmndrfello
Junior Member
Join Date: Jan 2022
Old 01-02-2022 , 13:36   Re: Spawn a player during respawn timer (DOD)
Reply With Quote #3

Quote:
Originally Posted by CrazY. View Post
Code:
ExecuteHamB(Ham_RoundRespawn, id)
I assume you meant "Ham_DOD_RoundRespawn" and have tried that but it did not work... The team is switched but the player does not get respawned by the command only after the respawn timer ends like normally

Is there a flag a different flag that is blocking the spawn? because i haven't found anything related to this problem in Day of Defeat so i am stuck by not knowing why is the respawn restricted
cmndrfello is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-02-2022 , 13:36   Re: Spawn a player during respawn timer (DOD)
Reply With Quote #4

Your forward is not in "post". RegisterHam's "post" argument defaults to 0 which means you're in "pre" because you did not specify the argument.

=>

Code:
RegisterHam(Ham_Killed, "player", "Ham_OnKilled_Post", 1);
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
cmndrfello
Junior Member
Join Date: Jan 2022
Old 01-02-2022 , 13:48   Re: Spawn a player during respawn timer (DOD)
Reply With Quote #5

Quote:
Originally Posted by OciXCrom View Post
Your forward is not in "post". RegisterHam's "post" argument defaults to 0 which means you're in "pre" because you did not specify the argument.
You are right! I have tried it now, but for some reason the player won't respawn, it only skips the death "cutscene"/animation and still waits for the respawn timer to end...

I tried with set_task but still it wont respawn the player...
Code:
public Ham_OnKilled_Post(id, killer)
{
	new Float:value; 
	new string[MAX_STRING];

	if( get_user_team(id) == TEAM_HUMANS ) {
		new deathpos[3];

		get_user_origin(id, deathpos);
		dod_set_user_team(id, TEAM_ZOMBIE, 0);

		ExecuteHamB(Ham_DOD_RoundRespawn, id);
		set_task(0.5, "Revive", id);
		
		set_user_origin(id, deathpos);
	}
}

public Revive(id){
	ExecuteHamB(Ham_DOD_RoundRespawn, id)
}
cmndrfello is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-02-2022 , 16:15   Re: Spawn a player during respawn timer (DOD)
Reply With Quote #6

Try Ham_Spawn and remove the task.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-02-2022 , 19:04   Re: Spawn a player during respawn timer (DOD)
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
Try Ham_Spawn and remove the task.
I just tested this and it doesn't work.

@cmndrfello, there is a plugin by dodsynthetic that implements and instant spawn using Fakemeta on dodplugins.net. I'm not sure if it works anymore though since I've never used it.
__________________
fysiks is offline
cmndrfello
Junior Member
Join Date: Jan 2022
Old 01-04-2022 , 00:07   Re: Spawn a player during respawn timer (DOD)
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
@cmndrfello, there is a plugin by dodsynthetic that implements and instant spawn using Fakemeta on dodplugins.net. I'm not sure if it works anymore though since I've never used it.
It's exactly what I'm looking for but I can't seem to get it downloaded. You need a activated account and though I created one they don't send a activation email and so I'm stuck as I can't request another email

Last edited by cmndrfello; 01-04-2022 at 00:07.
cmndrfello is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-04-2022 , 02:53   Re: Spawn a player during respawn timer (DOD)
Reply With Quote #9

Here ya go
Attached Files
File Type: sma Get Plugin or Get Source (syns_instant_spawn.sma - 67 views - 5.6 KB)
__________________
fysiks is offline
cmndrfello
Junior Member
Join Date: Jan 2022
Old 01-04-2022 , 10:05   Re: Spawn a player during respawn timer (DOD)
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
Here ya go
Thank you! Looks interesting! I will take a look once I get the chance and will update about my findings
cmndrfello is offline
Reply


Thread Tools
Display Modes

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 11:29.


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