Raised This Month: $ Target: $400
 0% 

disarm all players at the end of the round


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Oza96
New Member
Join Date: Apr 2023
Old 04-25-2023 , 15:29   disarm all players at the end of the round
Reply With Quote #1

I'm looking for a very simple plugin: disarm all players at the end of each round, and with the possibility of activating it or not like for example sm_noblock 0/1

Could you please create it?

I'm sorry if this one already exists, I searched a lot without finding anything...

This is for a multigaming csgo server btw
Oza96 is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 04-26-2023 , 07:28   Re: disarm all players at the end of the round
Reply With Quote #2

PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sdktools_entinput>
#include <sdktools_functions>

bool bEnable;

public 
void OnPluginStart()
{
    
ConVar cvar CreateConVar("sm_round_end_disarm""1""Disarm all alive players at the end of the round"_true_true1.0);
    
cvar.AddChangeHook(CVarChange);
    
bEnable cvar.BoolValue;

    
HookEvent("round_end"Event_EndEventHookMode_PostNoCopy);
}

public 
void CVarChange(ConVar cvar, const char[] oldValue, const char[] newValue)
{
    
bEnable cvar.BoolValue;
}

public 
void Event_End(Event event, const char[] namebool dontBroadcast)
{
    if(!
bEnable)
        return;

    for(
int i 1j<= MaxClientsi++) if(IsClientInGame(i) && GetClientTeam(i) > && IsPlayerAlive(i))
        for(
06j++) while(RemoveWeaponBySlot(ij)) {}
}

stock bool RemoveWeaponBySlot(int clientint slot)
{
    static 
int entity;
    if((
entity GetPlayerWeaponSlot(clientslot)) <= MaxClients)
    {
        
RemovePlayerItem(cliententity);
        
AcceptEntityInput(entity"KillHierarchy");
    }
    return 
entity != -1;

__________________

Last edited by Grey83; 04-26-2023 at 07:32.
Grey83 is online now
boink
Member
Join Date: May 2021
Location: Australia
Old 04-26-2023 , 09:49   Re: disarm all players at the end of the round
Reply With Quote #3

mp_equipment_reset_rounds 1 will reset weapons every round

Additionally, you have these to choose what guns players spawn with (Leave empty to spawn with nothing):
mp_ct_default_secondary ""
mp_ct_default_primary ""
mp_t_default_secondary ""
mp_t_default_primary ""
__________________
@.boink. on Discord | DM for Plugin Requests | Tip Jar
boink is online now
Oza96
New Member
Join Date: Apr 2023
Old 04-29-2023 , 09:56   Re: disarm all players at the end of the round
Reply With Quote #4

thank you for your help !
Oza96 is offline
L4D2Noob
AlliedModders Donor
Join Date: Mar 2020
Location: Moscow
Old 04-30-2023 , 16:16   Re: disarm all players at the end of the round
Reply With Quote #5

Code:
#pragma semicolon 1
#pragma newdecls required

#include <sdktools_entinput>
#include <sdktools_functions>

bool bEnable;

public void OnPluginStart()
{
    ConVar cvar = CreateConVar("sm_round_end_disarm", "1", "Разоружить всех живых игроков в конце раунда", _, true, _, true, 1.0);
    cvar.AddChangeHook(CVarChange);
    bEnable = cvar.BoolValue;

    HookEvent("round_end", Event_End, EventHookMode_PostNoCopy);
}

public void CVarChange(ConVar cvar, const char[] oldValue, const char[] newValue)
{
    bEnable = cvar.BoolValue;
}

public void Event_End(Event event, const char[] name, bool dontBroadcast)
{
    if(!bEnable)
        return;

    for(int i = 1, j; i <= MaxClients; i++) if(IsClientInGame(i) && GetClientTeam(i) > 1 && IsPlayerAlive(i))
        for(j = 0; j < 6; j++) while(RemoveWeaponBySlot(i, j)) {}
}

stock bool RemoveWeaponBySlot(int client, int slot)
{
    static int entity;
    if((entity = GetPlayerWeaponSlot(client, slot)) <= MaxClients && entity >= 1)
    {
        RemovePlayerItem(client, entity);
        AcceptEntityInput(entity, "KillHierarchy");
        return true;
    }
    return false;
}
I tried to adapt this code for CS:S, but nothing happens at the end of the round in CS:S.
__________________
L4D2Noob is offline
Send a message via ICQ to L4D2Noob Send a message via Skype™ to L4D2Noob
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 05-01-2023 , 09:05   Re: disarm all players at the end of the round
Reply With Quote #6

Quote:
Originally Posted by L4D2Noob View Post
nothing happens
if((entity = GetPlayerWeaponSlot(client, slot)) <= MaxClients && entity >= 1)
==>
if((entity = GetPlayerWeaponSlot(client, slot)) > MaxClients)
__________________
Grey83 is online now
L4D2Noob
AlliedModders Donor
Join Date: Mar 2020
Location: Moscow
Old 05-01-2023 , 13:08   Re: disarm all players at the end of the round
Reply With Quote #7

Quote:
Originally Posted by Grey83 View Post
if((entity = GetPlayerWeaponSlot(client, slot)) <= MaxClients && entity >= 1)
==>
if((entity = GetPlayerWeaponSlot(client, slot)) > MaxClients)
Thank you, now it works like clockwork!
__________________
L4D2Noob is offline
Send a message via ICQ to L4D2Noob Send a message via Skype™ to L4D2Noob
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 08:32.


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