AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   CS:GO Help with code please (: (https://forums.alliedmods.net/showthread.php?t=306036)

Berva 03-13-2018 13:51

CS:GO Help with code please (:
 
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



OSWO 03-15-2018 15:08

Re: CS:GO Help with code please (:
 
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

Berva 04-01-2018 05:16

Re: CS:GO Help with code please (:
 
Thank you so much <3


All times are GMT -4. The time now is 01:50.

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