GarQet
Own3d!
- Joined
- Feb 10, 2009
- Messages
- 1,381
- Solutions
- 14
- Reaction score
- 81
Hello everyone!
Im looking for small help. Im not that good in C++ as in LUA and I have a huge problem.
I wanted to create small additional thing in C++ but this thing randomly crashes server. Randomly means like few minutes after start server, few hours or days... I don't even know what error of crash says...
I will be appreciate for any help.
first error: https://i.gyazo.com/cd9b40512ac1f89c0758cd231fd2357b.png
second error: https://i.gyazo.com/78cefc6fbf1caa1200461c531eb8267c.png
Script:
COMBAT.CPP
Can any help me somehow? Please
Im looking for small help. Im not that good in C++ as in LUA and I have a huge problem.
I wanted to create small additional thing in C++ but this thing randomly crashes server. Randomly means like few minutes after start server, few hours or days... I don't even know what error of crash says...
I will be appreciate for any help.
first error: https://i.gyazo.com/cd9b40512ac1f89c0758cd231fd2357b.png
second error: https://i.gyazo.com/78cefc6fbf1caa1200461c531eb8267c.png
Script:
COMBAT.CPP
Code:
bool Combat::CombatHealthFunc(Creature* caster, Creature* target, const CombatParams& params, void* data)
{
int64_t change = 0;
if(Combat2Var* var = (Combat2Var*)data)
{
change = var->change;
if(!change)
change = random_range(var->minChange, var->maxChange, DISTRO_NORMAL);
}
Player* targetPlayer = target->getPlayer();
if(targetPlayer) {
std::string value;
caster->getStorage(666, value);
int32_t plus = atoi(value.c_str());
int32_t multiplier = g_config.getNumber(ConfigManager::ADDITIONAL_DAMAGE);
if(params.isSpell && caster && random_range(1, 1000, DISTRO_NORMAL) <= (S_CRITICAL + (plus * multiplier))) {
change = (int64_t)(change * (1.2 + ((plus * multiplier) * 0.01)));
}
}
if(g_game.combatBlockHit(params.combatType, caster, target, change, params.blockedByShield, params.blockedByArmor))
return false;
if(change < 0 && caster && caster->getPlayer() && target->getPlayer())
change = change / 2;
if(!g_game.combatChangeHealth(params.combatType, caster, target, change, params.effects.hit, params.effects.color))
return false;
CombatConditionFunc(caster, target, params, NULL);
CombatDispelFunc(caster, target, params, NULL);
return true;
}
Can any help me somehow? Please