I do not see any messages before it crashes, however when I comment out the DealDamage line of code it works perfectly. I receive the chat message and my health is increased by 50.
I will post my entire class so you can get a better look and test it for yourself if you want to. I also added some debugging prints just to test what's being processed at what time. If LivingBullets skill hasn't been leveled, the first 2 If statements are printed. As soon as LivingBullets is leveled and a shoot an enemy the game crashes with no prints to screen.
/**
* File: War3Source_DarkKnight.sp
* Description: Dark Knight race writtenf or War3Source.
* Author(s): Jaket
*/
#pragma semicolon 1
#include <sourcemod>
#include "W3SIncs/War3Source_Interface"
new thisRaceID;
new Float:BurningSteed[5]={1.0,1.1,1.15,1.2,1.3};
new LivingBullets[5]={0,2,4,6,8};
new Float:BlackArmour[5]={1.0,0.9,0.8,0.7,0.6};
new Float:Bury[5]={0.0,400.0,600.0,800.0,1000.0};
new SKILL_SPEED,SKILL_DMG,SKILL_ARMOUR,ULT_BURY;
public Plugin:myinfo =
{
name = "Race - Dark Knight",
author = "Jaket",
description = "The Dark Knight for War3Source.",
version = "1.0",
url = "http://war3source.com"
};
public OnPluginStart()
{
}
public OnWar3PluginReady(){
thisRaceID=War3_CreateNewRace("Dark Knight", "DarkKnight");
/*SKILL_SPEED=War3_AddRaceSkill(thisRaceID,"Burning Steed", "Your steed speeds your pursuit", false,4);
SKILL_DMG=War3_AddRaceSkill(thisRaceID,"Living Bullets", "Your bullets feed on the enemy, dealing damage and returning life",false,4);
SKILL_ARMOUR=War3_AddRaceSkill(thisRaceID,"Black Armour", "Your armour reduces physical damage",false,4);
ULT_BURY=War3_AddRaceSkill(thisRaceID,"Bury Him", "Bury your enemy alive",false,4);*/
SKILL_SPEED=War3_AddRaceSkill(thisRaceID,"Burning Steed", "SPEED", false,4);
SKILL_DMG=War3_AddRaceSkill(thisRaceID,"Living Bullets", "+DMG and LEECH LIFE",false,4);
SKILL_ARMOUR=War3_AddRaceSkill(thisRaceID,"Black Armour", "REDUCED DMG",false,4);
ULT_BURY=War3_AddRaceSkill(thisRaceID,"Bury Him", "BURY",false,4);
War3_CreateRaceEnd(thisRaceID);
}
public InitPassiveSkills(client){
if(War3_GetRace(client)==thisRaceID){
//Set Player's speed
new skilllevel_speed=War3_GetSkillLevel(client,thisRaceID,SKILL_SPEED);
new Float:speed=BurningSteed[skilllevel_speed];
War3_SetBuff(client,fMaxSpeed,thisRaceID,speed);
//Give this player a glock to use
GivePlayerItem(client,"weapon_glock");
PrintToChat(client, "DEBUG: InitPassiveSkills running");
}
}
public OnRaceChanged( client, oldrace, newrace)
{
if(newrace != thisRaceID){
War3_WeaponRestrictTo(client, thisRaceID, "");
W3ResetAllBuffRace( client, thisRaceID);
} else {
War3_WeaponRestrictTo(client, thisRaceID, "weapon_knife,weapon_glock");
InitPassiveSkills( client);
}
}
public OnWar3EventSpawn( client){
InitPassiveSkills(client);
}
public OnWar3EventPostHurt(victim, attacker, damage){
PrintToChat(attacker, "DEBUG: OnWar3EventPostHurt running:attacker");
if (ValidPlayer(victim) && ValidPlayer(attacker,true) && GetClientTeam(victim) != GetClientTeam(attacker)){
PrintToChat(attacker, "DEBUG: 1st If passed");
new race = War3_GetRace(attacker);
if(race==thisRaceID){
PrintToChat(attacker, "DEBUG: 2nd If passed");
new skill_level=War3_GetSkillLevel(attacker,race,SKILL_DMG);
if (skill_level > 0 && !Hexed(victim,false)){
PrintToChat(attacker, "DEBUG: 3rd If passed");
//new amt = LivingBullets[skill_level];
new amt = 50;
PrintToChat(attacker, "Your bullets feed, returning %d HP and extra damage!",amt);
//W3FlashScreen(attacker,RGBA_COLOR_GREEN);
War3_HealToBuffHP(attacker,amt);
//War3_DealDamage(victim, amt, attacker, _, "LivingBullet", W3DMGORIGIN_SKILL, W3DMGTYPE_PHYSICAL);
War3_DealDamage(victim,amt,attacker,_,"criticalnade",W3DMGORIGIN_SKILL,W3DMGTYPE_TRUEDMG);
}
}
}
}
public OnW3TakeDmgBulletPre(victim,attacker,Float:damage){
if(ValidPlayer(victim,true) && ValidPlayer(attacker) && GetClientTeam(victim)!=GetClientTeam(attacker))
{
if(War3_GetRace(victim)==thisRaceID)
{
new skill_level=War3_GetSkillLevel(victim,thisRaceID,SKILL_ARMOUR);
if(skill_level > 0 && !Hexed(victim,false)){
War3_DamageModPercent(BlackArmour[skill_level]);
}
}
}
}