Raised This Month: $51 Target: $400
 12% 

Block Player Spawn on NewRound


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 12-18-2015 , 12:59   Block Player Spawn on NewRound
Reply With Quote #1

Just a question.
Can i block player spawn on new round?
It tried to return HAM_SUPERCEDE on spawn event but no way.
https://forums.alliedmods.net/showpo...16&postcount=6

I can do it with client_silentkill or to transfer to spectate fast and then back but it's weird.

So is there any way?
siriusmd99 is offline
Andu.
Member
Join Date: Oct 2013
Location: Belgravistan
Old 12-18-2015 , 16:25   Re: Block Player Spawn on NewRound
Reply With Quote #2

Quote:
set_pev(client, pev_health, 0.0);
set_pev(client, pev_deadflag, DEAD_DEAD);
?
Andu. is offline
Old 12-19-2015, 10:46
Chihuahuax
This message has been deleted by Chihuahuax. Reason: sorry
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 12-21-2015 , 00:57   Re: Block Player Spawn on NewRound
Reply With Quote #3

Tried, doesnt work Exolent's code.
siriusmd99 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-21-2015 , 08:20   Re: Block Player Spawn on NewRound
Reply With Quote #4

You should hook CHalfLifeMultiplay::FPlayerCanRespawn and make it always return false(OrpheuSetReturn). It's a virtual function, so you can hook it from g_pGameRules object, with orpheu.
https://github.com/Arkshine/CSSDK/bl...ules.cpp#L2599

Here's how the function works:
Spoiler


I was going to say it's enough to set m_iNumSpawns to 1 in HLTV to block players from spawning, but HLTV is fired right before the offset is set to 0 by the game, it will overwrite your value and it won't work.
__________________

Last edited by HamletEagle; 12-21-2015 at 08:23.
HamletEagle is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 12-21-2015 , 09:07   Re: Block Player Spawn on NewRound
Reply With Quote #5

I need to block respawn only to a specified player. Like
if(is_blocked[id]) return;
I don't need to block spawn on connect in first 20 seconds. I want to block respawn every round on specified player and make it stand dead as long as i want.


Its like a player which is downloading resources and it shows him dead because he's not connected.
Maybe i can set is connecting flags to trick amxx or set him spectate for a while?
siriusmd99 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-21-2015 , 09:42   Re: Block Player Spawn on NewRound
Reply With Quote #6

This is the solution I gave you, hook CHalfLifeMultiplay::FPlayerCanRespawn, do your checks and alter the return value. The "How it works" part is only what the game is doing.
__________________

Last edited by HamletEagle; 12-21-2015 at 09:43.
HamletEagle is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 12-21-2015 , 10:09   Re: Block Player Spawn on NewRound
Reply With Quote #7

Quote:
Originally Posted by HamletEagle View Post
This is the solution I gave you, hook CHalfLifeMultiplay::FPlayerCanRespawn, do your checks and alter the return value. The "How it works" part is only what the game is doing.
I know basic things in amxx but i don't know how to do this . It's like something c++ and pawn.
Can you help me?

EDIT : Why to use Orpheu if i can use ham ? https://forums.alliedmods.net/showthread.php?t=191815

Last edited by siriusmd99; 12-21-2015 at 10:10.
siriusmd99 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-21-2015 , 11:00   Re: Block Player Spawn on NewRound
Reply With Quote #8

That's something else, it forces the game to spawn the player on first connect, even if not all the conditions I explained above are not met. You want to block players from spawning, or at least this is what I understand from your posts.

Also, orpheu is not c++, you just hook a function(like you do with ham) and add some code. The difference is that ham comes with some predefined functions, while with orpheu you can hook any function.

Yeah, I can help you to use orpheu.
__________________

Last edited by HamletEagle; 12-21-2015 at 11:05.
HamletEagle is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 12-21-2015 , 14:53   Re: Block Player Spawn on NewRound
Reply With Quote #9

Quote:
Originally Posted by HamletEagle View Post
That's something else, it forces the game to spawn the player on first connect, even if not all the conditions I explained above are not met. You want to block players from spawning, or at least this is what I understand from your posts.

Also, orpheu is not c++, you just hook a function(like you do with ham) and add some code. The difference is that ham comes with some predefined functions, while with orpheu you can hook any function.

Yeah, I can help you to use orpheu.
I said , i don't know how to do this.
Can you show me the code needed?
siriusmd99 is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 12-22-2015 , 10:11   Re: Block Player Spawn on NewRound
Reply With Quote #10

Solved. Here's the solution
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fun>

#define PLUGIN "Stay Dead"
#define VERSION "1.0"
#define AUTHOR "RFP"

public plugin_init(){
        
register_plugin(PLUGIN,VERSION,AUTHOR)
     
    
register_event("ResetHUD","block_spawn","be","1=1")
    
        
}

public 
block_spawn(id)
{

    
set_pev(idpev_health0.0);
    
set_pev(idpev_deadflagDEAD_DEAD);
    
set_msg_block(g_msgid_ClCorpseBLOCK_ONCE)

    
//client_print(id, print_chat, "[AMXX] You are not allowed to respawn!")



Here "HAM" is not needed because i tested newround , resethud and ham spawn , in which order they go and here's the order:

1.NewRound
2.ResetHUD
3.HamSpawn


I think ham_spawn didn't work because it's called after the player's spawn. And here we go. Resethud works nice.

Note: Here's also a small bug. After dead flags are set the player doesnt respawn (he's remains dead spectator in his team) but a floating model is respawned. I want to fix that. I'll find and come with an edit but if someone knows how to delete that floating model i'll accept ur help.

EDIT: FOUND how to remove that flying model . Code UPDATED!

Last edited by siriusmd99; 12-22-2015 at 12:30.
siriusmd99 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 12:01.


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