View Single Post
SSheriFF
AlliedModders Donor
Join Date: May 2020
Location: Israel
Old 10-15-2020 , 23:54   Re: CSG0 - noclipme edit
Reply With Quote #4

Quote:
Originally Posted by XHUNTERX View Post
each round can be used 1 time
Stays active for 5 seconds then returns to normal

thanks
I also added that after the 5 seconds over the client will be teleported to the place he was when he used the command so he wont get stucked.
PHP Code:
#pragma semicolon 1
 
#include <sourcemod>
#include <sdktools>
#define PLUGIN_VERSION "1.0.1"

bool g_bUsed[MAXPLAYERS 1] =  { false };
float g_fClientPos[MAXPLAYERS 1][3];
public 
Plugin myinfo =
{
    
name        =    "Self Noclip",
    
author        =    "killjoy",
    
description    =    "personal noclip for Donators",
    
version        =    PLUGIN_VERSION,
    
url            =    "http://www.epic-nation.com"
};
 
public 
OnPluginStart()
{
    
RegConsoleCmd("sm_noclipme",NoclipMe,"Toggles noclip on yourself");
    
HookEvent("round_start"OnRoundStart);
}
 public 
void OnRoundStart(Event event, const char[] namebool dontBroadcast)
{
    for (
int i 1<= MaxClientsi++)
    {
        
g_bUsed[i] = false;
    }
}
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 ))
    {
        
ReplyToCommand(client"\x04[SM] \x05You need to be alive to use noclip");
        return 
Plugin_Handled;
    }
    if (
GetEntityMoveType(client) != MOVETYPE_NOCLIP && !g_bUsed[client])
    {
        
CreateTimer(5.0StopNoclipclient);
        
g_bUsed[client] = true;
        
LogAction(clientclient"%N (%s) Enabled noclip"clientsAuthID);
        
SetEntityMoveType(clientMOVETYPE_NOCLIP);
        
ReplyToCommand(client"\x04[SM] \x05Noclip Enabled");
    }
    return 
Plugin_Handled;
}
public 
Action StopNoclip(Handle timerint client)
{
    
SetEntityMoveType(clientMOVETYPE_WALK);
    
TeleportEntity(clientg_fClientPos[client], NULL_VECTORNULL_VECTOR);
    
PrintToChat(client"\x04[SM] \x05Noclip Disabled");

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

My Plugins:
SSheriFF is offline