Raised This Month: $ Target: $400
 0% 

Help with my Anti Team Flash Script


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kitami
Senior Member
Join Date: Jun 2006
Location: Toronto
Old 08-31-2008 , 21:52   Help with my Anti Team Flash Script
Reply With Quote #1

I was wondering if someone could help me out with this script, all it does it remove the ability to team flash admins in the server.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>


#define PLUGIN "No Admin Flash"
#define VERSION "1.0"
#define AUTHOR "Grim" /* credit to KRoT@L */

#define GOT_ACCES ADMIN_LEVEL_B

new g_msgScreenFadegrenade[32], last;
new 
Float:g_gametimeg_owner;
new 
g_sync_check_data 0;
new 
Float:g_gametime2;
new 
bool:g_track[33] = false;
new 
bool:g_track_enemy false;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("ScreenFade""eventFlash""be""4=255""5=255""6=255""7>199")
    
register_event("TextMsg""fire_in_the_hole""b""2&#Game_radio""4&#Fire_in_the_hole")
    
register_event("TextMsg""fire_in_the_hole2""b""3&#Game_radio""5&#Fire_in_the_hole")
    
register_event("99""grenade_throw""b")
}

/// NoFlash Blinding - Start
public bad_fix2()
{
    new 
Float:gametime get_gametime()
    if(
gametime g_gametime2 2.5)
    {
        for(new 
032i++)
        {
            
grenade[i] = 
        
}
    }
}

public 
eventFlash(id)  
{
  new 
Float:gametime get_gametime()
  if(
gametime != g_gametime)
  { 
    
g_owner get_grenade_owner()
    
g_gametime gametime  
    
for(new 033i++) 
    {
        
g_track[i] = false
    
}
    
g_track_enemy false
  
}    
  if(
is_user_connected(g_owner) && get_user_flags(id) & GOT_ACCES)
  {
          
g_track_enemy true

          message_begin
(MSG_ONEg_msgScreenFade, {0,0,0}, id)
          
write_short(1)
          
write_short(1)
          
write_short(1)
          
write_byte(0)
          
write_byte(0)
          
write_byte(0)
          
write_byte(255)
          
message_end()
  }
}

public 
flash_delay()
{
if(
g_track_enemy == false
    for(new 
033i++) 
        if(
g_track[i] == true && is_user_connected(i))
        {
          
message_begin(MSG_ONEg_msgScreenFade, {0,0,0}, i
          
write_short(1)
          
write_short(1)
          
write_short(1)
          
write_byte(0)
          
write_byte(0)
          
write_byte(0)
          
write_byte(255
          
message_end()
        }
}

public 
grenade_throw() 
{
    if(
g_sync_check_data == 0)
        return 
PLUGIN_CONTINUE
    g_sync_check_data
--;
    if(
read_datanum() < 2)
    return 
PLUGIN_HANDLED_MAIN

    
if(read_data(1) == 11 && (read_data(2) == || read_data(2) == 1))
    { 
        
add_grenade_owner(last)
    }

    return 
PLUGIN_CONTINUE 
}

public 
fire_in_the_hole()
{
    new 
name[32]
    
read_data(3name31
    new 
temp_last get_user_index(name
    new 
junk
    
if((temp_last == 0) || (!is_user_connected(temp_last)))
        return 
PLUGIN_CONTINUE;
    if(
get_user_weapon(temp_last,junk,junk) == CSW_FLASHBANG
    {
        
last temp_last
        g_sync_check_data 
2
    }
    return 
PLUGIN_CONTINUE  
}

public 
fire_in_the_hole2() 
{
    new 
name[32]
    
read_data(4name31)
    new 
temp_last get_user_index(name)   
    new 
junk
    
if((temp_last == 0) || (!is_user_connected(temp_last)))
        return 
PLUGIN_CONTINUE
    if(
get_user_weapon(temp_last,junk,junk) == CSW_FLASHBANG
    {    
        
last temp_last
        g_sync_check_data 
2;
    }
    return 
PLUGIN_CONTINUE
}

add_grenade_owner(owner)
{
    new 
Float:gametime get_gametime()
    
g_gametime2 gametime
    
for(new 032i++)
    {
        if(
grenade[i] == 0)
    {
            
grenade[i] = owner
            
return
        }
    }
}

get_grenade_owner()
{
    new 
which grenade[0]
    for(new 
132i++)  
    {
        
grenade[i-1] = grenade[i
    }
    
grenade[31] = 0
    
return which
}

//from XxAvalanchexX "Flashbang Dynamic Light"
public fw_emitsound(entity,channel,const sample[],Float:volume,Float:attenuation,fFlags,pitch)  
{
    
// not a flashbang exploding
    
if(!equali(sample,"weapons/flashbang-1.wav") && !equali(sample,"weapons/flashbang-2.wav"))
        return 
FMRES_IGNORED;

    new 
Float:gametime get_gametime()

    
//in case no one got flashed, the sound happens after all the flashes, same game time
    
if(gametime != g_gametime)
    {
        
g_owner get_grenade_owner()
        return 
FMRES_IGNORED;
    }

    return 
FMRES_IGNORED;

__________________
You know what I'd like to be? I mean if I had my goddamn choice, I'd just be the catcher in the rye and all.

Last edited by Kitami; 08-31-2008 at 21:58.
Kitami is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 08-31-2008 , 21:59   Re: Help with my Anti Team Flash Script
Reply With Quote #2

what would you like it to do/what is going wrong?
Quote:
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-01-2008 , 00:26   Re: Help with my Anti Team Flash Script
Reply With Quote #3

This is a bad idea to work with throw time, there are few plugins there you can have a look (i guess NumB's one works fine)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
zwfgdlc
Senior Member
Join Date: May 2006
Old 09-01-2008 , 00:46   Re: Help with my Anti Team Flash Script
Reply With Quote #4

http://forums.alliedmods.net/showthread.php?t=63685
zwfgdlc is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 09-01-2008 , 02:46   Re: Help with my Anti Team Flash Script
Reply With Quote #5

xD sorry but this code from hns shop, and there this works fine
__________________
xPaw is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-01-2008 , 11:31   Re: Help with my Anti Team Flash Script
Reply With Quote #6

Quote:
Originally Posted by xPaw View Post
xD sorry but this code from hns shop, and there this works fine
Wrong, the teamflash detection is terrible and give fals results (cf team flash snitch) + it reset player hud if this player is already flashed by another nade unless you hook the message with register_message, so it's really bad.


Right detection ways are :

http://forums.alliedmods.net/showthread.php?p=619324
http://forums.alliedmods.net/showthread.php?p=596743
http://forums.alliedmods.net/showthread.php?p=573133

The only no-team-flash way is NumB way.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 09-01-2008 at 11:41.
ConnorMcLeod is offline
Kitami
Senior Member
Join Date: Jun 2006
Location: Toronto
Old 09-19-2008 , 17:03   Re: Help with my Anti Team Flash Script
Reply With Quote #7

Well what I wanted was have this setup so only admins cant get team flashed by flashes. Sorry I took so long to reply Ive been really busy thanks guys
__________________
You know what I'd like to be? I mean if I had my goddamn choice, I'd just be the catcher in the rye and all.
Kitami is offline
Reply



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 03:15.


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