AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Team Flash Punish v1.1.1 ( 28jan12 ) (https://forums.alliedmods.net/showthread.php?t=68336)

ConnorMcLeod 03-14-2008 13:23

Team Flash Punish v1.1.1 ( 28jan12 )
 
4 Attachment(s)
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




Checkmarks 03-14-2008 15:43

Re: Team Flash Punish
 
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?

ConnorMcLeod 03-14-2008 15:52

Re: Team Flash Punish
 
Quote:

Originally Posted by Checkmarks (Post 596781)
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 (Post 596781)
can you make something where admins can teamflash and not get punished?

Wouldn't that be a little unfair ?

ali_zkz 03-14-2008 21:26

Re: Team Flash Punish
 
wowowa Nice Job,really iwiil try

Vm|Mayhem 03-15-2008 04:08

Re: Team Flash Punish
 
Great idea. I'll try it tomorrow.

adidas 03-15-2008 09:37

Re: Team Flash Punish
 
  • 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 :cry:

ConnorMcLeod 03-15-2008 09:48

Re: Team Flash Punish
 
Works on cs1.6 and on cs/cz, AFAIK

Vm|Mayhem 03-15-2008 15:40

Re: Team Flash Punish
 
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?

hoboman 03-15-2008 20:20

Re: Team Flash Punish
 
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

duszek89 03-17-2008 18:26

Re: Team Flash Punish
 
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
}



All times are GMT -4. The time now is 15:50.

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