AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   CSG0 - noclipme edit (https://forums.alliedmods.net/showthread.php?t=327901)

XHUNTERX 10-15-2020 23:20

CSG0 - noclipme edit
 
https://forums.alliedmods.net/showthread.php?t=209155

Code:

#pragma semicolon 1
 
#include <sourcemod>
 
#define PLUGIN_VERSION "1.0.1"
 
public Plugin:myinfo =
{
    name        =    "Self Noclip",
    author        =    "killjoy",
    description    =    "personal noclip for Donators",
    version        =    PLUGIN_VERSION,
    url            =    "http://www.epic-nation.com"
};
 
public OnPluginStart()
{
    RegAdminCmd("sm_noclipme",NoclipMe,ADMFLAG_RESERVATION,"Toggles noclip on yourself");
}
 
public Action:NoclipMe(client, args)
{
        decl String:sAuthID[MAX_NAME_LENGTH];
        decl String:strName[MAX_NAME_LENGTH];
        GetClientAuthId(client, AuthId_Steam2, sAuthID, sizeof(sAuthID));
        GetClientName(client, strName, sizeof(strName));
       
        if( client < 1 || !IsClientInGame(client) || !IsPlayerAlive(client ))
        {
                ReplyToCommand(client, "\x04[SM] \x05You need to be alive to use noclip");
                return Plugin_Handled;
        }
        if (GetEntityMoveType(client) != MOVETYPE_NOCLIP)
        {
                LogAction(client, client, "%s (%s) Enabled noclip", strName, sAuthID);
                SetEntityMoveType(client, MOVETYPE_NOCLIP);
                ReplyToCommand(client, "\x04[SM] \x05Noclip Enabled");
        }
        else
        {
                LogAction(client, client, "%s (%s) Disabled noclip", strName, sAuthID);
                SetEntityMoveType(client, MOVETYPE_WALK);
                ReplyToCommand(client, "\x04[SM] \x05Noclip Disabled");
        }
        return Plugin_Handled;
}

hello;
Can you add time + round limit to this plugin?
each round can be used 1 time
Stays active for 5 seconds then returns to normal

not just ADMFLAG_RESERVATION ( every living player can use )

thanks

NanoC 10-15-2020 23:24

Re: CSG0 - noclipme edit
 
Time and cooldown? What do you mean?

XHUNTERX 10-15-2020 23:40

Re: CSG0 - noclipme edit
 
Quote:

Originally Posted by NanoC (Post 2721468)
Time and cooldown? What do you mean?

each round can be used 1 time
Stays active for 5 seconds then returns to normal

thanks

SSheriFF 10-15-2020 23:54

Re: CSG0 - noclipme edit
 
Quote:

Originally Posted by XHUNTERX (Post 2721469)
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");



NanoC 10-16-2020 00:24

Re: CSG0 - noclipme edit
 
1 Attachment(s)
Just in case you want to control timer and teleport, i've added 2 cvars on Sherif's code to do it.
  • sm_noclipme_teleport - Teleport player to the place he was when he used the command so he wont get stucked. 1 = Enabled | 0 = Disabled (Default 1)
  • sm_noclipme_timer - Time in seconds to disable noclip on player (Default 5)

Source Code:
Spoiler

XHUNTERX 10-16-2020 01:03

Re: CSG0 - noclipme edit
 
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 ?

SSheriFF 10-16-2020 01:12

Re: CSG0 - noclipme edit
 
Quote:

Originally Posted by XHUNTERX (Post 2721478)
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;



XHUNTERX 10-16-2020 02:01

Re: CSG0 - noclipme edit
 
Quote:

sm_noclipme_teleport - Teleport player to the place he was when he used the command so he wont get stucked. 1 = Enabled | 0 = Disabled (Default 1)
Could something like this happen instead of this feature?

example;

Quote:

csgo/addons/sourcemod/configs/noclipme/de_dust2.cfg
Quote:

"locations"
{
"1"
{
"location_X" "1191.6"
"location_Y" "19.0"
"location_Z" "64.0"
}
}
Quote:

csgo/addons/sourcemod/configs/noclipme/de_mirage.cfg
Quote:

"locations"
{
"1"
{
"location_X" "-216.7"
"location_Y" "95.8"
"location_Z" "200.0"
}
}


so I can choose where to teleport for each map

SSheriFF 10-16-2020 03:57

Re: CSG0 - noclipme edit
 
1 Attachment(s)
Quote:

Originally Posted by XHUNTERX (Post 2721483)
Could something like this happen instead of this feature?

example;











so I can choose where to teleport for each map

You have to create a file in this directory: "addons/sourcemod/configs/noclipme/locations.cfg"
The file should look like that:
Code:

"Locations"
{
  "mapname"
  {
      "location_X" "-216.7"
      "location_Y" "95.8"
      "location_Z" "200.0"
    }
  "mapname2"
  {
      "location_X" "-123.5"
      "location_Y" "95.8"
      "location_Z" "200.0"
    }
}

Also I added a command for flag "z" / "ROOT" (sm_setpos) and it will type your current position on the map to the file on the entry of the current map.

XHUNTERX 10-16-2020 05:54

Re: CSG0 - noclipme edit
 
Quote:

You have to create a file in this directory: "addons/sourcemod/configs/noclipme/locations.cfg"
I created the file you said but it doesn't automatically save ( sm_setpos )
Quote:

You set your current positon succesfully
(this message appears, but locations are not saved)
works when i manually enter locations


All times are GMT -4. The time now is 18:11.

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