View Single Post
SSheriFF
AlliedModders Donor
Join Date: May 2020
Location: Israel
Old 10-16-2020 , 01:12   Re: CSG0 - noclipme edit
Reply With Quote #7

Quote:
Originally Posted by XHUNTERX View Post
you are amazing thank you so much
but I forgot to say the most important thing
Using this command should be banned for 60 seconds each time the round starts.
is it possible ?
PHP Code:
#pragma semicolon 1
 
#include <sourcemod>
#include <sdktools>
#include <multicolors>
#define PLUGIN_VERSION "1.0.1"

#pragma newdecls required

bool g_bUsed[MAXPLAYERS 1] = {false, ...};
bool g_bTimePassed false;
float g_fClientPos[MAXPLAYERS 1][3];
ConVar  g_cTeleport,
        
g_cTimer;

public 
Plugin myinfo =
{
    
name        =   "Self Noclip",
    
author    "killjoy",
    
description =    "personal noclip for Donators",
    
version  =    PLUGIN_VERSION,
    
url   =    "http://www.epic-nation.com"
};
 
public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_noclipme",NoclipMe,"Toggles noclip on yourself");
    
HookEvent("round_start"OnRoundStart);
    
    
g_cTeleport CreateConVar("sm_noclipme_teleport""1""Teleport player to the place he was when he used the command so he wont get stucked. 1 = Enabled | 0 = Disabled (Default 1)");
    
g_cTimer    CreateConVar("sm_noclipme_timer""5",   "Time in seconds to disable noclip on player (Default 5)");
}

public 
void OnRoundStart(Event event, const char[] namebool dontBroadcast)
{
    for(
int i 1<= MaxClientsi++)
    {
        
g_bUsed[i] = false;
    }
    
g_bTimePassed false;
    
CreateTimer(60.0Timer_TimePassed);
}

public 
Action NoclipMe(int clientint args)
{
    
char sAuthID[MAX_NAME_LENGTH];
    
GetClientAuthId(clientAuthId_Steam2sAuthIDsizeof(sAuthID));
    
GetClientAbsOrigin(clientg_fClientPos[client]);

    if( 
client || !IsClientInGame(client) || !IsPlayerAlive(client ))
    {
        
CPrintToChat(client"{green}[Noclip]{default} You have to be alive to use {green}noclip");
        return 
Plugin_Handled;
    }

    if (
GetEntityMoveType(client) != MOVETYPE_NOCLIP && !g_bUsed[client] && g_bTimePassed)
    {
        
CreateTimer(g_cTimer.FloatValueTimer_StopNoclipclient);
        
g_bUsed[client] = true;
        
LogAction(clientclient"%N (%s) Enabled noclip"clientsAuthID);
        
SetEntityMoveType(clientMOVETYPE_NOCLIP);
        
CPrintToChat(client"{green}[Noclip]{default} Noclip {green}enabled.");
    }
    return 
Plugin_Handled;
}

public 
Action Timer_StopNoclip(Handle timerint client)
{
    
SetEntityMoveType(clientMOVETYPE_WALK);
    if(
g_cTeleport.IntValue >= 1)
    {
        
TeleportEntity(clientg_fClientPos[client], NULL_VECTORNULL_VECTOR);
    }
    
CPrintToChat(client"{green}[Noclip]{default} Noclip {darkred}disabled.");
}
public 
Action Timer_TimePassed(Handle timer)
{
    
g_bTimePassed true;

__________________
Taking small private requests (Free) and big private requests (Paid).
Contact me via Discord: WilDick#1524

My Plugins:
SSheriFF is offline