AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with my Anti Team Flash Script (https://forums.alliedmods.net/showthread.php?t=76862)

Kitami 08-31-2008 21:52

Help with my Anti Team Flash Script
 
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;



Emp` 08-31-2008 21:59

Re: Help with my Anti Team Flash Script
 
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.

ConnorMcLeod 09-01-2008 00:26

Re: Help with my Anti Team Flash Script
 
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)

zwfgdlc 09-01-2008 00:46

Re: Help with my Anti Team Flash Script
 
http://forums.alliedmods.net/showthread.php?t=63685

xPaw 09-01-2008 02:46

Re: Help with my Anti Team Flash Script
 
xD sorry but this code from hns shop, and there this works fine

ConnorMcLeod 09-01-2008 11:31

Re: Help with my Anti Team Flash Script
 
Quote:

Originally Posted by xPaw (Post 679455)
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.

Kitami 09-19-2008 17:03

Re: Help with my Anti Team Flash Script
 
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 :)


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

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