#include < amxmodx >
#include <
cstrike >
#include < hamsandwich >
#pragma semicolon 1
#define PISTOL_WEAPONS_BIT (1<<CSW_GLOCK18|1<<CSW_USP|1<<CSW_DEAGLE|1<<CSW_P228|1<<CSW_FIVESEVEN|1<<CSW_ELITE)
#define SHOTGUN_WEAPONS_BIT (1<<CSW_M3|1<<CSW_XM1014)
#define SUBMACHINE_WEAPONS_BIT (1<<CSW_TMP|1<<CSW_MAC10|1<<CSW_MP5NAVY|1<<CSW_UMP45|1<<CSW_P90)
#define RIFLE_WEAPONS_BIT (1<<CSW_FAMAS|1<<CSW_GALIL|1<<CSW_AK47|1<<CSW_SCOUT|1<<CSW_M4A1|1<<CSW_SG550|1<<CSW_SG552|1<<CSW_AUG|1<<CSW_AWP|1<<CSW_G3SG1)
#define MACHINE_WEAPONS_BIT (1<<CSW_M249)
#define PRIMARY_WEAPONS_BIT (SHOTGUN_WEAPONS_BIT|SUBMACHINE_WEAPONS_BIT|RIFLE_WEAPONS_BIT|MACHINE_WEAPONS_BIT)
#define SECONDARY_WEAPONS_BIT (PISTOL_WEAPONS_BIT)
#define IsPrimaryWeapon(%1) ( (1<<%1) & PRIMARY_WEAPONS_BIT )
#define IsSecondaryWeapon(%1) ( (1<<%1) & PISTOL_WEAPONS_BIT )
new const //extras din nightcrawler.
PLUGIN_NAME[ ] = "AntiFurien Laser",
PLUGIN_VERSION[ ] = "1.0";
new const
PLUGIN_TAG[ ] = "|AntiFurien Laser:";
new g_iCvarCost;
new g_iCvarDuration;
new g_bUserHasLaser[ 33 ];
new g_iLaserSpr;
public plugin_precache( ) g_iLaserSpr = precache_model( "sprites/zbeam4.spr" );
public plugin_init( )
{
register_plugin
( //cod extras din nightcrawler si modificat pentru modul furien.
PLUGIN_NAME,
PLUGIN_VERSION,
"Askhanar"
);
g_iCvarCost = register_cvar( "afl_cost", "5000" );
g_iCvarDuration = register_cvar( "afl_duration", "1" );
RegisterHam( Ham_Spawn, "player", "ham_PlayerSpawnPost", true );
RegisterHam( Ham_Killed, "player", "ham_PlayerKilledPost", true );
register_clcmd( "say /aflaser", "ClCmdSayAfLaser" );
// Add your code here...
}
public plugin_natives()
{
register_native("give_laser","nativ_noideea",1);
}
public nativ_noideea(id) g_bUserHasLaser[ id ] = true;
public client_putinserver( id ) g_bUserHasLaser[ id ] = false;
public client_disconnect( id ) g_bUserHasLaser[ id ] = false;
public ham_PlayerSpawnPost( id )
{
if( !is_user_alive( id ) )
return;
if( get_pcvar_num( g_iCvarDuration ) == 0 )
g_bUserHasLaser[ id ] = false;
if( cs_get_user_team( id ) == CS_TEAM_T && g_bUserHasLaser[ id ] )
g_bUserHasLaser[ id ] = false;
}
public ham_PlayerKilledPost( id ) g_bUserHasLaser[ id ] = false;
public ClCmdSayAfLaser( id )
{
static CsTeams:iTeam;
iTeam = cs_get_user_team( id );
if( iTeam == CS_TEAM_CT )
{
static iMoney, iCost;
iMoney = cs_get_user_money( id );
iCost = get_pcvar_num( g_iCvarCost );
if( iMoney < iCost )
{
client_print( id, print_chat, "%s Nu ai destui bani, iti mai trebuie $%i !", PLUGIN_TAG, iCost - iMoney );
return PLUGIN_HANDLED;
}
if( g_bUserHasLaser[ id ] )
{
client_print( id, print_chat, "%s Detii deja aceasta abilitate !", PLUGIN_TAG );
return PLUGIN_HANDLED;
}
g_bUserHasLaser[ id ] = true;
cs_set_user_money( id, clamp( iMoney - iCost, 0, 16000 ), 1 );
client_print( id, print_chat, "%s Ai cumparat AntiFurien Laser !", PLUGIN_TAG );
client_print( id, print_chat, "%s Laserul se face rosu pe inamici !", PLUGIN_TAG );
}
else
{
client_print( id, print_chat, "%s Abilitate accesibila doar pentru AntiFurieni !", PLUGIN_TAG );
return PLUGIN_HANDLED;
}
return PLUGIN_HANDLED;
}
public client_PreThink( id )
{
if( !is_user_alive( id ) )
return;
static CsTeams:Team;
Team = cs_get_user_team( id );
if( Team == CS_TEAM_CT )
{
if( g_bUserHasLaser[ id ] )
{
static iTarget, iBody, iRed, iGreen, iBlue, iWeapon;
get_user_aiming( id, iTarget, iBody );
iWeapon = get_user_weapon( id );
if( IsPrimaryWeapon( iWeapon ) || IsSecondaryWeapon( iWeapon ) )
{
if( is_user_alive( iTarget ) && cs_get_user_team( iTarget ) == CS_TEAM_T )
{
iRed = 255;
iGreen = 0;
iBlue = 0;
}
else
{
iRed = 0;
iGreen = 0;
iBlue = 255;
}
static iOrigin[ 3 ];
get_user_origin( id, iOrigin, 3 );
message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( TE_BEAMENTPOINT );
write_short( id | 0x1000 );
write_coord( iOrigin[ 0 ] );
write_coord( iOrigin[ 1 ] );
write_coord( iOrigin[ 2 ] );
write_short( g_iLaserSpr );
write_byte( 1 );
write_byte( 10 );
write_byte( 1 );
write_byte( 5 );
write_byte( 0 );
write_byte( iRed );
write_byte( iGreen );
write_byte( iBlue );
write_byte( 150 );
write_byte( 25 );
message_end( );
}
}
}
}