Raised This Month: $12 Target: $400
 3% 

Team Flash Punish v1.1.1 ( 28jan12 )


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Gameplay        Approver:   Hawk552 (427)
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-14-2008 , 13:23   Team Flash Punish v1.1.1 ( 28jan12 )
Reply With Quote #1

Team Flash Punish




.: Description :.

This plugin punishes players who flash their teamates.


.: Features :.

- Restrict a player from throwing flash nades
- Punish a player who flashes his teamates


.: Cvars :.

  • tfp_count < Flags >
    Count Type: Flags are additive (default : 3)
    • 0: Don't count
    • 1: Count semi flash
    • 2: Count full flash
    • 4: Also count when flasher is dead
  • tfp_max_count < X >
    Restrict a player from throwing flash nades after X counted teamflash (see previous cvar) (def:10)
  • tfp_punish < Flags >
    Punish Type: Flags are additive (default : 2)
    • 0: Don't punish
    • 1: Health reduction
    • 2: Money reduction
  • tfp_health_amount < amount >
    HPs reduction (def:5)
  • tfp_health_allow_kill < 0/1>
    When HP reduction is on, allow to kill player (def:0)
  • tfp_money_amount < amount >
    Dollars taken (def:200)



.: Modules/Api :.

  • Cstrike
  • Fakemeta
  • Hamsandwich
  • Nades Api


.: Changelog :.
Code:
v1.2.0 (26mar2012)
- Now requires nades api in oder to work

v1.1.1 (28jan2012)
- added cvar tfp_health_allow_kill
- little code adjustments 

v1.1.0 (13mar2010)
- rewritten the plugin from the scratch
- added cash redution
- change slap punishment into health reduction punishment
- block flash buy instead of throw

v1.0.2 (09may08)
- fixed server crash when remove flash nade entities

v1.0.1 (18mar08)
- fixed error not updating the flasher counter, but flashed's one :P

v1.0.0 (14mar08)
- First release


.: Notes :.


Install nades_api in order to make this plugin work (and compile) : https://forums.alliedmods.net/showth...79#post1920279



Attached Files
File Type: sma Get Plugin or Get Source (teamflash_punish.sma - 3736 views - 6.3 KB)
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 03-26-2013 at 02:21.
ConnorMcLeod is offline
Checkmarks
BANNED
Join Date: Sep 2007
Location: kentucky
Old 03-14-2008 , 15:43   Re: Team Flash Punish
Reply With Quote #2

looks cool
does it work with bots? like if they get flashed by me i dont want to be slapped lol..
can you make something where admins can teamflash and not get punished?
Checkmarks is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-14-2008 , 15:52   Re: Team Flash Punish
Reply With Quote #3

Quote:
Originally Posted by Checkmarks View Post
does it work with bots? like if they get flashed by me i dont want to be slapped lol..
I don't know if it works or not with bots.

Quote:
Originally Posted by Checkmarks View Post
can you make something where admins can teamflash and not get punished?
Wouldn't that be a little unfair ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
ali_zkz
Member
Join Date: Jan 2006
Old 03-14-2008 , 21:26   Re: Team Flash Punish
Reply With Quote #4

wowowa Nice Job,really iwiil try
ali_zkz is offline
Vm|Mayhem
Senior Member
Join Date: Feb 2005
Location: Murrieta, CA.
Old 03-15-2008 , 04:08   Re: Team Flash Punish
Reply With Quote #5

Great idea. I'll try it tomorrow.
Vm|Mayhem is offline
Send a message via AIM to Vm|Mayhem
adidas
BANNED
Join Date: Jan 2007
Old 03-15-2008 , 09:37   Re: Team Flash Punish
Reply With Quote #6

  • tfp_max_count < X >
    Restrict a player from throwing flash nades after X counted teamflash (see previous cvar) (def:10)

hello, nice plugin but i am interest does this restrict works
we put it on ours server and put count 5 and doesnt work
adidas is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-15-2008 , 09:48   Re: Team Flash Punish
Reply With Quote #7

Works on cs1.6 and on cs/cz, AFAIK
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Vm|Mayhem
Senior Member
Join Date: Feb 2005
Location: Murrieta, CA.
Old 03-15-2008 , 15:40   Re: Team Flash Punish
Reply With Quote #8

All they have to do is rejoin and the flashbang block is removed. Would it be possible to add a admin command to block a person from using flashbangs?
Vm|Mayhem is offline
Send a message via AIM to Vm|Mayhem
hoboman
Senior Member
Join Date: Jul 2007
Old 03-15-2008 , 20:20   Re: Team Flash Punish
Reply With Quote #9

I think this is a really good idea for a plugin ( although I haven't tried it yet), but it really should work like admin_gag...and by that I mean it should prevent the player from throwing/buying a flashbang for the next x rounds and check if he rejoins to escape this punishment
__________________
hoboman is offline
duszek89
New Member
Join Date: Mar 2008
Old 03-17-2008 , 18:26   Re: Team Flash Punish
Reply With Quote #10

Hi

Serious Bug:

Code:
g_iFlashTeamCount[id]++
If the flasher flashbanged someone, this count add flashteamcount to another people, not to him (my buddy confirmed it, he discovered it, he didn't use flashbangs, and he was often flashbanged by others, then he couldn't use a flashbang)

I think that it should be:
Code:
g_iFlashTeamCount[iFlasher]++
Additionally i added that everybody in your team (also dead, however it can be changed) see who flashbanged whom, and i changed that "you fully flashbanged xxx" only if you fully blinded him

Anyway, it's great plugin, thx

Final code:

Code:
/* AMX Mod X Plugin
* 
* (c) Copyright 2008, ConnorMcLeod 
* This file is provided as is (no warranties). 
* 
*/ 

#include <amxmodx>
#include <fakemeta>
#include <cstrike>

#define MAX_PLAYERS    32
#define OFFSET_TEAM    114

#define W_FLASH_MODEL_STRLEN        22
#define FLASH_XPLODE_SOUND_STRLEN    23

new g_iMaxClients
new g_iHasJustBeenFlashed[MAX_PLAYERS+1]
new g_iFlashTeamCount[MAX_PLAYERS+1]
new g_pcvarTeamFlash, g_pcvarMax, g_pcvarSlap, g_pcvarPunish

public plugin_init()
{
    register_plugin("Team Flash Punish", "1.0.0", "ConnorMcLeod")

    g_pcvarTeamFlash = register_cvar("tfp_count", "1")    // 0: don't count, 1:count only fully blinded, 2:count all flash
    g_pcvarMax = register_cvar("tfp_max_count", "6")        // disallow flashbang after X count
    g_pcvarPunish = register_cvar("tfp_slap", "1")        // 0: don't slap, 1:slap only fully blinded, 2:slap all flash
    g_pcvarSlap = register_cvar("tfp_slap_amount", "10")    // slap powaaaa

    register_event("ScreenFade", "Event_ScreenFade", "be", "4=255", "5=255", "6=255", "7=200", "7=255")
    register_forward(FM_SetModel, "Forward_SetModel")
    register_forward(FM_EmitSound, "Forward_EmitSound")
}

public plugin_cfg()
{
    g_iMaxClients = global_get(glb_maxClients)
}

public Forward_SetModel(iEntity, const szModel[])
{
    if(strlen(szModel) != W_FLASH_MODEL_STRLEN)
    {
        return FMRES_IGNORED
    }

    if(szModel[7] != 'w' || szModel[9] != 'f' || szModel[14] != 'b')
    {
        return FMRES_IGNORED
    }

    if(!pev_valid(iEntity))
    {
        return FMRES_IGNORED
    }

    static Float:fVelocity[3]
    pev(iEntity, pev_velocity, fVelocity)
    if(!fVelocity[0] && !fVelocity[1] && !fVelocity[2])
    {
        return FMRES_IGNORED
    }

    static iOwner, iMax
    iOwner = pev(iEntity, pev_owner)
    iMax = get_pcvar_num(g_pcvarMax)

    if(iMax && g_iFlashTeamCount[iOwner] >= iMax)
    {
        engfunc(EngFunc_RemoveEntity, iEntity)
        client_print(iOwner, print_center, "Your flashbanged your teammate too much time, now you cannot use flashbang")
        return FMRES_SUPERCEDE
    }

    set_pev(iEntity, pev_iuser4, iOwner)

    return FMRES_HANDLED
}

public Forward_EmitSound(iEntity, iChannel, const szSample[])
{
    if(strlen(szSample) != FLASH_XPLODE_SOUND_STRLEN)
    {
        return FMRES_IGNORED
    }

    if(szSample[0] != 'w' || szSample[8] != 'f' || szSample[9] != 'l')
    {
        return FMRES_IGNORED
    }

    if(!pev_valid(iEntity))
    {
        return FMRES_IGNORED
    }

    static iFlasher
    iFlasher = pev(iEntity, pev_iuser4)

    if(pev_valid(iFlasher) != 2)
        return FMRES_IGNORED

    static iCount, iPunish
    iCount = get_pcvar_num(g_pcvarTeamFlash)
    iPunish = get_pcvar_num(g_pcvarPunish)

    if(!iCount && !iPunish)
    {
        return FMRES_HANDLED
    }

    static iTeam, id, iFlashed
    iTeam = get_pdata_int(iFlasher, OFFSET_TEAM)
    new iFlasherName[32]
    get_user_name(iFlasher,iFlasherName,31)
    for(id=1; id<=g_iMaxClients; id++)
    {
        iFlashed = g_iHasJustBeenFlashed[id]
        if(!iFlashed)
            continue
        g_iHasJustBeenFlashed[id] = 0

        if(pev_valid(id) != 2)
            continue

        if(id != iFlasher && get_pdata_int(id, OFFSET_TEAM) == iTeam)
        {
            if( iCount && (iCount==2 || iFlashed==255) )
            {
                new iFlashedName[32]
                get_user_name(id,iFlashedName,31)
                new players[32],num
                if(cs_get_user_team(id) == CS_TEAM_CT)
                {
                get_players(players,num,"ae","CT")
                } else
                if(cs_get_user_team(id) == CS_TEAM_T)
                {
                get_players(players,num,"ae","TERRORIST")
                }
                client_print(0,print_chat,"%s fully flashbanged his teammate %s",iFlasherName,iFlashedName)
                g_iFlashTeamCount[iFlasher]++
                client_print(iFlasher, print_center, "You fully flashbanged your teammate, watch what are you doing!")
            }
            if( iPunish && (iPunish==2 || iFlashed==255) )
            {
                user_slap(iFlasher, get_pcvar_num(g_pcvarSlap), 0)
            }
            
        }    
    }
    return FMRES_HANDLED
}

public Event_ScreenFade(id)
{
    g_iHasJustBeenFlashed[id] = read_data(7)
}

public client_putinserver(id)
{
    g_iFlashTeamCount[id] = 0
    g_iHasJustBeenFlashed[id] = 0
}
duszek89 is offline
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 08:15.


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