Quote:
Originally Posted by DarkGod
Remove the first ).
|
Remove my first post with old info, or remove
PHP Code:
gHeroID != heroID
? I removed stated and that error become working. Though I got loads of warning and a lot of errors.
Imma post the whole shit now. You will die when you see it, epic fail I know, but hey, you all started somewhere a the bottom too!
PHP Code:
// DRACULA!
/* CVARS - copy and paste to shconfig.cfg
//Dracula
dracula_level 0
dracula_pctperlev 0.03 //What percent of damage to give back per level of player
*/
// v1.17.5 - JTP - Added code to allow you to regen to your max heatlh
#include <superheromod>
// GLOBAL VARIABLES
new gHeroID
new const gHeroName[] = "Dracula"
new bool:gHasDracula[SH_MAXSLOTS+1]
new gPcvarPctPerLev, gPcvarMaxDamage, gPcvarCooldown
//----------------------------------------------------------------------------------------------
public plugin_init()
{
// Plugin Info
register_plugin("SUPERHERO Dracula", SH_VERSION_STR, "{HOJ} Batman/JTP10181")
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
new pcvarLevel = register_cvar("dracula_level", "0")
gPcvarPctPerLev = register_cvar("dracula_pctperlev", "0.03")
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
gHeroID = sh_create_hero(gHeroName, pcvarLevel)
sh_set_hero_info(gHeroID, "Vampiric Drain", "Gain HP by attacking players - More HPs per level")
}
//----------------------------------------------------------------------------------------------
public sh_hero_init(id, heroID, mode)
{
if ( gHeroID != heroID ) return
if ( mode == SH_HERO_ADD ) {
gPlayerInCooldown[id] = false
}
}
//----------------------------------------------------------------------------------------------
public sh_client_spawn(id)
{
remove_task(id)
gPlayerInCooldown[id] = false
}
//-------------------------------------------
public sh_hero_key(id, heroID, key)
{
if ( sh_is_freezetime() || !is_user_alive(id) || !gHasDracula[id] ) return
if ( key == SH_KEYDOWN )
{
if ( gPlayerInCooldown[id] )
{
sh_sound_deny(id)
return
}
new Float:seconds = get_pcvar_float(gPcvarCooldown)
if (seconds > 0.0 ) sh_set_cooldown(id, seconds)
new maxDamage = get_pcvar_num(gPcvarMaxDamage)
}
}
//----------------------------------------------------------------------------------------------
public client_damage(attacker, victim, damage, wpnindex)
{
if ( !sh_is_active() ) return
if ( !is_user_connected(victim) || !is_user_alive(attacker) ) return
// Should nades not count? maybe remove them later
if ( gHasDracula[attacker] && CSW_P228 <= wpnindex <= CSW_P90 ) {
dracula_suckblood(attacker, damage)
}
}
//----------------------------------------------------------------------------------------------
// Leave this public so it can be called with a forward from Longshot
public dracula_suckblood(attacker, damage)
{
if ( sh_is_active() && gHasDracula[attacker] && is_user_alive(attacker) )
{
// Add some HP back!
new giveHPs = floatround(damage * get_pcvar_float(gPcvarPctPerLev) * sh_get_user_lvl(attacker))
// Get this here so it doesn't have to be called in sh_add_hp again
new maxHPs = sh_get_max_hp(attacker)
if ( get_user_health(attacker) < maxHPs && giveHPs > 0 )
{
new alphanum = clamp((damage * 2), 40, 200)
sh_screen_fade(attacker, 0.5, 0.25, 255, 10, 10, alphanum) //Red Screen Flash
sh_add_hp(attacker, giveHPs, maxHPs)
}
sh_extra_damage(victim, attacker, damage, "Life drain", 0, SH_DMG_NORM, true, false)
}
}
}
//----------------------------------------------------------------------------------------------
public client_connect(id)
{
gHasDracula[id] = false
}
//----------------------------------------------------------------------------------------------
Errors:
PHP Code:
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
the_dracula.sma(102) : error 001: expected token: ";", but found ")"
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
the_dracula.sma(102) : error 029: invalid expression, assumed zero
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
the_dracula.sma(102) : fatal error 107: too many error messages on one line
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
the_dracula.sma(102) : error 017: undefined symbol "victim"
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
Warnings:
PHP Code:
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
the_dracula.sma(56) : warning 217: loose indentation
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
the_dracula.sma(69) : warning 204: symbol is assigned a value that is never used
: "maxDamage"
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
the_dracula.sma(102) : warning 215: expression has no effect
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
the_dracula.sma(102) : warning 215: expression has no effect
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
the_dracula.sma(102) : warning 215: expression has no effect
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
the_dracula.sma(102) : warning 215: expression has no effect
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
the_dracula.sma(102) : warning 215: expression has no effect
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
the_dracula.sma(102) : warning 215: expression has no effect
// C:\Users\Cornerstone\Desktop\HLDS_Server\cstrike\addons\amxmodx\scripting\sh_
the_dracula.sma(102) : warning 215: expression has no effect
Have fun and laugh at me lol
I would like to know how to set sh_extra_damage for a attack that does damage to the victim, a sprite from the attacker to the victim. Cuz I guess I dont have to change anything for the life giving stuff right? Then also how to set how much life it drains to 7% of victim max health, get_user_maxHealth/giveHPs = 7%/user_max_health? Probably sound weird, so give me the right way xD. THX!!
__________________