Raised This Month: $32 Target: $400
 8% 

cs:go Flash light and nightvision for my server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Berva
Member
Join Date: Feb 2018
Old 02-27-2018 , 18:22   cs:go Flash light and nightvision for my server
Reply With Quote #1

Is there any good guy who would edit those two plugins (at least flash light).
I'd love to make flash light for ct only and nightvision for t only

It's for my zombie mod and I have no clue how to edit those files

thanks <3 <3
Attached Files
File Type: zip NVG_Public02.zip (11.1 KB, 57 views)
File Type: zip flashlight.zip (7.4 KB, 62 views)
Berva is offline
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 02-28-2018 , 07:41   Re: cs:go Flash light and nightvision for my server
Reply With Quote #2

Nightvision:
PHP Code:
#pragma semicolon 1
#include <sdktools>
#include <sdktools_sound>
#define VERSION "0.2"
#define AUTHOR "TummieTum (TumTum)"
#define MAX_FILE_LEN 80

// CVAR Handles
new Handle:cvarnven INVALID_HANDLE;
new 
Handle:cvarnvspawn INVALID_HANDLE;
new 
Handle:cvarnvonoff INVALID_HANDLE;
new 
Handle:cvarnvsoundnameon INVALID_HANDLE;
new 
String:g_soundNameOn[MAX_FILE_LEN];

// Basic Information (Do not change it)
public Plugin:myinfo =
{
    
name "Night Vision Goggles",
    
author AUTHOR,
    
description "CS:GO Night Vision",
    
version VERSION,
    
url "https://www.team-secretforce.com"
};

// Command
public OnPluginStart()
{
    
// Default
    
RegConsoleCmd("sm_nvg"Command_nightvision);
    
    
// Events
    
HookEvent("player_spawn"PlayerSpawn);
    
    
//Cvars
    
cvarnvspawn CreateConVar("nv_spawnmsg""1""Enable or Disable Spawnmessages");
    
cvarnvonoff CreateConVar("nv_onoff""1""Disable Enable / Disable Messages");
    
cvarnven CreateConVar("nv_command""1""Enable or Disable !NVG");
    
cvarnvsoundnameon CreateConVar("nv_sound""music/nightvision/nvon.mp3""Turn on sound");
    
    
// Version
    
CreateConVar("sm_nightvision_version"VERSION"Plugin info"FCVAR_DONTRECORD|FCVAR_NOTIFY);
    
    
//Generate
    
AutoExecConfig(true"Night_Vision_TummieTum");
         
}

public 
OnConfigsExecuted()
{
    
// Get Convars
    
GetConVarString(cvarnvsoundnameong_soundNameOnMAX_FILE_LEN);
    
// Buffer
    
decl String:bufferOn[MAX_FILE_LEN];
    
// Precache Sounds
    
PrecacheSound(g_soundNameOntrue);
    
// Format
    
Format(bufferOnsizeof(bufferOn),"sound/%s"g_soundNameOn);
    
// Add to Downloadstable
    
AddFileToDownloadsTable(bufferOn); 
}

public 
Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    
// Get Client
    
new client GetClientOfUserId(GetEventInt(event"userid"));
    
    if (
GetClientTeam(client) == && !IsPlayerAlive(client))
    {
    return;
    }
    
    
// Check Convar & Spawnmsg
    
if (GetConVarInt(cvarnvspawn) == 1)
    {    
        
PrintToChat(client,"[Night Vision] Type \x03!nvg \x01to enable NV.");
    }
    
}

// Enable
public Action:Command_nightvision(clientargs)
{
     if (
GetConVarInt(cvarnven) == 1)
    {
        if (
IsPlayerAlive(client) && GetClientTeam(client) == 2
        {
            if(
GetEntProp(clientProp_Send"m_bNightVisionOn") == 0)
            {
                
SetEntProp(clientProp_Send"m_bNightVisionOn"1);
                if (
GetConVarInt(cvarnvonoff) == 1)
                {
                
PrintToChat(client,"[Night Vision] \x03NV is Enabled!");
                }
                
EmitSoundToClient(client,g_soundNameOn);
                }
            else
            {
                
SetEntProp(clientProp_Send"m_bNightVisionOn"0);
                if (
GetConVarInt(cvarnvonoff) == 1)
                {
                
PrintToChat(client,"[Night Vision] \x03NV is Disabled!");
                }
            }
        }
    }
    return 
Plugin_Handled;

Flashlight:
PHP Code:
#pragma semicolon 1
#include <sdktools>
#define PVERSION "1.3.63"

new Handle:gH_Enabled INVALID_HANDLE;
new 
Handle:gH_LAW INVALID_HANDLE;
new 
Handle:gH_Return INVALID_HANDLE;
new 
Handle:gH_Sound INVALID_HANDLE;
new 
Handle:gH_SoundAll INVALID_HANDLE;

new 
bool:bEnabled true;
new 
bool:bLAW true;
new 
bool:bRtn false;
new 
bool:bSnd false;
new 
bool:bSndAll true;

new 
String:zsSnd[255];

public 
Plugin:myinfo =
{
    
name "Flashlight",
    
author "Mitch",
    
description "Replaces +lookatweapon with a toggleable flashlight. Also adds the command: sm_flashlight",
    
version PVERSION,
    
url "https://forums.alliedmods.net/showthread.php?t=227224"
};

public 
OnPluginStart()
{
    
gH_Enabled CreateConVar("sm_flashlight_enabled""1"
                    
"0 = Disables flashlight; 1 = Enables flashlight",         FCVAR_PLUGINtrue0.0true1.0);
    
gH_LAW CreateConVar("sm_flashlight_lookatweapon""1"
                    
"0 = Doesn't use +lookatweapon; 1 = hooks +lookatweapon",         FCVAR_PLUGINtrue0.0true1.0);
    
gH_Return CreateConVar("sm_flashlight_return""0"
                    
"0 = Doesn't return blocking +look at weapon; 1 = Does return"FCVAR_PLUGINtrue0.0true1.0);
    
gH_Sound CreateConVar("sm_flashlight_sound""items/flashlight1.wav"
                    
"Sound path to use when a player uses the flash light."FCVAR_PLUGIN);
    
gH_SoundAll CreateConVar("sm_flashlight_sound_all""1"
                    
"Play the sound to all players, or just to the activator?"FCVAR_PLUGIN);
    
UpdateSound();
    
HookConVarChange(gH_SoundConVarChanged);
    
HookConVarChange(gH_EnabledConVarChanged);
    
HookConVarChange(gH_LAWConVarChanged);
    
HookConVarChange(gH_ReturnConVarChanged);
    
HookConVarChange(gH_SoundAllConVarChanged);
    
AutoExecConfig();

    
CreateConVar("sm_flashlight_version"PVERSION"CsGoFlashlight Version"FCVAR_DONTRECORD|FCVAR_NOTIFY);

    
AddCommandListener(Command_LAW"+lookatweapon");    //Hooks cs:go's flashlight replacement 'look at weapon'.
    
RegConsoleCmd("sm_flashlight"Command_FlashLight);     //Bindable Flashlight command
}

public 
ConVarChanged(Handle:cvar, const String:oldVal[], const String:newVal[])
{
    if(
cvar == gH_Enabled)
        
bEnabled bool:StringToInt(newVal);
    if(
cvar == gH_LAW)
        
bLAW bool:StringToInt(newVal);
    if(
cvar == gH_Return)
        
bRtn bool:StringToInt(newVal);
    if(
cvar == gH_SoundAll)
        
bSndAll bool:StringToInt(newVal);
    if(
cvar == gH_Sound) {
        
UpdateSound();
    }
}

public 
UpdateSound() {
    
decl String:formatedSound[256];
    
GetConVarString(gH_SoundformatedSoundsizeof(formatedSound));
    if(
StrEqual(formatedSound"") || StrEqual(formatedSound"0")) {
        
bSnd false;
    } else {
        
strcopy(zsSndsizeof(zsSnd), formatedSound);
        
bSnd true;
        
PrecacheSound(zsSnd);
        if(!
StrEqual(formatedSound"items/flashlight1.wav")) {
            
Format(formatedSoundsizeof(formatedSound), "sound/%s"formatedSound);
            
AddFileToDownloadsTable(formatedSound);
        }
    }
}

public 
OnMapStart() {
    if(
bSnd) {
        
PrecacheSound(zsSndtrue);
    }
}

public 
Action:Command_LAW(client, const String:command[], argc)
{
    if(!
bLAW || !bEnabled//Enable this hook?
        
return Plugin_Continue;

    if(!
IsClientInGame(client)) //If player is not in-game then ignore!
        
return Plugin_Continue;

    if(!
IsPlayerAlive(client)) //If player is not alive then continue the command.
        
return Plugin_Continue;    

    
ToggleFlashlight(client);

    return (
bRtn) ? Plugin_Continue Plugin_Handled;
}

public 
Action:Command_FlashLight(clientargs)
{
    if(!
bEnabled)
        return 
Plugin_Handled;

    if (
IsClientInGame(client) && IsPlayerAlive(client) && GetClientTeam(client) == 3) {
        
ToggleFlashlight(client);
    }
    return 
Plugin_Handled;
}

ToggleFlashlight(client) {
    
SetEntProp(clientProp_Send"m_fEffects"GetEntProp(clientProp_Send"m_fEffects") ^ 4);
    if(
bSnd) {
        if(
bSndAll) {
            
EmitSoundToAll(zsSndclient);
        } else {
            
EmitSoundToClient(clientzsSnd);
        }
    }

__________________
PinHeaDi is offline
Berva
Member
Join Date: Feb 2018
Old 02-28-2018 , 12:21   Re: cs:go Flash light and nightvision for my server
Reply With Quote #3

Many thanks for your time mr. PinHeaDi I don't know how to thank you <3
Nightvision works well, but the flashlight does not, maybe i did something wrong, I'll try it again.

Do you think you could actually make the same feature for NVG as flashlight have? Bind it to "C" word for example (and leave that chat: !nvg thingie)

I don't know that much about coding and salary of those masterpieces, but... Our portal really needs a plugin master, I think it's not really much, but I'll pay for your each masterpiece(plugin) 5€... Maybe it is laughable, but I've got low budget :c (plugins are going to be similar to those)

Last edited by Berva; 02-28-2018 at 12:27.
Berva is offline
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 02-28-2018 , 17:19   Re: cs:go Flash light and nightvision for my server
Reply With Quote #4

You don't need to pay me, I'll combine the plugins tomorrow, with the new syntax and bind whatever is possible.
__________________

Last edited by PinHeaDi; 02-28-2018 at 17:19.
PinHeaDi is offline
Berva
Member
Join Date: Feb 2018
Old 02-28-2018 , 17:36   Re: cs:go Flash light and nightvision for my server
Reply With Quote #5

No way... You can't do it for free! ...
Berva is offline
srvmil
Senior Member
Join Date: Oct 2010
Old 02-28-2018 , 23:36   Re: cs:go Flash light and nightvision for my server
Reply With Quote #6

Quote:
Originally Posted by Berva View Post
the flashlight does not
I can confirm flashlight does work if you press the "F" key on your keyboard.

However, I tested it, the terrorist team still get the flashlight with the F key. I thought this is for CT only?
srvmil is offline
Rohanlogs
Senior Member
Join Date: Nov 2015
Old 03-01-2018 , 00:32   Re: cs:go Flash light and nightvision for my server
Reply With Quote #7

Quote:
Originally Posted by srvmil View Post
I can confirm flashlight does work if you press the "F" key on your keyboard.

However, I tested it, the terrorist team still get the flashlight with the F key. I thought this is for CT only?
Spoiler
__________________
Rohanlogs is offline
srvmil
Senior Member
Join Date: Oct 2010
Old 03-01-2018 , 00:34   Re: cs:go Flash light and nightvision for my server
Reply With Quote #8

Will test it Rohanlogs and will report back

EDIT: Can confirm that one is working now for CT only. Thanks

Last edited by srvmil; 03-01-2018 at 00:54.
srvmil is offline
Berva
Member
Join Date: Feb 2018
Old 03-01-2018 , 04:06   Re: cs:go Flash light and nightvision for my server
Reply With Quote #9

hi srvmil, yes I know it worked for both teams, but it should work only for ct's...
I thank you so much for your time guys!
Berva is offline
srvmil
Senior Member
Join Date: Oct 2010
Old 03-01-2018 , 04:41   Re: cs:go Flash light and nightvision for my server
Reply With Quote #10

Quote:
Originally Posted by Berva View Post
hi srvmil, yes I know it worked for both teams, but it should work only for ct's...
I thank you so much for your time guys!
I tested Rohanlogs's plugins and his one only works for CT. Click the spoiler and then try that, it definitely what we're after

Last edited by srvmil; 03-01-2018 at 04:41.
srvmil 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 21:15.


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