Raised This Month: $ Target: $400
 0% 

Nightvision menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
interp124
New Member
Join Date: Jan 2010
Old 05-27-2010 , 13:02   Nightvision menu
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
#include <fun>
#include <engine>

new color[33][3]
new 
message

public plugin_init() 
{
        
register_plugin("Nightvision menu""0.01""aemikskropkapeel");
        
register_forward(FM_EmitSound"Fwd_EmitSound");
        
message get_user_msgid("ScreenFade");
    
register_logevent("Poczatek_Rundy"2"1=Round_Start"
}

public 
Poczatek_Rundy()
{
    for(new 
i=1;i<33;i++){
        if(!
is_user_connected(i)) continue;
        if(
task_exists(i))
            
remove_task(i);
        if(
is_user_alive(i))
        {
            if(
cs_get_user_team(i) == CS_TEAM_T)
            {
                
Show(i)
            }
        }
    }
}

public 
Show(id)
{
    new 
xmenu=menu_create("\rNightvision menu:","Pressed");
    
    
menu_additem(xmenu,"Blue");
    
menu_additem(xmenu,"Red");
    
menu_additem(xmenu,"Yellow");

    
menu_setprop(xmenu,MPROP_NUMBER_COLOR,"\r");
    
menu_display(idxmenu,0);
    return 
PLUGIN_HANDLED;
}

public 
Pressed(idmenuitem)
{
    switch(
item)
    {
        case 
0:{ //Blue
                        
color[id]={0,0,255}
            
cs_set_user_nvg(id,11)
            
engclient_cmd(id,"nightvision")
        }
        case 
1:{ //Red
                        
color[id]={255,0,0}
            
cs_set_user_nvg(id,11)
            
engclient_cmd(id,"nightvision")
        }
        case 
2:{ //Yellow
                        
color[id]={255,255,0}
            
cs_set_user_nvg(id,11)
            
engclient_cmd(id,"nightvision")
        }
    }
}

public 
Fwd_EmitSound(idiChannelszSound[], Float:fVolFloat:fAttniFlagsiPitch 
{
    if(
equali(szSound"items/nvg_on.wav"))
    {
        
ustaw(id)
        
set_task(0.1,"ustaw",id,_,_,"b")
    }
    if(
equali(szSound"items/nvg_off.wav"))
    {    
    
remove_task(id)
    }
}

public 
ustaw(id)
{
         
set_nvg(id,color)
         
light(id)
}

stock set_nvg(id,color[][])
{
        
message_begin(MSG_ONE_UNRELIABLE,message,{0,0,0},id)
        
        
write_short(1000)
                
write_short(1000
                
write_short(1<<10

                
write_byte(0)
                
write_byte(0)
                
write_byte(0

                
write_byte(0

                
message_end()

                
message_begin(MSG_ONE_UNRELIABLE,message,{0,0,0},id
                
                
write_short(1000
                
write_short(1000
                
write_short(1<<10
                
                
write_byte(color[id][0])
                
write_byte(color[id][1])
                
write_byte(color[id][2]) 
                
                
write_byte(145)

                
message_end()
        
}

stock light(id)
{
        if(!
is_user_alive(id)) return PLUGIN_HANDLED
        
new Float:forigin[3], origin[3]
        
pev(id,pev_origin,forigin)
        
FVecIVec(forigin,origin)

        
message_begin(MSG_ONE_UNRELIABLE,SVC_TEMPENTITY,{0,0,0},id)

        
write_byte(27)

        
write_coord(origin[0])
        
write_coord(origin[1])
        
write_coord(origin[2])

        
write_byte(120//Radius

        
write_byte(color[id][0])
        
write_byte(color[id][1])
        
write_byte(color[id][2])
        
        
write_byte(40)
        
write_byte(100)
        
        
message_end()
        
        return 
PLUGIN_CONTINUE


Last edited by interp124; 03-06-2016 at 14:12.
interp124 is offline
 


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 05:16.


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