• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

I have a problem with the code.

raezil

Member
Joined
Apr 17, 2012
Messages
57
Reaction score
17
Hello, I created the code and I have got a problem. The problem is with setStorage(1000, points);
When I added it, then compiler sent me that I did gaffe.
Below this message, you find messages which I received from the compiler.
player.cpp invalid conversion from `int32_t' to `const char*'
player.cpp initializing argument 1 of `std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]'

Code is located on this link :http://pastebin.com/LuGUGDSD
 
I'm not 100% sure, but this is incorrect:
int32_t value = atoi(strValue.c_str());

You define an int(datatype for numbers) and store a string value.
 
I checked this way and It doesn't work. Maybe someone tell me what exactly is wrong or if someone could be so nice and show me how to repair this error.
 
@raezil

I believe this is what you want:
Code:
if(points>value) {
      g_game.addAnimatedText(getPosition(), TEXTCOLOR_GREEN, "New Damage!");
      string pointsString = to_string(points);
      setStorage(1000, pointsString.c_str());
}
 
Last edited:
@up I checked and I received error.
sx0nq0.jpg
 
@raezil

Sorry, it should be:
Code:
if(points>value) {
      g_game.addAnimatedText(getPosition(), TEXTCOLOR_GREEN, "New Damage!");
      std::string pointsString = std::to_string(points);
      setStorage(1000, pointsString.c_str());
}

I forgot the name space =P
 
@raezil

Hm... I guess you can make use of boost instead:
Code:
if(points>value) {
      g_game.addAnimatedText(getPosition(), TEXTCOLOR_GREEN, "New Damage!");
      std::string pointsString = boost::lexical_cast<std::string>(points);
      setStorage(1000, pointsString.c_str());
}
 
Sorry for message again, but how to do max magic damage and max weapon/fist damage, I know that, I can use combats but how to use them here?
 
Back
Top