Raised This Month: $51 Target: $400
 12% 

Solved CS:GO Hold (+reload) to be invisible max. 5 seconds invisible


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 07-07-2018 , 12:42   CS:GO Hold (+reload) to be invisible max. 5 seconds invisible
Reply With Quote #1

Hey, i need a Plugin where Player can hold there +reload Key (default: R) to be invisilbe. If they stop holding the Key they will be visible. And please max Hold Time 5 Sec.

Thanks

Last edited by iskenderkebab33; 11-03-2018 at 17:33.
iskenderkebab33 is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 07-07-2018 , 14:17   Re: CS:GO Hold (+reload) to be invisible max. 5 seconds invisible
Reply With Quote #2

PHP Code:
#include <sourcemod>

#pragma semicolon 1

public Action OnPlayerRunCmd(int iClient)
{
    if (
IsClientInGame(iClient))
    {
        if (
IsPlayerAlive(iClient))
        {
            
int iButtons GetClientButtons(iClient);
            
            if (
iButtons IN_RELOAD)
            {
                
SetEntityRenderMode(iClientRENDER_NONE);
                
                
CreateTimer(5.0Timer_DisableiClientTIMER_FLAG_NO_MAPCHANGE);
            }
        }
    }
}

public 
Action Timer_Disable(Handle hTimerint iClient)
{
    
SetEntityRenderMode(iClientRENDER_NORMAL);

mug1wara is offline
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 07-07-2018 , 14:31   Re: CS:GO Hold (+reload) to be invisible max. 5 seconds invisible
Reply With Quote #3

Quote:
Originally Posted by mug1wara View Post
PHP Code:
#include <sourcemod>

#pragma semicolon 1

public Action OnPlayerRunCmd(int iClient)
{
    if (
IsClientInGame(iClient))
    {
        if (
IsPlayerAlive(iClient))
        {
            
int iButtons GetClientButtons(iClient);
            
            if (
iButtons IN_RELOAD)
            {
                
SetEntityRenderMode(iClientRENDER_NONE);
                
                
CreateTimer(5.0Timer_DisableiClientTIMER_FLAG_NO_MAPCHANGE);
            }
        }
    }
}

public 
Action Timer_Disable(Handle hTimerint iClient)
{
    
SetEntityRenderMode(iClientRENDER_NORMAL);


thanks! working fine.

EDIT: misunderstand, you are invisible and your Weapons

Is it also posible to invisible the Weapon/Knife and the shadow please.

Last edited by iskenderkebab33; 07-07-2018 at 14:37. Reason: misunderstand, you are invisible and your Weapons
iskenderkebab33 is offline
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 07-07-2018 , 14:42   Re: CS:GO Hold (+reload) to be invisible max. 5 seconds invisible
Reply With Quote #4

Quote:
Originally Posted by mug1wara View Post
PHP Code:
#include <sourcemod>

#pragma semicolon 1

public Action OnPlayerRunCmd(int iClient)
{
    if (
IsClientInGame(iClient))
    {
        if (
IsPlayerAlive(iClient))
        {
            
int iButtons GetClientButtons(iClient);
            
            if (
iButtons IN_RELOAD)
            {
                
SetEntityRenderMode(iClientRENDER_NONE);
                
                
CreateTimer(5.0Timer_DisableiClientTIMER_FLAG_NO_MAPCHANGE);
            }
        }
    }
}

public 
Action Timer_Disable(Handle hTimerint iClient)
{
    
SetEntityRenderMode(iClientRENDER_NORMAL);

can you do it, that player can only 3 times be invisible per Round. Thanks
iskenderkebab33 is offline
LenHard
Senior Member
Join Date: Jan 2016
Old 07-07-2018 , 14:52   Re: CS:GO Hold (+reload) to be invisible max. 5 seconds invisible
Reply With Quote #5

PHP Code:
#include <sourcemod>
#include <sdkhooks>

#pragma semicolon 1
#pragma newdecls required

bool gB_Invisiblity[MAXPLAYERS 1];

int gI_InvisCount[MAXPLAYERS 1];

Handle gH_InvisTimer[MAXPLAYERS 1];

public 
void OnPluginStart()
{
    
HookEvent("round_start"Event_RoundStartEventHookMode_Post);    
}

public 
void OnMapEnd()
{
    for (
int i 1<= MaxClients; ++i)
        if (
IsClientInGame(i))
            
DeleteTimer(i);
}

public 
void OnClientPutInServer(int client)
{
    if (!
IsFakeClient(client))
        
SDKHook(clientSDKHook_SetTransmitOnSetTransmit);    
}

public 
void Event_RoundStart(Event hEvent, const char[] sEventNamebool bDontBroadcast)
{
    for (
int i 1<= MaxClients; ++i)
    {
        if (
IsClientInGame(i))
        {
            
DeleteTimer(i);
            
            
gB_Invisiblity[i] = false;
            
gI_InvisCount[i] = 0;
            
            
SetEntProp(iProp_Send"m_bDrawViewmodel"true);
        }
    }
}

public 
Action OnSetTransmit(int entityint client)
{
    if (
client != entity && gB_Invisiblity[entity])
        return 
Plugin_Handled;
    return 
Plugin_Continue;
}

public 
Action OnPlayerRunCmd(int clientint &buttons)
{
    if (
IsPlayerAlive(client))
    {
        if (
buttons IN_RELOAD)
        {
            if (!
gB_Invisiblity[client] && gI_InvisCount[client] < 4)
            {
                
gB_Invisiblity[client] = true;
                ++
gI_InvisCount[client];
                
                
DeleteTimer(client);            
                
                
gH_InvisTimer[client] = CreateTimer(5.0Timer_VisibleGetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
                
SetEntProp(clientProp_Send"m_bDrawViewmodel"false);
                
PrintCenterText(client"You're now Invisible");
            }
        }
        else if (
gB_Invisiblity[client])
        {
            
DeleteTimer(client);        
            
            
gB_Invisiblity[client] = false;
            
SetEntProp(clientProp_Send"m_bDrawViewmodel"true);
            
PrintCenterText(client"You're now Visible");
        }
    }
}

public 
Action Timer_Visible(Handle hTimerany iUser)
{
    
int client GetClientOfUserId(iUser);

    if (
client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client))
    {
        
gH_InvisTimer[client] = null;
        
gB_Invisiblity[client] = false;
        
SetEntProp(clientProp_Send"m_bDrawViewmodel"true);
        
PrintCenterText(client"You're now Visible");
    }
}

void DeleteTimer(int client)
{
    if (
gH_InvisTimer[client] != null)
    {
        
delete gH_InvisTimer[client];    
        
gH_InvisTimer[client] = null;
    }    

__________________

Last edited by LenHard; 07-07-2018 at 15:08.
LenHard is offline
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 07-07-2018 , 15:01   Re: CS:GO Hold (+reload) to be invisible max. 5 seconds invisible
Reply With Quote #6

Quote:
Originally Posted by LenHard View Post
PHP Code:
#include <sourcemod>

#pragma semicolon 1
#pragma newdecls required

bool gB_Invisiblity[MAXPLAYERS 1];

int gI_InvisCount[MAXPLAYERS 1];

Handle gH_InvisTimer[MAXPLAYERS 1];

public 
void OnPluginStart()
{
    
HookEvent("round_start"Event_RoundStartEventHookMode_Post);    
}

public 
void OnMapEnd()
{
    for (
int i 1<= MaxClients; ++i)
        if (
IsClientInGame(i))
            
DeleteTimer(i);
}

public 
void Event_RoundStart(Event hEvent, const char[] sEventNamebool bDontBroadcast)
{
    for (
int i 1<= MaxClients; ++i)
    {
        if (
IsClientInGame(i))
        {
            
DeleteTimer(i);
            
            
gB_Invisiblity[i] = false;
            
gI_InvisCount[i] = 0;
        }
    }
}

public 
Action OnPlayerRunCmd(int clientint &buttons)
{
    if (
IsPlayerAlive(client))
    {
        if (
buttons IN_RELOAD)
        {
            if (!
gB_Invisiblity[client] && gI_InvisCount[client] < 4)
            {
                
gB_Invisiblity[client] = true;
                ++
gI_InvisCount[client];
                
                
DeleteTimer(client);            
                
                
gH_InvisTimer[client] = CreateTimer(5.0Timer_VisibleGetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
                
SetEntityRenderMode(clientRENDER_NONE);
                
PrintCenterText(client"You're now Invisible");
            }
        }
        else if (
gB_Invisiblity[client])
        {
            
DeleteTimer(client);        
            
            
gB_Invisiblity[client] = false;
            
SetEntityRenderMode(clientRENDER_NORMAL);    
            
PrintCenterText(client"You're now Visible");
        }
    }
}

public 
Action Timer_Visible(Handle hTimerany iUser)
{
    
int client GetClientOfUserId(iUser);

    if (
client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client))
    {
        
gH_InvisTimer[client] = null;
        
gB_Invisiblity[client] = false;
        
SetEntityRenderMode(clientRENDER_NORMAL);    
        
PrintCenterText(client"You're now Visible");
    }
}

void DeleteTimer(int client)
{
    if (
gH_InvisTimer[client] != null)
    {
        
delete gH_InvisTimer[client];    
        
gH_InvisTimer[client] = null;
    }    

working fine. thanks a lot.

Last edited by iskenderkebab33; 07-07-2018 at 15:05.
iskenderkebab33 is offline
LenHard
Senior Member
Join Date: Jan 2016
Old 07-07-2018 , 15:07   Re: CS:GO Hold (+reload) to be invisible max. 5 seconds invisible
Reply With Quote #7

Quote:
Originally Posted by iskenderkebab33 View Post
working fine. thanks a lot.
I updated the code, check the updated version
__________________
LenHard is offline
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 07-07-2018 , 15:10   Re: CS:GO Hold (+reload) to be invisible max. 5 seconds invisible
Reply With Quote #8

Quote:
Originally Posted by LenHard View Post
I updated the code, check the updated version
thanks, can you add also, a Player can only do it 3 times. after 3 times a Text will come like: you had your attempts. or something like that.
iskenderkebab33 is offline
LenHard
Senior Member
Join Date: Jan 2016
Old 07-07-2018 , 15:15   Re: CS:GO Hold (+reload) to be invisible max. 5 seconds invisible
Reply With Quote #9

Quote:
Originally Posted by iskenderkebab33 View Post
thanks, can you add also, a Player can only do it 3 times. after 3 times a Text will come like: you had your attempts. or something like that.
PHP Code:
#include <sourcemod>
#include <sdkhooks>

#pragma semicolon 1
#pragma newdecls required

#define INVIS_MAX_AMOUNT    3

bool gB_Invisiblity[MAXPLAYERS 1];

int gI_InvisCount[MAXPLAYERS 1];

Handle gH_InvisTimer[MAXPLAYERS 1];

public 
void OnPluginStart()
{
    
HookEvent("round_start"Event_RoundStartEventHookMode_Post);    
}

public 
void OnMapEnd()
{
    for (
int i 1<= MaxClients; ++i)
        if (
IsClientInGame(i))
            
DeleteTimer(i);
}

public 
void OnClientPutInServer(int client)
{
    if (!
IsFakeClient(client))
        
SDKHook(clientSDKHook_SetTransmitOnSetTransmit);    
}

public 
void Event_RoundStart(Event hEvent, const char[] sEventNamebool bDontBroadcast)
{
    for (
int i 1<= MaxClients; ++i)
    {
        if (
IsClientInGame(i))
        {
            
DeleteTimer(i);
            
            
gB_Invisiblity[i] = false;
            
gI_InvisCount[i] = 0;
            
            
SetEntProp(iProp_Send"m_bDrawViewmodel"true);
        }
    }
}

public 
Action OnSetTransmit(int entityint client)
{
    if (
client != entity && gB_Invisiblity[entity])
        return 
Plugin_Handled;
    return 
Plugin_Continue;
}

public 
Action OnPlayerRunCmd(int clientint &buttons)
{
    if (
IsPlayerAlive(client))
    {
        if (
buttons IN_RELOAD)
        {
            if (!
gB_Invisiblity[client])
            {
                if (
gI_InvisCount[client] < INVIS_MAX_AMOUNT)
                {
                    
gB_Invisiblity[client] = true;
                    ++
gI_InvisCount[client];
                    
                    
DeleteTimer(client);            
                    
                    
gH_InvisTimer[client] = CreateTimer(5.0Timer_VisibleGetClientUserId(client));
                    
SetEntProp(clientProp_Send"m_bDrawViewmodel"false);
                    
PrintCenterText(client"You're now Invisible");
                }
                else 
PrintCenterText(client"You've had your %i attempts."INVIS_MAX_AMOUNT);
            }
        }
        else if (
gB_Invisiblity[client])
        {
            
DeleteTimer(client);        
            
            
gB_Invisiblity[client] = false;
            
SetEntProp(clientProp_Send"m_bDrawViewmodel"true);
            
PrintCenterText(client"You're now Visible");
        }
    }
}

public 
Action Timer_Visible(Handle hTimerany iUser)
{
    
int client GetClientOfUserId(iUser);

    if (
client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client))
    {
        
gH_InvisTimer[client] = null;
        
gB_Invisiblity[client] = false;
        
SetEntProp(clientProp_Send"m_bDrawViewmodel"true);
        
PrintCenterText(client"You're now Visible");
    }
}

void DeleteTimer(int client)
{
    if (
gH_InvisTimer[client] != null)
    {
        
delete gH_InvisTimer[client];    
        
gH_InvisTimer[client] = null;
    }    

__________________

Last edited by LenHard; 07-07-2018 at 16:09.
LenHard is offline
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 07-07-2018 , 15:31   Re: CS:GO Hold (+reload) to be invisible max. 5 seconds invisible
Reply With Quote #10

Quote:
Originally Posted by LenHard View Post
PHP Code:
#include <sourcemod>
#include <sdkhooks>

#pragma semicolon 1
#pragma newdecls required

#define INVIS_MAX_AMOUNT    3

bool gB_Invisiblity[MAXPLAYERS 1];

int gI_InvisCount[MAXPLAYERS 1];

Handle gH_InvisTimer[MAXPLAYERS 1];

public 
void OnPluginStart()
{
    
HookEvent("round_start"Event_RoundStartEventHookMode_Post);    
}

public 
void OnMapEnd()
{
    for (
int i 1<= MaxClients; ++i)
        if (
IsClientInGame(i))
            
DeleteTimer(i);
}

public 
void OnClientPutInServer(int client)
{
    if (!
IsFakeClient(client))
        
SDKHook(clientSDKHook_SetTransmitOnSetTransmit);    
}

public 
void Event_RoundStart(Event hEvent, const char[] sEventNamebool bDontBroadcast)
{
    for (
int i 1<= MaxClients; ++i)
    {
        if (
IsClientInGame(i))
        {
            
DeleteTimer(i);
            
            
gB_Invisiblity[i] = false;
            
gI_InvisCount[i] = 0;
            
            
SetEntProp(iProp_Send"m_bDrawViewmodel"true);
        }
    }
}

public 
Action OnSetTransmit(int entityint client)
{
    if (
client != entity && gB_Invisiblity[entity])
        return 
Plugin_Handled;
    return 
Plugin_Continue;
}

public 
Action OnPlayerRunCmd(int clientint &buttons)
{
    if (
IsPlayerAlive(client))
    {
        if (
buttons IN_RELOAD)
        {
            if (!
gB_Invisiblity[client])
            {
                if (
gI_InvisCount[client] <= INVIS_MAX_AMOUNT)
                {
                    
gB_Invisiblity[client] = true;
                    ++
gI_InvisCount[client];
                    
                    
DeleteTimer(client);            
                    
                    
gH_InvisTimer[client] = CreateTimer(5.0Timer_VisibleGetClientUserId(client));
                    
SetEntProp(clientProp_Send"m_bDrawViewmodel"false);
                    
PrintCenterText(client"You're now Invisible");
                }
                else 
PrintCenterText(client"You've had your %i attempts."INVIS_MAX_AMOUNT);
            }
        }
        else if (
gB_Invisiblity[client])
        {
            
DeleteTimer(client);        
            
            
gB_Invisiblity[client] = false;
            
SetEntProp(clientProp_Send"m_bDrawViewmodel"true);
            
PrintCenterText(client"You're now Visible");
        }
    }
}

public 
Action Timer_Visible(Handle hTimerany iUser)
{
    
int client GetClientOfUserId(iUser);

    if (
client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client))
    {
        
gH_InvisTimer[client] = null;
        
gB_Invisiblity[client] = false;
        
SetEntProp(clientProp_Send"m_bDrawViewmodel"true);
        
PrintCenterText(client"You're now Visible");
    }
}

void DeleteTimer(int client)
{
    if (
gH_InvisTimer[client] != null)
    {
        
delete gH_InvisTimer[client];    
        
gH_InvisTimer[client] = null;
    }    

many thanks, but you can be 4 times invisible not 3 :/

#define INVIS_MAX_AMOUNT 3
in on 3 but you can 4 times

Last edited by iskenderkebab33; 07-07-2018 at 15:32.
iskenderkebab33 is offline
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 14:27.


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