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

[CS:S] Disable Spawn Players when joining from Spec


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
EmJay88
Junior Member
Join Date: Sep 2020
Old 01-29-2021 , 03:38   [CS:S] Disable Spawn Players when joining from Spec
Reply With Quote #1

Hello,

I've written a simple plugin that balances teams for size at every round start. Let's say CT have 5 players and T 6. Most of the players know that i've installed this plugin and join spec at the end of the round, when they are CT and at the beginning one player switches from T to CT and after round start they join back to CT. I hope this problem is clear so far.

So i would like to have a plugin which blocks spawning after round start when joining from spec. I tried to block the joinclass command but i don't understand how this works in detail. Maybe someone can help me.

This is what i tried but it doesn't work.

PHP Code:
public OnPluginStart()
{
    
RegConsoleCmd("joinclass"Command_JoinClass);
}

public 
Action:Command_JoinClass(clientargs)
{
    
decl String:teamString[3];
    
GetCmdArg(1teamStringsizeof(teamString));
    new 
team StringToInt(teamString);
    new 
curTeam GetClientTeam(client);
    
    if (
curTeam == && team >= 2)
    {
        return 
Plugin_Handled;
    }

    return 
Plugin_Continue;

EmJay88 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-31-2021 , 17:48   Re: [CS:S] Disable Spawn Players when joining from Spec
Reply With Quote #2

Ok, once I saw your script, blocking player "joinclass" command, it first look okey.
- Problem is, player would stay as dead state in team, because it not have valid player class chosen.
Player need then repeat process...

I also tested, with SDKHook, to block player spawn.
- This work but it also break... player entity hierarchy. Player will turn dead, invisible ghost or something.


In these few days, I have tried practising to look game through IDA Disassembler and from "source" files, to understand how get right signatures or offsets.

I'm 99% sure, I managed to find solution, to block player spawn in Counter-Strike: Source (for now only).
The function which I hooked is
PHP Code:
    bool CCSGameRules::FPlayerCanRespawnCBasePlayer *pBasePlayer 
Thanks to @Drifter321 and @peace-maker, maintaining DHOOKS extension. It's very powerful when you know what to do.
https://forums.alliedmods.net/showth...86#post2588686



Required!
DHOOKS2
https://github.com/peace-maker/DHooks2/releases
Or regular DHOOKS, I have not tested.

What this plugin do:
- When ever player in spectator team (1), switch to team CT or T, can not spawn in current round, even there is mp_freezetime + 20 seconds grace time.
- Plugin will start block when there at least two players in both team (include switching spectator in count as well)

You may experience server crash:
- Maybe offset value is wrong. I have tested only in Windows.
- Future game update can change offset value and again, crash server or stop working.
Attached Files
File Type: zip css_spectator_punish.zip (6.9 KB, 52 views)
__________________
Do not Private Message @me

Last edited by Bacardi; 01-31-2021 at 17:49.
Bacardi is offline
EmJay88
Junior Member
Join Date: Sep 2020
Old 02-03-2021 , 04:49   Re: [CS:S] Disable Spawn Players when joining from Spec
Reply With Quote #3

wow, thanks so much! I thought that this was just a small thing to do but this complete Plugin does exactly what it should! Perfect job!
EmJay88 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 19:08.


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