Raised This Month: $23 Target: $400
 5% 

Weapon Max Shot Distance


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands        Approver:   ConnorMcLeod (74)
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 10-14-2011 , 17:56   Weapon Max Shot Distance
Reply With Quote #1

Weapon Max Shot Distance

By: nikhilgupta345

Description:
This plugin allows you to limit the maximum distance a player can be with a certain weapon to hit a player.


CVars:
    • max_distance_* - Max distance players can be to hit opponent with specified weapon

      Possible Values for * are:

      • p228
      • scout
      • xm1014
      • mac10
      • aug
      • elite
      • fiveseven
      • ump45
      • sg550
      • galil
      • famas
      • usp
      • glock18
      • awp
      • mp5navy
      • m249
      • m3
      • m4a1
      • tmp
      • g3sg1
      • deagle
      • sg552
      • ak47
      • p90

Installation:
    • Click 'Get Plugin' link below
    • Place 'max_shot_distance.amxx' in addons/amxmodx/plugins/ folder
    • Open addons/amxmodx/configs/plugins.ini
    • Add the line 'max_shot_distance.amxx' at the bottom
    • Add CVARs you want to amxx.cfg. All cvars default to 0, meaning that they are inactive and players can be hit with that weapon from anywhere
    • Restart server or change map


Changelog:

  • Code:
    October 14, 2011
    • -v1.0-
      • Initial Release

Notes:
    • The distances tend to be very high numbers. For example, setting a weapon to 200 units is about the distance from the box at mid on de_dust2 to the mid doors. (The boxes in front of the entrance to lower tunnels).
    • The distance between players if they are touching I think is ~35 or so.
Attached Files
File Type: sma Get Plugin or Get Source (max_shot_distance.sma - 1430 views - 3.2 KB)
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please

Last edited by nikhilgupta345; 10-21-2011 at 17:10.
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
F0RCE
Senior Member
Join Date: Oct 2010
Old 10-14-2011 , 18:03   Re: Weapon Max Shot Distance
Reply With Quote #2

Good work, as always
F0RCE is offline
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 10-14-2011 , 23:06   Re: Weapon Max Shot Distance
Reply With Quote #3

STOP RELEASING SO MANY PLUGINS
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 10-14-2011 , 23:25   Re: Weapon Max Shot Distance
Reply With Quote #4

Quote:
Originally Posted by DarkGod View Post
STOP RELEASING SO MANY PLUGINS
Lol
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 10-15-2011 , 01:41   Re: Weapon Max Shot Distance
Reply With Quote #5

Quote:
Originally Posted by DarkGod View Post
STOP RELEASING SO MANY PLUGINS
but true
__________________
Preparing to release my plugins..
r0ck is offline
eskemo
Senior Member
Join Date: Dec 2008
Location: Australia
Old 10-15-2011 , 18:09   Re: Weapon Max Shot Distance
Reply With Quote #6

Ooh this Looks pretty cool Would go well on a zombie mod server. ;)
__________________


Free Australian FASTDL Server PM ME
eskemo is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 10-15-2011 , 23:36   Re: Weapon Max Shot Distance
Reply With Quote #7

Quote:
Originally Posted by eskemo View Post
Ooh this Looks pretty cool Would go well on a zombie mod server. ;)
Very true.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
SyluxLockjaw100
Senior Member
Join Date: Jul 2010
Location: Novaya Russia
Old 10-16-2011 , 09:58   Re: Weapon Max Shot Distance
Reply With Quote #8

This should nerf overpowered-shotguns abit on my server abit. Great plugin thanks.
SyluxLockjaw100 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-17-2011 , 01:31   Re: Weapon Max Shot Distance
Reply With Quote #9

RegisterCVars function doesn't need to be public
g_szWeaponClassnames shouldn't be global, declare it in RegisterCVars function so memory is free when you exit the function.



i < MAX_WEAPON + 1
i <= MAX_WEAPON would make more sense



Little tip :
PHP Code:
            formatexszCVarNamecharsmaxszCVarName ), "max_distance_%s"g_szWeaponClassnames] );
            
            
replaceszCVarNamecharsmaxszCVarName ), "weapon_""" ); 
->
PHP Code:
            formatexszCVarNamecharsmaxszCVarName ), "max_distance_%s"g_szWeaponClassnames][ ] ); 


PHP Code:
        static Float:flAttackerOrigin];
        static 
Float:flVictimOrigin]; 
Static is not needed at all there.



Code:
        if( !g_pWeaponCVARs[ iWeapon ] )
            return HAM_IGNORED;        
        new iMaxDistance = get_pcvar_num( g_pWeaponCVARs[ iWeapon ] );
You read 2 times the same array, would be better to cache pointer result.



DMG_HEGRENADE check is useless, it will never happen.






Your plugin only allow to lower default weapon distance, and not to raise it.
With orpheu you could lower or raise this distance, and you could also change bullets penetration (number of times a bullet can go thru a wall).
So your way is very limitated.
__________________
- tired and retired -
ConnorMcLeod is offline
andrefly1
Member
Join Date: Jul 2011
Location: Portugal
Old 10-17-2011 , 02:14   Re: Weapon Max Shot Distance
Reply With Quote #10

Good plugin..
__________________
PokemodPT Server: 188.93.232.170413
Visit


andrefly1 is offline
Send a message via MSN to andrefly1
Reply


Thread Tools
Display Modes

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 14:10.


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