[D3D] Draw Current Ammo?

Posts 1–15 of 19 · Page 1 of 2
[D3D] Draw Current Ammo?
I have this error converting from a string to const char.

Code:
1>.\Base.cpp(150) : error C2664: 'cDirectx::DrawString' : cannot convert parameter 5 from 'string' to 'const char *'
How could it be fixed.
[QUOTE=ppl2pass;2342440]I have this error converting from a string to const char.

Code:
1>.\Base.cpp(150) : error C2664: 'cDirectx::DrawString' : cannot convert parameter 5 from 'string' to 'const char *'
By the sounds of it
it cannot convert parameter 5 from string to 'const char *'

could i please have some sacuce (source) of the error of the line?
On the argument the error is on, put this before it:

Code:
(const char*)
Quote Originally Posted by J View Post
On the argument the error is on, put this before it:

Code:
(const char*)
blood yes i was going to put he hasnt posted an he migth ask agin how do i do that...
people. you can also use google. it is sometimes a BIG help
Thanks for the feedback but i have this error now:
Code:
1>.\Base.cpp(150) : error C2440: 'type cast' : cannot convert from 'std::string' to 'const char *'
Quote Originally Posted by ppl2pass View Post
Thanks for the feedback but i have this error now:
Code:
1>.\Base.cpp(150) : error C2440: 'type cast' : cannot convert from 'std::string' to 'const char *'
No code = we have no idea what you're doing, thus no idea how to help you.

Also, you shouldn't try to make hacks when you've got NO idea how to code in C++.
ur not gonna get help if u only put the error, and not the code
agreed. could it have to do with his .h file for his base?
@freedompeace
im learning through reading codes

here is the error
Code:
Directx.DrawString(10, 22, D3DCOLOR_XRGB(255, 255, 255), Directx.pFont, (const char*) stringify(ammo));
Quote Originally Posted by ppl2pass View Post
@freedompeace
im learning through reading codes

here is the error
Code:
Directx.DrawString(10, 22, D3DCOLOR_XRGB(255, 255, 255), Directx.pFont, (const char*) stringify(ammo));
Why do you have "stringify" there in the first place?



a little hint. Good luck in learning! Though I suggest you try to learn coding normally first. It'll give you much better coding practices than some of these hack coders do.
Quote Originally Posted by ppl2pass View Post
@freedompeace
im learning through reading codes

here is the error
Code:
Directx.DrawString(10, 22, D3DCOLOR_XRGB(255, 255, 255), Directx.pFont, (const char*) stringify(ammo));
std::string comes with some functions you know, it helps a lot to know the basics..

[php]
Directx.DrawString(10, 22, D3DCOLOR_XRGB(255, 255, 255), Directx.pFont, stringify(ammo).c_str());
[/php]

c_str - C++ Reference

Edit: God, damnit, Seal... beat me... My bad..
Quote Originally Posted by Void View Post
std::string comes with some functions you know, it helps a lot to know the basics..

[php]
Directx.DrawString(10, 22, D3DCOLOR_XRGB(255, 255, 255), Directx.pFont, stringify(ammo).c_str());
[/php]

c_str - C++ Referenceⓘ
Beat ya to the punch.


I had a terrible time with char*, const char*, and strings when I needed to convert between them to allow the typing in the custom PTC window.
Quote Originally Posted by Crash View Post
Beat ya to the punch.


I had a terrible time with char*, const char*, and strings when I needed to convert between them to allow the typing in the custom PTC window.
Why didnt you just use C strings (char*) all the way?
If you have a string you can do this.

Code:
std::string str1 = "I am going to be a const char*";
str1.c_str();
Posts 1–15 of 19 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us