Quote:
Originally Posted by vittu
G-Dog, I think he wants a weapon to have increased damage for only a certain time period triggered by a power key.
|
Lal, not really..... G-Dog made it exactly the way I want it, though I just need to add a sprite and sound now. Im trying right now with some stuff from electro, though I fail pretty bigtime.
@G-Dog: Like the loop; The sprite is displayed all the time you leech someone; So the same amount of time you leech hp. I know it could look pretty fail, but I will probably set the cooldown to 30-60 secs and the leech % to 0.3 (30% of max hp), though I will test it some more if I get the sprite and sound on it.
This will probably just confuse you, and im sure that if G-Dog will help me, he will make it faster on his own... Still here it is, and im still not sure how to get the damn ;'s right
PHP Code:
#include <superheromod>
#define LINE_WIDTH 100
// GLOBAL VARIABLES
new gHeroID;
new bool:gHasTest[SH_MAXSLOTS+1];
new pcvar_cool, pcvar_dmg;
//----------------------------------------------------------------------------------------------
public plugin_init()
{
// Plugin Info
register_plugin("SUPERHERO Test", "0.1", "Random1")
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
new pcvarLevel = register_cvar("test_level", "0");
pcvar_cool = register_cvar("test_cooldown", "30.0");
pcvar_dmg = register_cvar("test_pctdmg", "0.1");
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
gHeroID = sh_create_hero("Test", pcvarLevel);
sh_set_hero_info(gHeroID, "Leech Seed", "Slowly absorb players health");
sh_set_hero_bind(gHeroID);
}
//----------------------------------------------------------------------------------------------
public sh_hero_init(id, heroid, mode)
if ( heroid == gHeroID )
gHasTest[id] = mode ? true : false;
//----------------------------------------------------------------------------------------------
public sh_hero_key(id, heroID, key)
{
if ( gHeroID != heroID ) return;
if ( key ) //ya I know, instead of sticking with one method I went with yet another method of checking keydown just to f with yall
{
new tid, tbody;
get_user_aiming(id, tid, tbody);
if ( is_user_alive(tid) && gHasTest[id] && !gPlayerInCooldown[id] && (cs_get_user_team(id) != cs_get_user_team(tid) || sh_friendlyfire_on()) )
leech_player(tid, id);
}
}
//----------------------------------------------------------------------------------------------
leech_player(victim, attacker)
{
if ( sh_is_active() && gHasTest[attacker] && is_user_alive(victim) )
{
//first lets stun the player, we'll let them move a little cause stoping them all together can get cheap
sh_set_stun(victim, 3.0, 75.0);
new args[3]; args[0] = victim; args[1] = attacker;
args[2] = floatround(floatclamp(get_pcvar_float(pcvar_dmg) * get_user_health(victim) / 10.0, 1.0, float(sh_get_max_hp(victim))));
set_task(0.3, "drain_health", attacker, args, 3, "a", 10); //loops our task to occur 10 times over a 3 second interval
//set our cooldown now, assuming there is one
if (get_pcvar_float(pcvar_cool) > 0.0) sh_set_cooldown(attacker, get_pcvar_float(pcvar_cool));
}
}
//----------------------------------------------------------------------------------------------
public drain_health(args[])
{
static victim, attacker, damage; victim = args[0]; attacker = args[1]; damage = args[2];
if ( !is_user_alive(victim) || !is_user_alive(attacker) )
{
remove_task(attacker);
return;
}
sh_extra_damage(victim, attacker, damage, "leech life");
sh_add_hp(attacker, damage, 0);
new Float:beamOrigin[3];
pev(beamStartID, pev_origin, beamOrigin);
//and finally some kind of sprite effect, for now i'm gonna copy drac and just have the red flash
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMENTS)
write_short(beamStartID)// start entity
write_short(victim) // entity
write_short(gSpriteLightning) // model
write_byte(0) // starting frame
write_byte(15) // frame rate
write_byte(10) // life
write_byte(linewidth) // linewidth
write_byte(10) // noise amplitude
write_byte(150) // r, g, b
write_byte(0) // r, g, b
write_byte(170) // r, g, b 125
write_byte(60) // brightness 175
write_byte(0) // scroll speed
message_end();
new vicOrigin[3];
get_user_origin(victim, vicOrigin) ;
// Create an elight on the target
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_ELIGHT)
write_short(victim) // entity
write_coord(vicOrigin[0]) // initial position
write_coord(vicOrigin[1]) // initial position
write_coord(vicOrigin[2]) // initial position
write_coord(10) // radius
write_byte(0) // r, g, b
write_byte(0) // r, g, b
write_byte(255) // r, g, b
write_byte(10) // life
write_coord(0) // decay rate
message_end();
}
//----------------------------------------------------------------------------------------------
public client_connect(id)
gHasTest[id] = false;
//----------------------------------------------------------------------------------------------
Errors:
Code:
//// sh_necromonger.sma
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
necromonger.sma(73) : warning 217: loose indentation
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
necromonger.sma(73) : error 017: undefined symbol "beamStartID"
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
necromonger.sma(73) : warning 215: expression has no effect
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
necromonger.sma(73) : warning 215: expression has no effect
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
necromonger.sma(73) : error 001: expected token: ";", but found ")"
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
necromonger.sma(73) : error 029: invalid expression, assumed zero
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
necromonger.sma(73) : fatal error 107: too many error messages on one line
//
// Compilation aborted.
// 4 Errors.
// Could not locate output file compiled\sh_necromonger.amx (compile failed).
//
// Compilation Time: 0,59 sec
__________________