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

Zoom close


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
undead52
Senior Member
Join Date: Dec 2016
Old 10-16-2017 , 11:57   Zoom close
Reply With Quote #1

i was trying to close Scope zoom it works but there's a bug, when player shoot while opening Scope Scope opening automatically and dont close.
PHP Code:
public Fwd_PlayerPreThink(id)
{
     if(!
is_user_connected(id) || !is_user_alive(id))
                return;
 
     static 
WpnTempButton;
     
Wpn get_user_weapon(idTempTemp);
 
     
Button pev(idpev_button);
 
     if(
Wpn == CSW_AWP)
     {
          if((
Button IN_ATTACK2) && !Attack2Pressed[id])
          {
              
set_task(0.5"scope"id)

 
              
Attack2Pressed[id] = false;
          }
          else if((
Button & (IN_ATTACK || IN_ATTACK2)) & Attack2Pressed[id])
          {
              
cs_set_user_zoom(idCS_RESET_ZOOM1);
 
              
Attack2Pressed[id] = true;
        
          }
     }
}

public 
scope(id){
    
cs_set_user_zoom(idCS_RESET_ZOOM1);
    return 
PLUGIN_HANDLED;

undead52 is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 10-16-2017 , 12:03   Re: Zoom close
Reply With Quote #2

so you`re trying to make zoom available only for 0.5 seconds and then close?
__________________
retired chump
DjSoftero is offline
undead52
Senior Member
Join Date: Dec 2016
Old 10-16-2017 , 12:06   Re: Zoom close
Reply With Quote #3

yes
undead52 is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 10-16-2017 , 12:32   Re: Zoom close
Reply With Quote #4

tested and works:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>

public client_PreThink(id) { 
    if(!
is_user_alive(id)) 
        return
        
    if(
get_user_weapon(id) != CSW_AWP)
        return
        
    if(
cs_get_user_zoom(id) && !task_exists(id))
        
set_task(0.5"scope"id)
        
    else if(!
cs_get_user_zoom(id) && task_exists(id))
        
remove_task(id)
}

public 
scope(id) {
    
cs_set_user_zoom(idCS_RESET_ZOOM1
    return

__________________
retired chump

Last edited by DjSoftero; 10-16-2017 at 12:43.
DjSoftero 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 16:58.


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