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

CS:GO Help with code please (:


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Berva
Member
Join Date: Feb 2018
Old 03-13-2018 , 13:51   CS:GO Help with code please (:
Reply With Quote #1

I'd love to make it automaticly enabled when T and remove that "type !nvg for nvg" spam. Thanks <3

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

Berva is offline
OSWO
Senior Member
Join Date: Jul 2015
Location: United Kingdom, London
Old 03-15-2018 , 15:08   Re: CS:GO Help with code please (:
Reply With Quote #2

I mean you can already remove the Message in the ConVar `nv_spawnmsg` (:

Here you go, I did exactly as you requested.
https://github.com/OSCAR-WOS/SourceP...rva-Request.sp
__________________
SourceTimer | WeaponSkins++ | BasePlugins++ https://github.com/OSCAR-WOS

Last edited by OSWO; 03-15-2018 at 15:12.
OSWO is offline
Berva
Member
Join Date: Feb 2018
Old 04-01-2018 , 05:16   Re: CS:GO Help with code please (:
Reply With Quote #3

Thank you so much <3
Berva is offline
Reply


Thread Tools
Display Modes

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 07:14.


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