AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Off-Topic (https://forums.alliedmods.net/forumdisplay.php?f=15)
-   -   First Time Using Google*s Bard - The Result (https://forums.alliedmods.net/showthread.php?t=342547)

WATCH_D0GS UNITED 04-22-2023 22:04

First Time Using Google*s Bard - The Result
 
INPUT

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <xs>

#define valid(id) (id == clamp(id,1,33))
#define NOSHOT (1<<0 | 1<<4 | 1<<6 | 1<<9 | 1<<25 | 1<<29)
#define num get_pcvar_num
#define ALIVE is_user_alive
#define WEAPON get_user_weapon
#define SNIPER ((1<<3 | 1<<13 | 1<<18 | 1<<24) & (1<<WEAPON(id)))
#define SNIPER_SCOPE (SNIPER && get_pdata_int(id,363) < 41)
#define ASSAULT_SCOPE ((1<<8 | 1<<27) & (1<<WEAPON(id)) && get_pdata_int(id,363) == 55)
#define GUN_FIRED (last_shot_b[id] != last_shot_a[id])
#define SHOTGUN ((1<<5 | 1<<21) & (1<<WEAPON(id)))
#define r_id pev(ent,pev_owner)

new P_Cvar[15],W_VAR[4][CSW_P90 1]
static 
CM,FM,last_shot_a[33],last_shot_b[33],bool:SHOOTING[33],TM,body,target,AM

public plugin_init() {
  
register_plugin("Aim Realism","2.3.9","WATCH_DOGS UNITED"    )
  
P_Cvar[0]  = register_cvar("aim__realism"           "1"    )
  
P_Cvar[1]  = register_cvar("aim_recoil"             "0.237")
  
P_Cvar[2]  = register_cvar("aim__snipers_crosshair" "1"    )
  
P_Cvar[3]  = register_cvar("aim__standard_crosshair""1"    )
  
P_Cvar[4]  = register_cvar("aim__static_crosshair"  "1"    )
  
P_Cvar[5]  = register_cvar("aim_spec_standard_cross""1"    )
  
P_Cvar[6]  = register_cvar("aim_spec_static_cross"  "1"    )
  
P_Cvar[7]  = register_cvar("aim_spec_snipers_cross" "1"    )
  
P_Cvar[8]  = register_cvar("aim_recoil__mode"       "1"    )
  
P_Cvar[9]  = register_cvar("aim_accuracy__mode"     "1"    )
  
P_Cvar[10] = register_cvar("aim_accuracy"           "9999" )
  
P_Cvar[11] = register_cvar("aim_crosshairs"         "1"    )
  
P_Cvar[12] = register_cvar("aim_shotgun_ac_map_ents""0"    )
  
P_Cvar[13] = register_cvar("aim__fov_control"       "1"    )
  
P_Cvar[14] = register_cvar("aim__fov"               "90"   )

  new 
weapon_name[20],rec_wname[21],acc_wname[23],stat_c_wname[23],stand_c_wname[28]
  for(new 
CSW_P228<= CSW_P90i++) {
    if(
get_weaponname(i,weapon_name,charsmax(weapon_name))) {
      
formatex(stat_c_wname,charsmax(stat_c_wname),"aim_%s_static_c",weapon_name[7])
      
formatex(stand_c_wname,charsmax(stand_c_wname),"aim_%s_standard_c",weapon_name[7])
      
W_VAR[2][i] = register_cvar(stat_c_wname,"1")
      
W_VAR[3][i] = register_cvar(stand_c_wname,"1")
      if(!(
NOSHOT & (1<<i))) {
        
formatex(rec_wname,charsmax(rec_wname),"aim_%s_recoil",weapon_name[7])
        
formatex(acc_wname,charsmax(acc_wname),"aim_%s_accuracy",weapon_name[7])
        
W_VAR[0][i] = register_cvar(rec_wname,"0.237")
        
W_VAR[1][i] = register_cvar(acc_wname,"9999")
        
RegisterHam(Ham_Weapon_PrimaryAttack,weapon_name,"Rec_Control",1)
      }
    }
  }
  
register_event("CurWeapon","Camera_Misc","b","1=1")
  
register_forward(FM_TraceLine,"fwTraceLine",1)
  
register_forward(FM_CmdEnd,"Refresh")
}

public 
plugin_cfg()
  
server_cmd("exec addons/amxmodx/configs/aim_realism.cfg")

public 
Camera_Misc(id) {
  if(
valid(id) && !SNIPER_SCOPE) {
    if(
num(P_Cvar[11])) {
      
CM 64
      
if(num(W_VAR[3][WEAPON(id)]))
        if(
num(P_Cvar[3]) && ALIVE(id) || num(P_Cvar[5]) && !ALIVE(id))
          
CM 0
      message_begin
(MSG_ONE_UNRELIABLE,get_user_msgid("HideWeapon"),_,id);
      
write_byte(CM);
      
message_end

      
if(num(W_VAR[2][WEAPON(id)])) {
        if(
num(P_Cvar[4]) &&  ALIVE(id) && !SNIPER
        
|| num(P_Cvar[2]) &&  ALIVE(id) &&  SNIPER
        
|| num(P_Cvar[6]) && !ALIVE(id) && !SNIPER
        
|| num(P_Cvar[7]) && !ALIVE(id) &&  SNIPER) {
          
message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("Crosshair"),_,id);
          
write_byte(1);
          
message_end
        
}
      }
    }
    if(
num(P_Cvar[13])) {
      
FM num(P_Cvar[14])
      if(
SNIPER && FM 90)
        
FM 90
      
if(ASSAULT_SCOPE)
        
FM 55
      message_begin
(MSG_ONE,get_user_msgid("SetFOV"),_,id);
      
write_byte(FM);
      
message_end
    
}
  }
}

public 
Refresh(id)
  if(
num(P_Cvar[0]) && valid(id))
    
last_shot_a[id] = get_pdata_int(id,220)

public 
fwTraceLine(const Float:start[3],Float:dest[3],HIT_PARAM,id,ptr) {
  if(
num(P_Cvar[0]) && valid(id)) {
    
last_shot_b[id] = get_pdata_int(id,220)
    if(
ALIVE(id) && !(NOSHOT & (1<<WEAPON(id))) && HIT_PARAM == DONT_IGNORE_MONSTERS && GUN_FIRED) {
      
SHOOTING[id] = true
      TM 
body
      
if(num(P_Cvar[12]))
        
TM target

      
if(!SHOTGUN || SHOTGUN && get_user_aiming(id,target,body,2000) && TM) {
        
AM num(W_VAR[1][WEAPON(id)])
        if(
num(P_Cvar[9]) == && !SHOTGUN)
          
AM num(P_Cvar[10])

        
velocity_by_aim(id,AM,dest)
        
xs_vec_add(start,dest,dest)
        
engfunc(EngFunc_TraceLine,start,dest,HIT_PARAM,id,ptr)
      }
    }
    else
      
SHOOTING[id] = false
  
}
}

public 
Rec_Control(ent,Float:push[3],Float:RM) {
  if(
SHOOTING[r_id] == true) {
    
RM get_pcvar_float(W_VAR[0][WEAPON(r_id)])
    if(
num(P_Cvar[8]) == 1)
      
RM get_pcvar_float(P_Cvar[1])

    
pev(r_id,pev_punchangle,push)
    
xs_vec_mul_scalar(push,RM,push)
    
set_pev(r_id,pev_punchangle,push)
  }


BARD*S RESPONSE

Code:

The code you provided is a plugin for the AMX Mod X gaming platform. It is designed to improve the accuracy of players' shots in the game Counter-Strike: Source.
 The plugin does this by tracking the player's weapon, recoil, and accuracy, and then adjusting the player's aim accordingly.

The plugin is written in the AMX Mod X scripting language. It makes use of a number of AMX Mod X functions, including:

* `register_plugin()`: Registers the plugin with the AMX Mod X server.
* `register_cvar()`: Registers a console variable with the AMX Mod X server.
* `get_user_weapon()`: Gets the weapon that the specified player is currently using.
* `get_pdata_int()`: Gets the integer value of a player-specific data field.
* `is_user_alive()`: Checks if the specified player is alive.
* `get_weaponname()`: Gets the name of the specified weapon.
* `message_begin()`: Sends a message to the specified player.
* `write_byte()`: Writes a byte of data to the message.
* `message_end()`: Ends the message.
* `register_event()`: Registers an event handler with the AMX Mod X server.
* `register_forward()`: Registers a forward with the AMX Mod X server.
* `get_pcvar_float()`: Gets the float value of a console variable.
* `pev()`: Gets the player-specific data for the specified entity.
* `set_pev()`: Sets the player-specific data for the specified entity.
* `xs_vec_add()`: Adds two vectors together.
* `xs_vec_mul_scalar()`: Multiplies a vector by a scalar value.

The plugin is well-written and easy to follow. It makes use of a number of AMX Mod X functions to improve the accuracy of players' shots in Counter-Strike: Source. The plugin is a valuable tool for players who want to improve their accuracy in the game.

https://bard.google.com/


-----------------------------------


All times are GMT -4. The time now is 00:07.

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