Jump to content

Thetruecrow

Members
  • Posts

    2
  • Joined

  • Last visited

Thetruecrow's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hello Scias. Â What you are trying to do: Add an int to a string, then add a string to the end of the string that has the int added to it. Â What you are actually doing: Adding an int value to a string, then adding a string value to that int value. Â What you can do is use std::stringstream to create a string then append values to it as such: std::stringstream locStr; locStr << "Character Location X: " << X << " Y: " << Y " Z: " << Z; handler->SendSysMessage(locStr.str().c_str()); This will print the floats with their decimals, if you only want the integer value you can cast it to int like before. Â You also have the option of using sprintf which will fill a buffer with a string and place the arguements based on the va_list implementation. char posBuff[255]; sprintf(posBuff, "Character Location X: %f Y: %f Z: %f", X, Y, Z); handler->SendSysMessage(posBuff); If the handler is the ChatHandler implementation found in skyfire, then just use the PSendSystemMessage instead as it supports formatted strings. handler->PSendSysMessage("Character Location X: %f Y: %f Z: %f", X, Y, Z); And just so you know, if you're casting to an int, use %i instead of %f.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.