Quote:
Originally Posted by XHUNTERX
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[] name, bool dontBroadcast)
{
for(int i = 1; i <= MaxClients; i++)
{
g_bUsed[i] = false;
}
g_bTimePassed = false;
CreateTimer(60.0, Timer_TimePassed);
}
public Action NoclipMe(int client, int args)
{
char sAuthID[MAX_NAME_LENGTH];
GetClientAuthId(client, AuthId_Steam2, sAuthID, sizeof(sAuthID));
GetClientAbsOrigin(client, g_fClientPos[client]);
if( client < 1 || !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.FloatValue, Timer_StopNoclip, client);
g_bUsed[client] = true;
LogAction(client, client, "%N (%s) Enabled noclip", client, sAuthID);
SetEntityMoveType(client, MOVETYPE_NOCLIP);
CPrintToChat(client, "{green}[Noclip]{default} Noclip {green}enabled.");
}
return Plugin_Handled;
}
public Action Timer_StopNoclip(Handle timer, int client)
{
SetEntityMoveType(client, MOVETYPE_WALK);
if(g_cTeleport.IntValue >= 1)
{
TeleportEntity(client, g_fClientPos[client], NULL_VECTOR, NULL_VECTOR);
}
CPrintToChat(client, "{green}[Noclip]{default} Noclip {darkred}disabled.");
}
public Action Timer_TimePassed(Handle timer)
{
g_bTimePassed = true;
}
__________________