AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Block Player Spawn on NewRound (https://forums.alliedmods.net/showthread.php?t=276268)

siriusmd99 12-18-2015 12:59

Block Player Spawn on NewRound
 
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?

Andu. 12-18-2015 16:25

Re: Block Player Spawn on NewRound
 
Quote:

set_pev(client, pev_health, 0.0);
set_pev(client, pev_deadflag, DEAD_DEAD);
?

siriusmd99 12-21-2015 00:57

Re: Block Player Spawn on NewRound
 
Tried, doesnt work Exolent's code.

HamletEagle 12-21-2015 08:20

Re: Block Player Spawn on NewRound
 
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.

siriusmd99 12-21-2015 09:07

Re: Block Player Spawn on NewRound
 
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?

HamletEagle 12-21-2015 09:42

Re: Block Player Spawn on NewRound
 
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.

siriusmd99 12-21-2015 10:09

Re: Block Player Spawn on NewRound
 
Quote:

Originally Posted by HamletEagle (Post 2374788)
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

HamletEagle 12-21-2015 11:00

Re: Block Player Spawn on NewRound
 
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.

siriusmd99 12-21-2015 14:53

Re: Block Player Spawn on NewRound
 
Quote:

Originally Posted by HamletEagle (Post 2374799)
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 12-22-2015 10:11

Re: Block Player Spawn on NewRound
 
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!


All times are GMT -4. The time now is 18:08.

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