// DAREDEVIL! - Yeah - well not all of his powers or it'd be unfair...
// 5/17/2003 Took out light up whole map code - too slow on most computers!
/* CVARS - copy and paste to shconfig.cfg
//Daredevil
daredevil_level 0
daredevil_radius 600 //Radius of the rings
daredevil_bright 192 //How bright to make the rings
*/
#include <superheromod>
// GLOBAL VARIABLES
new gHeroID
new const gHeroName[] = "Daredevil"
new bool:gHasDaredevil[SH_MAXSLOTS+1]
new gSpriteWhite
new gPcvarRadius, gPcvarBright
//----------------------------------------------------------------------------------------------
public plugin_init()
{
// Plugin Info
register_plugin("SUPERHERO Daredevil", SH_VERSION_STR, "{HOJ} Batman/JTP10181")
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
new pcvarLevel = register_cvar("daredevil_level", "0")
gPcvarRadius = register_cvar("daredevil_radius", "600")
gPcvarBright = register_cvar("daredevil_bright", "192")
// FIRE THE EVENTS TO CREATE THIS SUPERHERO!
gHeroID = sh_create_hero(gHeroName, pcvarLevel)
sh_set_hero_info(gHeroID, "Radar Sense", "ESP Rings show you when other players are approaching")
// ESP Rings Task
set_task(2.0, "daredevil_esploop", _, _, _, "b")
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
gSpriteWhite = precache_model("sprites/white.spr")
}
//----------------------------------------------------------------------------------------------
public sh_hero_init(id, heroID, mode)
{
if ( gHeroID != heroID ) return
gHasDaredevil[id] = mode ? true : false
sh_debug_message(id, 1, "%s %s", gHeroName, mode ? "ADDED" : "DROPPED")
}
//----------------------------------------------------------------------------------------------
public daredevil_esploop()
{
if ( !sh_is_active() ) return
static players[SH_MAXSLOTS], playerCount, player
static idRing, ringOrigin[3], i, j
static radius, brightness
radius = get_pcvar_num(gPcvarRadius)
brightness = get_pcvar_num(gPcvarBright)
get_players(players, playerCount, "ah")
for ( i = 0; i < playerCount; i++ ) {
player = players[i]
if ( !gHasDaredevil[player] ) continue
for ( j = 0; j < playerCount; j++ ) {
idRing = players[j]
if ( idRing == player ) continue
if ( !get_user_origin(idRing, ringOrigin) ) continue
message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, ringOrigin, player)
write_byte(TE_BEAMCYLINDER) // 21
write_coord(ringOrigin[0])
write_coord(ringOrigin[1])
write_coord(ringOrigin[2] + 16)
write_coord(ringOrigin[0])
write_coord(ringOrigin[1])
write_coord(ringOrigin[2] + radius)
write_short(gSpriteWhite)
write_byte(0) // startframe
write_byte(1) // framerate
write_byte(6) // life
write_byte(8) // width
write_byte(1) // noise
write_byte(100) // r
write_byte(100) // g
write_byte(255) // b
write_byte(brightness) // brightness
write_byte(0) // speed
message_end()
}
}
}
//----------------------------------------------------------------------------------------------
public client_connect(id)
{
gHasDaredevil[id] = false
}
//----------------------------------------------------------------------------------------------