#include <amxmodx>
#include <engine>
#include <hamsandwich>
#include <fakemeta>
#include <fun>
#define PLUGIN "EuroHL Plugin"
#define VERSION "1.5"
#define AUTHOR "Yuraj"
#define DEBUG 0 //Set 1 = enable
#define MAX_MAPS 32
#define MAX_MAPNAME_LEN 32
#define LAMP_ATTACK 16
#define LAMP_CLASS "lampnoob"
new ehlBombMsg
new ehlNoobMsg
new ehlMaps
//This is requiered for hidden lamp entity
public plugin_precache()
{
precache_model("sprites/dot.spr")
}
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
//Register server CVARS
register_cvar("EuroHLCrossfire", VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)
ehlBombMsg = register_cvar("eurohl_bombmsg", "%s activated bomb!")
ehlNoobMsg = register_cvar("eurohl_noobmsg", "%s plays like noob!")
ehlMaps = register_cvar("eurohl_maps", "crossfire;ag_crossfire")
//Check if enable plugin for this map
//Get current map name
new mapid[MAX_MAPNAME_LEN]
get_mapname(mapid, MAX_MAPNAME_LEN - 1)
//Get list of supported maps
new mapsList[MAX_MAPS*MAX_MAPNAME_LEN]
new maps[MAX_MAPS][MAX_MAPNAME_LEN]
get_pcvar_string(ehlMaps, mapsList, charsmax(mapsList))
ExplodeString(maps, MAX_MAPS,MAX_MAPNAME_LEN - 1, mapsList, ';')
if (ESContains(maps, MAX_MAPS, mapid))
{
//Show info plugin
console_print (0, "[EuroHL Crossfire Plugin] %s (by Yuraj) is running!", VERSION)
//Register forwards
RegisterHam(Ham_Touch,"trigger_multiple","_trigger_multiple",1)
RegisterHam(Ham_TraceAttack,"info_target","lamp_check")
RegisterHam(Ham_TakeDamage,"player","dmg_check")
//| |
//|* |
//--- ---
CreateLampProtection(Float:{738.0, 547.0, -1702.0}, Float:{-35.0,-8.0,-4.0}, Float:{35.0,8.0,4.0})
//| |
//| *|
//--- ---
CreateLampProtection(Float:{418.0, 547.0, -1702.0}, Float:{-35.0,-8.0,-4.0}, Float:{35.0,8.0,4.0})
//| *|
//| |
//--- ---
CreateLampProtection(Float:{418.0, 349.0, -1702.0}, Float:{-35.0,-8.0,-4.0}, Float:{35.0,8.0,4.0})
//|* |
//| |
//--- ---
CreateLampProtection(Float:{738.0, 140.0, -1702.0}, Float:{-35.0,-8.0,-4.0}, Float:{35.0,8.0,4.0})
//| |
//| |
//---*---
CreateLampProtection(Float:{544.0, 588.0, -1710.0}, Float:{-37.0,-10.0,-4.0}, Float:{37.0,10.0,4.0})
//| |
//| |
//--- ---
//*
CreateLampProtection(Float:{800.0,756.0, -1710.0}, Float:{-37.0,-10.0,-4.0}, Float:{37.0,10.0,4.0})
///////////////////////
//
//|----
//|
//| *|
CreateLampProtection(Float:{353.0, 1350.0, -1735.0}, Float:{-35.0,-8.0,-4.0}, Float:{35.0,8.0,4.0})
//|----
//|
//| |*
CreateLampProtection(Float:{353.0, 1132.0, -1702.0}, Float:{-35.0,-8.0,-4.0}, Float:{35.0,8.0,4.0})
//
//|----
//| *
//| |
CreateLampProtection(Float:{624.0, 1312.0, -1702.0}, Float:{-8.0,-35.0,-4.0}, Float:{8.0,35.0,4.0})
///////////////////////HORE
//- ---
// *|
// |
CreateLampProtection(Float:{353.0, 1357.0, -1568.0}, Float:{-37.0,-10.0,-5.0}, Float:{37.0,10.0,5.0})
//Hore 2 poschodie, big lamp
//|----- --|
//|* |
//| |----|
CreateLampProtection(Float:{481.0, 1480.0, -1560.0}, Float:{-37.0,-10.0,-5.0}, Float:{37.0,10.0,5.0})
//|----- --|
//| *|
//| |----|
CreateLampProtection(Float:{520.0, 1016.0, -1560.0}, Float:{-37.0,-10.0,-5.0}, Float:{37.0,10.0,5.0})
//|----- --|
//| * |
//| |----|
CreateLampProtection(Float:{312.0, 1185.0, -1560.0}, Float:{-10.0,-37.0,-5.0}, Float:{10.0,37.0,5.0})
//|-----*--|
//| |
//| |----|
CreateLampProtection(Float:{ 760.0, 1151.0, -1560.0}, Float:{-8.0,-35.0,-4.0}, Float:{8.0,35.0,4.0})
//DRUHA POLOVICA MAPY
//|---------
//| |
//|-*-| |--|
CreateLampProtection(Float:{-728.0, 511.0, -1560.0}, Float:{-10.0,-37.0,-5.0}, Float:{10.0,37.0,5.0})
//|---------
//| * |
//|---| |--|
CreateLampProtection(Float:{-920.0, 511.0, -1560.0}, Float:{-10.0,-37.0,-5.0}, Float:{10.0,37.0,5.0})
/////
//|---------
//| |
//|---| |*-|
CreateLampProtection(Float:{-728.0, 1022.0, -1560.0}, Float:{-10.0,-37.0,-5.0}, Float:{10.0,37.0,5.0})
//|---------
//| |
//|---| |-*|
CreateLampProtection(Float:{-728.0, 1214.0, -1560.0}, Float:{-10.0,-37.0,-5.0}, Float:{10.0,37.0,5.0})
//|---------
//| *|
//|---| |--|
CreateLampProtection(Float:{-920.0, 1214.0, -1560.0}, Float:{-10.0,-37.0,-5.0}, Float:{10.0,37.0,5.0})
//TRETIA BUDOVA SNARKS
//| |---
//|
//|*|---
CreateLampProtection(Float:{ -56.0, 1169.0, -1560.0}, Float:{-10.0,-37.0,-5.0}, Float:{10.0,37.0,5.0})
//|*|---
//|
//| |---
CreateLampProtection(Float:{ -328.0, 1169.0, -1560.0}, Float:{-10.0,-37.0,-5.0}, Float:{10.0,37.0,5.0})
//| |---
//|
//| |-*-
CreateLampProtection(Float:{-64.0, 1464.0, -1560.0}, Float:{-37.0,-10.0,-5.0}, Float:{37.0,10.0,5.0})
//| |-*-
//|
//| |---
CreateLampProtection(Float:{-320.0, 1464.0, -1560.0}, Float:{-37.0,-10.0,-5.0}, Float:{37.0,10.0,5.0})
//Colt lamp
CreateLampProtection(Float:{-830.0, 1386.0, -1560.0}, Float:{-37.0,-10.0,-5.0}, Float:{37.0,10.0,5.0})
}
return PLUGIN_HANDLED
}
public dmg_check(victim, inflictor, attacker, Float:damage, damage_type)
{
//Ignore lamp damage
if (is_user_connected(attacker) && (get_user_flags(attacker, 1) & LAMP_ATTACK) && attacker != victim)
{
if(damage > 1)
{
return HAM_SUPERCEDE
}
}
return HAM_IGNORED
}
public lamp_check(iEntity, idattacker, Float:damage, Float:direction[3], traceresult, damagebits)
{
//If user shot lamp with gauss
if (is_user_alive(idattacker) && get_user_weapon(idattacker) == HLW_GAUSS)
{
new id, body
get_user_aiming(idattacker, id, body, 600)
if (is_valid_ent(id))
{
set_user_flags(idattacker, LAMP_ATTACK,1)
new params[1]
params[0] = idattacker
set_task(2.0, "remove_flags", 0, params, 1)
lamp_warn(idattacker, damage)
}
}
return PLUGIN_CONTINUE
}
public remove_flags(data[])
{
remove_user_flags(data[0], LAMP_ATTACK, 1)
}
public lamp_warn(player, Float:damage)
{
//Warn user
new name[32]
get_user_name(player, name, charsmax(name))
#if !DEBUG
ham_strip_weapon(player, "weapon_gauss")
new health= get_user_health(player) - floatround(damage)
set_user_health(player, health)
//
new msg[64]
get_pcvar_string(ehlNoobMsg, msg, charsmax(msg))
if (msg[0]) // Check if is set bomb message
{
client_print(0, print_chat ,msg, name)
}
//
#else
client_print(0, print_chat ,"'%s'! %i", name, tickcount())
#endif
}
public CreateLampProtection(Float:origin[3], Float:mins[3], Float:maxs[3])
{
new g = create_entity("info_target")
entity_set_int(g,EV_INT_solid, SOLID_BBOX)
entity_set_string(g,EV_SZ_classname,LAMP_CLASS)
entity_set_model(g, "sprites/dot.spr")
entity_set_int( g, EV_INT_movetype, MOVETYPE_NONE);
entity_set_size( g,mins, maxs )
entity_set_origin( g,origin)
entity_set_float(g,EV_FL_takedamage,1.0)
entity_set_float(g,EV_FL_health,99999999.0)
#if !DEBUG
set_rendering(g, kRenderFxNone, 0,0,0, kRenderTransAlpha, 0)
#endif
}
public _trigger_multiple(const iEntity, const id)
{
new n = find_ent_by_target(-1,"fire_button_texture")
if (iEntity == n ) ////NUKEBUTTON
{
if (is_user_alive(id))
{
new msg[64]
get_pcvar_string(ehlBombMsg, msg, charsmax(msg))
//
if (msg[0]) // Check if is set bomb message
{
new name[32]
get_user_name(id, name, charsmax(name))
set_hudmessage(0, 255, 0, 0.75, 0.83, 0, 6.0, 10.0)
show_hudmessage(0, msg, name)
}
}
else
{
set_hudmessage(255, 0, 0, 0.65, 0.83, 0, 6.0, 10.0)
show_hudmessage(0, "Plugin by [euro-hl.6f.sk]")
}
}
}
// takes a weapon from a player efficiently
stock ham_strip_weapon(id,weapon[])
{
if(!equal(weapon,"weapon_",7)) return 0;
new wId = get_weaponid(weapon);
if(!wId) return 0;
new wEnt;
while((wEnt = engfunc(EngFunc_FindEntityByString,wEnt,"classname",weapon)) && pev(wEnt,pev_owner) != id) {}
if(!wEnt) return 0;
if(get_user_weapon(id) == wId) ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);
if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt)) return 0;
ExecuteHamB(Ham_Item_Kill,wEnt);
set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<wId));
return 1;
}
stock ESContains(const Input[][], InputLenCount, const StringToCompare[])
{
for (new i = 0;i<InputLenCount;i++)
{
if ( equal(Input[i],StringToCompare))
{
return 1
}
}
return 0
}
/* Functions */
//split up result into lines
stock ExplodeString( Output[][], Max, Size, Input[], Delimiter )
{
new Idx, l = strlen(Input), Len;
do Len += (1 + copyc( Output[Idx], Size, Input[Len], Delimiter ));
while( (Len < l) && (++Idx < Max) )
return Idx;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1051\\ f0\\ fs16 \n\\ par }
*/