Raised This Month: $ Target: $400
 0% 

[REQUEST] Noblock for jail


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Angeelor
Member
Join Date: Jan 2017
Old 07-17-2017 , 19:01   [REQUEST] Noblock for jail
Reply With Quote #1

Hello..
I need a noblock plugin for my jail server, that can be activated by a command only by the CT´s

And that works in css and csgo..

Appreciate your help. Thanks
Angeelor is offline
vortex.
AlliedModders Donor
Join Date: Jan 2017
Location: OnGameFrame()
Old 07-18-2017 , 05:47   Re: [REQUEST] Noblock for jail
Reply With Quote #2

Click.
__________________
vortex. is offline
WatchDogs
Senior Member
Join Date: Oct 2015
Location: Iran
Old 07-18-2017 , 06:26   Re: [REQUEST] Noblock for jail
Reply With Quote #3

Hi, I think he wants a custom plugin.

I wrote a simple plugin with some code from here.

Only CTs can enable or disable their NoBlock by !nb command. (It's disabled for all by default)

Source Code:
PHP Code:
#include <sourcemod>
#include <cstrike>

bool b_NBEnable[MAXPLAYERS 1];

public 
Plugin myinfo 
{
    
name "CTs Only No Block",
    
author "sslice, [W]atch [D]ogs",
    
description "Removes player collisions...useful for servers running jail maps.",
    
version "1.1.0.0",
    
url "https://forums.alliedmods.net/showthread.php?t=299539"
};

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_nb"CMD_SetNoBlock"Set your no block enable or disable");
    
HookEvent("player_spawn"OnPlayerSpawnEventHookMode_Post);
}

public 
void OnClientDisconnect_Post(int client)
{
    if(
b_NBEnable[client]) b_NBEnable[client] = false;
}

public 
Action CMD_SetNoBlock(int clientint args)
{
    if(
GetClientTeam(client) != CS_TEAM_CT)
    {
        
ReplyToCommand(client"[NoBlock] This command is only for CT players.");
        return 
Plugin_Handled;
    }
    
    if(
b_NBEnable[client])
    {
        
b_NBEnable[client] = false;
        
SetClientNB(clientfalse);
        
ReplyToCommand(client"[NoBlock] No block has been disabled for you!");
    }
    else
    {
        
b_NBEnable[client] = true;
        
SetClientNB(clienttrue);
        
ReplyToCommand(client"[NoBlock] No block has been enabled for you!");
    }
    return 
Plugin_Handled;
}

public 
Action OnPlayerSpawn(Handle event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
    if(
b_NBEnable[client])
    {
        
SetClientNB(clienttrue);
    }
    else
    {
        
SetClientNB(clientfalse);
    }
}

stock void SetClientNB(int clientbool enable)
{
    if(!
IsPlayerAlive(client))
        return;
        
    if(
enable)
    {
        
SetEntProp(clientProp_Data"m_CollisionGroup"2);
    }
    else
    {
        
SetEntProp(clientProp_Data"m_CollisionGroup"5);
    }
    

Attached Files
File Type: sp Get Plugin or Get Source (NoBlock_CTsOnly.sp - 265 views - 1.7 KB)

Last edited by WatchDogs; 07-18-2017 at 06:27.
WatchDogs is offline
Angeelor
Member
Join Date: Jan 2017
Old 07-21-2017 , 02:10   Re: [REQUEST] Noblock for jail
Reply With Quote #4

Quote:
Originally Posted by WatchDogs View Post
Hi, I think he wants a custom plugin.

I wrote a simple plugin with some code from here.

Only CTs can enable or disable their NoBlock by !nb command. (It's disabled for all by default)

Source Code:
PHP Code:
#include <sourcemod>
#include <cstrike>

bool b_NBEnable[MAXPLAYERS 1];

public 
Plugin myinfo 
{
    
name "CTs Only No Block",
    
author "sslice, [W]atch [D]ogs",
    
description "Removes player collisions...useful for servers running jail maps.",
    
version "1.1.0.0",
    
url "https://forums.alliedmods.net/showthread.php?t=299539"
};

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_nb"CMD_SetNoBlock"Set your no block enable or disable");
    
HookEvent("player_spawn"OnPlayerSpawnEventHookMode_Post);
}

public 
void OnClientDisconnect_Post(int client)
{
    if(
b_NBEnable[client]) b_NBEnable[client] = false;
}

public 
Action CMD_SetNoBlock(int clientint args)
{
    if(
GetClientTeam(client) != CS_TEAM_CT)
    {
        
ReplyToCommand(client"[NoBlock] This command is only for CT players.");
        return 
Plugin_Handled;
    }
    
    if(
b_NBEnable[client])
    {
        
b_NBEnable[client] = false;
        
SetClientNB(clientfalse);
        
ReplyToCommand(client"[NoBlock] No block has been disabled for you!");
    }
    else
    {
        
b_NBEnable[client] = true;
        
SetClientNB(clienttrue);
        
ReplyToCommand(client"[NoBlock] No block has been enabled for you!");
    }
    return 
Plugin_Handled;
}

public 
Action OnPlayerSpawn(Handle event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
    if(
b_NBEnable[client])
    {
        
SetClientNB(clienttrue);
    }
    else
    {
        
SetClientNB(clientfalse);
    }
}

stock void SetClientNB(int clientbool enable)
{
    if(!
IsPlayerAlive(client))
        return;
        
    if(
enable)
    {
        
SetEntProp(clientProp_Data"m_CollisionGroup"2);
    }
    else
    {
        
SetEntProp(clientProp_Data"m_CollisionGroup"5);
    }
    

It doesn't work in css.. I think I did not explain myself well. The CT should be able to enable or disable the noblock for everyone, not just for him.


This plugins works fine noblock without the cvar´s like time.. But I wish it can be enabled by ct´s
Angeelor is offline
WatchDogs
Senior Member
Join Date: Oct 2015
Location: Iran
Old 07-21-2017 , 03:46   Re: [REQUEST] Noblock for jail
Reply With Quote #5

So as you said everyone can do this !

They may destroy the server with calling enable/disable noblock command !

Maybe a random ct on every round can do this will be better.
WatchDogs is offline
Heavy Break SUMO
Junior Member
Join Date: Sep 2020
Location: Latinoamerica
Old 09-03-2020 , 02:10   Re: [REQUEST] Noblock for jail
Reply With Quote #6

Three years later but here it is!: https://forums.alliedmods.net/showth...69#post2716469 . I hope you enjoy it if you still have a Jailbreak server haha
__________________
Heavy Break SUMO 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 03:07.


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