AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   change zoom mode (https://forums.alliedmods.net/showthread.php?t=82767)

abē 12-29-2008 14:52

change zoom mode
 
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 :P

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ē

abē 12-30-2008 06:46

Re: change zoom mode
 
anyone can help me? :(

SnoW 12-30-2008 06:58

Re: change zoom mode
 
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


abē 12-30-2008 10:11

Re: change zoom mode
 
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/pthumbs/small/...awp_change.gifhttp://flickcabin.com/pthumbs/small/...awp_change.gifhttp://flickcabin.com/public/view/17067
http://flickcabin.com/pthumbs/small/...awp_change.gif

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 ^^)

SnoW 12-30-2008 10:49

Re: change zoom mode
 
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
}


abē 12-30-2008 14:43

Re: change zoom mode
 
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 ^^)

abē 01-22-2009 16:28

Re: change zoom mode
 
*bump*

SnoW 01-23-2009 09:18

Re: change zoom mode
 
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.

abē 01-24-2009 16:07

Re: change zoom mode
 
could you give an example for use prethink - would be great!

SnoW 01-24-2009 16:47

Re: change zoom mode
 
Quote:

Originally Posted by abē (Post 749453)
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;
}



All times are GMT -4. The time now is 09:16.

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