Raised This Month: $ Target: $400
 0% 

Flashlight to Nightvision


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
myusername
Senior Member
Join Date: Aug 2012
Old 05-22-2013 , 13:27   Flashlight to Nightvision
Reply With Quote #1

Hello allied modders. If player in terrorist team then i want to bind F to nightvision. If he press F button then nightvision will toggle. And if in ct team then button F is impulse 100(flashlight).


Thank you.
__________________
Rest in piece.
myusername is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 05-22-2013 , 13:52   Re: Flashlight to Nightvision
Reply With Quote #2

try:

PHP Code:
#include < amxmodx >
#include < cstrike >
#include < engine >

#define PLUGIN_NAME "x"
#define PLUGIN_VERSION "0.0.0.1"
#define PLUGIN_AUTHOR "x"

public plugin_init( ) 
{
    
register_plugin
    

        
PLUGIN_NAME
        
PLUGIN_VERSION
        
PLUGIN_AUTHOR 
    
);

    
register_impulse100"ClientCommand__Impulse" );
}

public 
ClientCommand__ImpulsepPlayer )
{
    if( !
is_user_alivepPlayer ) || cs_get_user_teampPlayer ) != CS_TEAM_T )
        return 
PLUGIN_CONTINUE;

    
cs_set_user_nvgpPlayer, .nvgoggles = !cs_get_user_nvgpPlayer ) );

    return 
PLUGIN_HANDLED;

__________________

Last edited by Bos93; 05-22-2013 at 14:20.
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-22-2013 , 16:29   Re: Flashlight to Nightvision
Reply With Quote #3

This only set item to true or false, you need to execute engclient_cmd(id, "nightvision").
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 05-22-2013 , 18:31   Re: Flashlight to Nightvision
Reply With Quote #4

yeah,my bad,thanks.
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 05-22-2013 , 20:08   Re: Flashlight to Nightvision
Reply With Quote #5

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <engine>

#define PLUGIN_NAME "x"
#define PLUGIN_VERSION "0.0.2"
#define PLUGIN_AUTHOR "x"

new only_disable_fl

public plugin_init()
{
    
register_plugin(PLUGIN_NAME,PLUGIN_VERSION,PLUGIN_AUTHOR)
    
    
register_impulse(100"ClientCommand__Impulse")
    
    
only_disable_fl register_cvar("only_disable_fl""0"// Set 1 For Just Ignore When Terro Try To Use Flashlight
}

public 
ClientCommand__Impulse(id)
{
    if(!
is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_T)
        return 
PLUGIN_CONTINUE
    
    
else
    {
        if(
get_pcvar_num(only_disable_fl))
            
client_print(idprint_center"YOU ARENT ALLOWED TO USE FLASHLIGHT")
    
        else
        {
            if(!
cs_get_user_nvg(id))
                
cs_set_user_nvg(id1)
        
            
engclient_cmd(id"nightvision")
        }
    }
    
    return 
PLUGIN_HANDLED

I made cvar because no makes sence use flashlight to nightvision, since they can use n. So if you want just disable flashlight and shows message that they cant use flashlight set the cvar to 1.
If cvar is 0, it does nightvision instead of flashlight for Terrorists
__________________
Jhob94 is offline
myusername
Senior Member
Join Date: Aug 2012
Old 05-23-2013 , 13:40   Re: Flashlight to Nightvision
Reply With Quote #6

Jhob94 version works like charm. Thank you.

@MOD: Solved.
__________________
Rest in piece.
myusername 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 19:27.


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