Raised This Month: $ Target: $400
 0% 

change zoom mode


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
abē
Member
Join Date: Dec 2008
Old 12-29-2008 , 14:52   change zoom mode
Reply With Quote #1

hi there

im here since a week cause i want to customize my cs a little

the code is very hard to learn cause all these shorts and idīs

but i tried my luck and copy/paste of other codes together but it doesnt work correctly

this plugin should be able to activate and de-activate an other Zoom-Option for the weapon AWP with "awp_smoothzoom 0/1"

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

#define PLUGIN "AWP Smooth Zoom"
#define VERSION "0.1"
#define AUTHOR "ab2"



public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("CurWeapon","awp_smoothzoom","be","1=1","2=18")
    
register_cvar("awp_smoothzoom""1")
}
   
public 
awp_smoothzoom(id)
{
    if(
is_user_alive(id) == 0)
        return 
PLUGIN_HANDLED
        
        
if(cs_get_user_zoom(id) == CS_SET_FIRST_ZOOM)
        
cs_set_user_zoom (id,CS_SET_AUGSG552_ZOOM,1)
        
        else(
cs_get_user_zoom(id) == CS_SET_NO_ZOOM)
        return 
PLUGIN_HANDLED 

But my problem is now
if i zoom with awp first time i get the "normal" zoom-view with the black corners and the big crosshair
after shooting 1 bullet and switching automaticly back to zoom-mode the black corners will leave but the big crosshair stays -_-

i want, that all the time there is no big crosshair and no black corners

is that possible?


greetings abē
__________________
+ Karma if helped! Thanks!
abē is offline
abē
Member
Join Date: Dec 2008
Old 12-30-2008 , 06:46   Re: change zoom mode
Reply With Quote #2

anyone can help me?
__________________
+ Karma if helped! Thanks!
abē is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 12-30-2008 , 06:58   Re: change zoom mode
Reply With Quote #3

You are only allowed to bump after 2 weeks(read the rules). I haven't done with these zooms but if you wanted that user can't zoom, I guess it would be...
Code:
if(cs_get_user_zoom(id) != 1)
       cs_set_user_zoom(id, 1, 0);
Edit: Oh, you wanted it with awp cvar... Then you do (with pcvars, you should use them)
Code:
new my_cvar;
 
public plugin_init()
    my_cvar = register_cvar("awp_cvar", "1");
public function()
//When you use it here, read it like this:
new value = get_pcvar_num(my_cvar);
if(value == 1)
  //do your thingys

Last edited by SnoW; 12-30-2008 at 07:05.
SnoW is offline
Send a message via MSN to SnoW
abē
Member
Join Date: Dec 2008
Old 12-30-2008 , 10:11   Re: change zoom mode
Reply With Quote #4

oh sry, i dont know i will respect these rules next time! thanks 4 advice


i think you dont understand my reason for this plugin

i want the aug/sg522 zoom for awp weapon!

with the code in my 1. post i get this

http://flickcabin.com/public/view/17067


short video packed in gif-file

___


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

#define PLUGIN "AWP Smooth Zoom"
#define VERSION "0.1"
#define AUTHOR "ab2"

new register
new awp
new awp2

public plugin_init() 
{
    
register register_plugin(PLUGINVERSIONAUTHOR)
    
awp register_cvar("awp_change""1")
    
awp2 register_event("CurWeapon","awp_change","be","1=1","2=18")
}
   
public 
awp_change(id)
{
    new 
value get_pcvar_num(awp_change);
    if(
value == 1)
        {
            if(
is_user_alive(id) == 0)
            return 
PLUGIN_HANDLED
            
}
        
            {
                if(
cs_get_user_zoom(id) == CS_SET_FIRST_ZOOM)
                
cs_set_user_zoom (id,CS_SET_AUGSG552_ZOOM,1)
            }
        
        else(
cs_get_user_zoom(id) == CS_SET_NO_ZOOM)
        return 
PLUGIN_HANDLED 

sry but i dont know pcvar and with this code i get errors like
symbol is assigned a value that is never used: "register"

im stumped for an answer (translation from german to english ^^)
__________________
+ Karma if helped! Thanks!

Last edited by abē; 12-30-2008 at 10:14.
abē is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 12-30-2008 , 10:49   Re: change zoom mode
Reply With Quote #5

I think something like this would be the thing:
Though I think CurWeapon can't work like that.

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
 
#define PLUGIN "AWP Smooth Zoom"
#define VERSION "0.1"
#define AUTHOR "ab2"
new awp;
public plugin_init() 
{
register_plugin(PLUGIN, VERSION, AUTHOR)
awp = register_cvar("awp_change", "1")
register_event("CurWeapon","function","be","1=1","2=18")
}
 
public function(id)
{
      if(!is_user_alive(id))
           return PLUGIN_HANDLED
   if(get_pcvar_num(awp))
   {
          new value = cs_get_user_zoom(id);
          if(value == 2 || value == 3)cs_set_user_zoom (id, 4, 1);
   }
  return PLUGIN_HANDLED
}

Last edited by SnoW; 01-23-2009 at 09:14.
SnoW is offline
Send a message via MSN to SnoW
abē
Member
Join Date: Dec 2008
Old 12-30-2008 , 14:43   Re: change zoom mode
Reply With Quote #6

thanks for your help so far

but your code takes the same effect like the code without pcvar


still have the transparently circle with the big crosshair in 1. zoom and after shooting the hole screen is clean only the big crosshair is still there

is it possible to clean up both from the first zoom till server will burned up (or will be turned off ^^)
__________________
+ Karma if helped! Thanks!
abē is offline
abē
Member
Join Date: Dec 2008
Old 01-22-2009 , 16:28   Re: change zoom mode
Reply With Quote #7

*bump*
__________________
+ Karma if helped! Thanks!
abē is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 01-23-2009 , 09:18   Re: change zoom mode
Reply With Quote #8

CurWeapon is called when it updates the weapon's ammo "icons". So changing zoom, won't effect to it. -> It's still updated when you shoot.
You should probably check it in prethink if you don't figure out better method. Though didn't understand what happened, but I think it's not necessary here.
SnoW is offline
Send a message via MSN to SnoW
abē
Member
Join Date: Dec 2008
Old 01-24-2009 , 16:07   Re: change zoom mode
Reply With Quote #9

could you give an example for use prethink - would be great!
__________________
+ Karma if helped! Thanks!
abē is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 01-24-2009 , 16:47   Re: change zoom mode
Reply With Quote #10

Quote:
Originally Posted by abē View Post
could you give an example for use prethink - would be great!
Are we sure there isn't better way?
Code:
/*
 Who said I should use engine?!
*/
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#define PLUGIN "Ab2's AWESOME zoom plugin"
#define VERSION "1.0"
#define AUTHOR "What a hey"
public plugin_init() 
{
 register_plugin(PLUGIN, VERSION, AUTHOR);
 register_forward(FM_PlayerPreThink, "PreThink");
}
public PreThink(id)
{
 if(!is_user_alive(id))
  return FMRES_IGNORED;
 new dummy, more_dummy, weapon;
 weapon = get_user_weapon(id, dummy, more_dummy);
 if(weapon != CSW_AWP)
  return FMRES_IGNORED;
 /* If you wanted that awp zooms like aug*/
 if(cs_get_user_zoom(id) == CS_SET_FIRST_ZOOM || cs_get_user_zoom(id) == CS_SET_SECOND_ZOOM)
  cs_set_user_zoom(id, CS_SET_AUGSG552_ZOOM, 1); 
 return FMRES_IGNORED;
}
SnoW is offline
Send a message via MSN to SnoW
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 09:16.


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