AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Burst/Silencer Blocker (https://forums.alliedmods.net/showthread.php?t=99514)

Alucard^ 08-06-2009 09:35

Burst/Silencer Blocker
 
2 Attachment(s)
Hi, well here is my RLY first plugin...

Description:

With this plugin you can block the Burst Fire (that GLOCK18 and FAMAS have) and Silencer too (that USP and M4A1 have). Some ppl ask me... "why i want to block silencer or burst fire", well... i dont know but why i want to block a command like KILL? (like others plugins)... Some ppl need that for some MODS... this is the same... maybe you have a mod that for some reasons you want to block the silencer and/or the burst fire... so this plugin is for this.

Commands:
  • !silencer: Show in chat if the silencer is blocked (in wich weapon is blocked too).
  • /silencer: Show in chat if the silencer is blocked (in wich weapon is blocked too).
  • !burst: Show in chat if the burst fire is blocked (in wich weapon is blocked too).
  • /burst: Show in chat if the burst fire is blocked (in wich weapon is blocked too).
Cvars:
  • block_burst (Default: 0)
    • 0: Dont block the burst fire in any weapon.
    • 1: Block the burst fire only in GLOCK18.
    • 2: Block the burst fire only in FAMAS.
    • 3: Block the burst fire in two weapons.
  • block_sil (Default: 0)
    • 0: Dont block the silencer in any weapon.
    • 1: Block the silencer only in USP.
    • 2: Block the silencer only in M4A1.
    • 3: Block the silencer in two weapons.
  • fade_enable (Default: 0)
    • 0: Disable Screen Fade.
    • 1: Enable Screen Fade.
  • fade_burstcolor (Default: "255 0 0")
    • Color of the Screen Fade when the burst fire is blocked.
  • fade_silcolor (Default: "0 255 255")
    • Color of the Screen Fade when the silencer is blocked.
  • fade_alpha (Default: "20")
    • The transparency amount of the Screen Fade.
Credits:

Exolent[jNr] - +attack2 detection
crazyeffect - ML

Changelog:
  • Version 1.0
    • First Release.
  • Version 1.1
    • Added ML.
    • Added chat color.
    • Added ScreenFade (with cvars).
Multilingual:

Quote:

[EN] - Alucard^
[ES] - Alucard^
[NL] - crazyeffect
[PL] - MmikiM
[FR] - die-demoneye
[DE] - D o o m
[SV] - Afro-Ankan
[RO] - benn1907
[LT] - Kukulis :*
Image

Multilingual Thread: http://forums.alliedmods.net/showthread.php?t=99528

Sry for my english.

Arkshine 08-06-2009 09:43

Re: Burst/Silencer Blocker
 
A lot more efficient way would be to use the weapon offset m_flNextSecondaryAttack so you would not need FM_CmdStart. If you don't know how, tell me.

crazyeffect 08-06-2009 11:53

Re: Burst/Silencer Blocker
 
Cool :P

Alucard^ 08-06-2009 13:27

Re: Burst/Silencer Blocker
 
Quote:

Originally Posted by Arkshine (Post 891665)
A lot more efficient way would be to use the weapon offset m_flNextSecondaryAttack so you would not need FM_CmdStart. If you don't know how, tell me.

Well... i tried with a code that you posted:

PHP Code:

#include <hamsandwich>
#include <fakemeta>

const m_flNextSecondaryAttack 47

new p_BlockSil

public plugin_init() 
{
    
register_plugin"Block M4A1 Secondary Attack""1.0""Amxx Community" )
    
    
p_BlockSil register_cvar("block_sil""0")
    
    
RegisterHamHam_Weapon_PrimaryAttack"weapon_m4a1" "Event_BlockSecondaryAttack" )
    
RegisterHamHam_Item_Deploy "weapon_m4a1" "Event_BlockSecondaryAttack")
}

public 
Event_BlockSecondaryAttack ( const Entity )
{
    if(!
get_pcvar_num(p_BlockSil) )
        return 
HAM_SUPERCEDE
    set_pdata_float
Entity m_flNextSecondaryAttack 9999.0)
    return 
HAM_IGNORED


But this code have some bugs... for example...

1: block_sil 0 default (i can use +attack2, good)
2: change block_sil to 1 (i have to change to another weapon and then come back to M4A1 to block the +attack2 command)
3: now if i go back to block_sil 0 (i have to do sv_restart to unblock the +attack2 in M4A1)

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

Update

Quote:

  • Version 1.1
    • Added ML.
    • Added chat color.
    • Added ScreenFade (with cvars).


Exolent[jNr] 08-06-2009 13:36

Re: Burst/Silencer Blocker
 
Quote:

Originally Posted by Alucard^ (Post 891807)
But this code have some bugs... for example...

1: block_sil 0 default (i can use +attack2, good)
2: change block_sil to 1 (i have to change to another weapon and then come back to M4A1 to block the +attack2 command)
3: now if i go back to block_sil 0 (i have to do sv_restart to unblock the +attack2 in M4A1)

Or, you could also just cache the value every round in a global variable so that these bugs don't occur and so that it is a little less cpu intensive.
Besides, how often is an admin going to change the value of these cvars?

Arkshine 08-06-2009 13:55

Re: Burst/Silencer Blocker
 
There is also the solution to use a command to act like a cvar, so if a new value is given you could update right away.

MmikiM 08-06-2009 14:12

Re: Burst/Silencer Blocker
 
Code:

[pl]
BF_NOT_BLOCKED = Tryb strzelania seria nie jest zablokowany.
BF_BLOCKED_FOR = Tryb strzelania seria jest zablokowany tylko dla %s.
BF_BLOCKED_BOTH = Tryb strzelania seria jest zablokowany dla %s i %s.
S_NOT_BLOCKED = Tlumik nie jest zablokowany.
S_BLOCKED_FOR = Tlumik jest zablokowany tylko dla %s.
S_BLOCKED_BOTH = Tlumik jest zablokowany dla %s i %s.
BF_YOUR_WEAPON = Tryb strzelania seria jest zablokowany dla borni, ktora masz.
S_YOUR_WEAPON = Tlumik jest zablokowany dla broni, ktora masz.

Polish translate :up:

Alucard^ 08-06-2009 15:29

Re: Burst/Silencer Blocker
 
*Credits added.
*ML Thread added
*PL translate added

Quote:

Originally Posted by Exolent[jNr] (Post 891822)
Or, you could also just cache the value every round in a global variable so that these bugs don't occur and so that it is a little less cpu intensive.

Thx, i have to see that.

Quote:

Originally Posted by Exolent[jNr] (Post 891822)
Besides, how often is an admin going to change the value of these cvars?

Yes i know but i think if i can fix all bugs, is better =p

Quote:

Originally Posted by Arkshine (Post 891833)
There is also the solution to use a command to act like a cvar, so if a new value is given you could update right away.

Sry but i didnt understand at all, can you give me an example?

Exolent[jNr] 08-06-2009 15:34

Re: Burst/Silencer Blocker
 
It's basically my method with a global variable, except the you use commands instead of cvars, so you know when the value is changed, so then you could update the value for other players weapons.

Kukulis :* 08-08-2009 08:44

Re: Burst/Silencer Blocker
 
Lithuanian
Code:

[lt]
BF_NOT_BLOCKED = Sprogimo ugnis nera blokuota.
BF_BLOCKED_FOR = Sprogimo ugnis yra blokuota tik %s.
BF_BLOCKED_BOTH = Sprogimo ugnis yra blokuota tik %s ir %s.
S_NOT_BLOCKED = Slopintuvas nera blokuotas.
S_BLOCKED_FOR = Slopintuvas yra blokuota tik %s.
S_BLOCKED_BOTH = Slopintuvas yra blokuota tik %s ir %s.
BF_YOUR_WEAPON = Sprogimo ugnis yra blokuota ginklui, kuri jus turite.
S_YOUR_WEAPON = Slopintuvas yra blokuotas ginklui, kuri jus turite.



All times are GMT -4. The time now is 03:30.

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