Hey guys I got the DoString ( what I think is dostring ) function working for casting spell, but I keep running into a problem with it crashing.
The situation is I got a rogue that I set up a simple loop( to call "Hemorrhage" every 2 seconds, it does this perfectly a couple times and then issues a "Error Reading 0xADDRESS" then crashes.
Code:
Instruction at "0x00A9..." refrenced memory at "0x0000000024".
I can't figure out what the conditions are that cause this crash. Sometimes it will only call the spell once before it crashes, other times I can go 2-3 minutes of mob killing before it crashes.
I check to make sure, I have a target, and its attackable, and the target is attacking me before making these calls but it still just crashes RANDOMLY....
This is the code for everything
PHP Code:
if( targetObj->GetTargetGUID() == player->GetGUID() && player->IsStealth() == false ) {
if( this->timerPtr_->IsRunning(1337) == false ) {
LOG_INF( "Casting: Hemorrphage" << std::endl );
player->GetSpellBook()->CastSpellByName( "Hemorrhage");
}
}
PHP Code:
LUA_DO_STRING = 0x4FD26
PHP Code:
typedef void (__cdecl *pDoString) ( const char *spellName_1, const char *spellName_2, int un_1 );
pDoString oDoString = reinterpret_cast< pDoString >( doStringAddr->GetFullAddress() );
oDoString( str.c_str(), str.c_str(), 0 );