Raised This Month: $ Target: $400
 0% 

[SOLVED]AWP & SCOUT fast switch (How to get user fov)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Costin83
Senior Member
Join Date: Jul 2008
Location: Romania
Old 02-05-2009 , 07:47   [SOLVED]AWP & SCOUT fast switch (How to get user fov)
Reply With Quote #1

What's wrong with this code ?
Pls. HELP ! ! !

I want to force fast-switching of AWP/SCOUT only when are zoomed

Code:
#include <amxmodx>
#include <engine>
new bool:g_switch
public switch_t(id)
{
 g_switch = false
}
public switch_f(id)
{
 g_switch = true
}
public eCurWeapon(id)
{
 static weapon, clip, ammo
 weapon = get_user_weapon(id, clip, ammo)
 switch (weapon)
 {
  case 3,18:
  {
   if(!g_switch)
   {
    if((get_user_button(id) & IN_ATTACK))
     client_cmd(id, "lastinv;lastinv")
   }
  }
 }
 return PLUGIN_CONTINUE
}
public plugin_init()
{
 register_plugin("fast_zoom", "1.0", "80T")
 register_event("CurWeapon", "eCurWeapon", "be", "1=1")
 register_event("SetFOV", "switch_t", "be", "1<90")
 register_event("SetFOV", "switch_f", "be", "1=90")
 
 return   PLUGIN_CONTINUE
}
And this is the simple version (working )

Code:
#include <amxmodx>
#include <cstrike>
#include <engine>
public eCurWeapon(id)
{
 static weapon, clip, ammo
 weapon = get_user_weapon(id, clip, ammo)
 switch (weapon)
 {
  case 3,18:
  {
   if((get_user_button(id)&IN_ATTACK))
    client_cmd(id,"lastinv;lastinv")
  }
 }
 return PLUGIN_CONTINUE
}
public plugin_init()
{
 register_plugin("fast_zoom", "1.0", "80T")
 register_event("CurWeapon", "eCurWeapon", "be", "1=1")
 
 return   PLUGIN_CONTINUE
}
Copy/paste some code from here and there and now it works like it should !

Code:
#define PLUGIN_NAME "Fast Zoom"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "80T"
#include <amxmodx>
#include <engine>
#include <fakemeta>
#define FOV_DEFAULT 90
#define FOV_ZOOM_X3 15
public plugin_init()
{
 register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
 register_forward(FM_PlayerPostThink, "fwPlayerPostThink")
}
public fwPlayerPostThink(id)
{
 static fov
 if ((fov = pev(id, pev_fov)) >= FOV_DEFAULT || !fov)
  return FMRES_IGNORED
 static weapon, clip, ammo
 weapon = get_user_weapon(id, clip, ammo)
 switch (weapon)
 {
  case 3,18:
  {
   if ((get_user_button(id)&IN_ATTACK))
    set_task(0.1, "task_1", id)
  }
 }
 return FMRES_IGNORED
}
public task_1(id)
{
 client_cmd(id, "slot3")
 set_task(0.1, "task_2", id)
}
public task_2(id)
{
 client_cmd(id, "slot1")
}
Credits: VEN for his plugin "zoom_info" from which I've copied most of the code
And SuicideDog for his plugin "Sniper Realism" copied some code from him either

Last edited by Costin83; 02-07-2009 at 04:10.
Costin83 is offline
Send a message via Yahoo to Costin83
 



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 01:38.


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