ThalonMook Posted May 13, 2015 Share Posted May 13, 2015 (edited) Hi, I will print a status text with the current radio station on screen. When I put the command into a string there comes only rubbish. std::string outText = "";outText = AUDIO::GET_PLAYER_RADIO_STATION_NAME();set_status_text(outText); I use the set_status_text from the Script Hook SDK to print text on the screen. Other text will shown. Any hints? But mind I'm new on prgramming c++ so I need a little more information Cu Thalon Edited May 13, 2015 by ThalonMook Link to comment Share on other sites More sharing options...
ThalonMook Posted May 15, 2015 Author Share Posted May 15, 2015 Hi ist there nobody who can help me? I looked at the GTAV NATIVE DB and saw this char *GET_PLAYER_RADIO_STATION_NAME() How can I use it to get the message on the screen? Is it a pointer or can I put it into a string? Thx Thalon Link to comment Share on other sites More sharing options...
BenBaron Posted May 15, 2015 Share Posted May 15, 2015 Just a short guess...try initializing the string directly with the char*: std::string outText(AUDIO::GET_PLAYER_RADIO_STATION_NAME()); Don't know if this will work, though. Link to comment Share on other sites More sharing options...
c39687 Posted May 15, 2015 Share Posted May 15, 2015 (edited) here is another example (pretty much what BenBaron wrote)... char* hey = "HEY";std::string heyStr(hey); Edited May 15, 2015 by c39687 Link to comment Share on other sites More sharing options...
ThalonMook Posted May 15, 2015 Author Share Posted May 15, 2015 Thx for the tips. But both will not work. Error message with BenBaron's command: IntelliSense: no instance of constructor "std::basic_string<_Elem, _Traits, _Alloc>::basic_string [with _Elem=char, _Traits=std::char_traits<char>, _Alloc=std::allocator<char>]" matches the argument list argument types are: (Any) And c39687: IntelliSense: a value of type "Any" cannot be used to initialize an entity of type "char *" Link to comment Share on other sites More sharing options...
c39687 Posted May 15, 2015 Share Posted May 15, 2015 (edited) can I see your code to help me understand what is happening, just paste the relevant lines (should only be a couple of lines) Edited May 15, 2015 by c39687 Link to comment Share on other sites More sharing options...
Harry11223344 Posted May 15, 2015 Share Posted May 15, 2015 Thx for the tips. But both will not work. Error message with BenBaron's command: IntelliSense: no instance of constructor "std::basic_string<_Elem, _Traits, _Alloc>::basic_string [with _Elem=char, _Traits=std::char_traits<char>, _Alloc=std::allocator<char>]" matches the argument list argument types are: (Any) And c39687: IntelliSense: a value of type "Any" cannot be used to initialize an entity of type "char *" I'm interrested in this aswell. I had the same with my characters name on my stats menu page. I never got it to work, or it returned some weird numbers. Link to comment Share on other sites More sharing options...
ThalonMook Posted May 15, 2015 Author Share Posted May 15, 2015 So I have it working. There was a problem with the natives.h I changed it Wrongstatic Any GET_PLAYER_RADIO_STATION_NAME() { return invoke<Any>(0xF6D733C32076AD03); }Rightstatic char* GET_PLAYER_RADIO_STATION_NAME() { return invoke<char*>(0xF6D733C32076AD03); } Now the radio stations are shown as their inside names. Ok so I have to make a list with the names and convert them to the names shown in the car radio display. There I can use the index numbers I got. So I dont need the function @Harry11223344 You also can change your natives.h so that your problem is solved Thx for your help Link to comment Share on other sites More sharing options...
c39687 Posted May 15, 2015 Share Posted May 15, 2015 (edited) oh ok, so the method signature just needed updating in the header... i would just leave your header file alone, since it is part of the sdk and just cast it to (char*) you can do this and leave the return type as Any, alex recommends not touching the header and grabbing updates from his site, but it is up to you... char* station = (char*)AUDIO::GET_PLAYER_RADIO_STATION_NAME();//compiles I just checked the updated natives.h and the function has been defined properly... you should go here and download the newer natives.h... http://www.dev-c.com/nativedb/ (the new header requires you add "typedef int ScrHandle;" to the types.h file) Edited May 15, 2015 by c39687 Jitnaught 1 Link to comment Share on other sites More sharing options...
Harry11223344 Posted May 15, 2015 Share Posted May 15, 2015 Awesomesauce!!!! Link to comment Share on other sites More sharing options...
ThalonMook Posted May 15, 2015 Author Share Posted May 15, 2015 @c39687 there I found out that something is wrong with the natives.h But I din't found the download button Wrongstatic Any GET_PLAYER_RADIO_STATION_NAME(Any p0) { return invoke<Any>(0xF6D733C32076AD03); }Rightstatic char* GET_PLAYER_RADIO_STATION_NAME(Any p0) { return invoke<char*>(0xF6D733C32076AD03); } This one is not updated and was also wrong. For what is "typedef int ScrHandle;" needed? Cu Thalon Link to comment Share on other sites More sharing options...
c39687 Posted May 15, 2015 Share Posted May 15, 2015 (edited) @ThalonMook go back to the website and at the top you will see a link for "Downloads." There you will find the new natives.h file. Also the new natives.h uses a new typedef which you need to define in the types.h file. Add this line to the types.h file... "typedef int ScrHandle;" Let me know if you have trouble. Edited May 15, 2015 by c39687 Link to comment Share on other sites More sharing options...
ThalonMook Posted May 15, 2015 Author Share Posted May 15, 2015 Thx I found it before. I updated the native.h and inserted the typedef. But the GET_PLAYER_RADIO_STATION_NAME(Any p0) is stil not corrected. In my native it is Cu Thalon c39687 1 Link to comment Share on other sites More sharing options...
Fireboyd78 Posted May 16, 2015 Share Posted May 16, 2015 Thx I found it before. I updated the native.h and inserted the typedef. But the GET_PLAYER_RADIO_STATION_NAME(Any p0) is stil not corrected. In my native it is Cu Thalon Why did you add a parameter to the native? This is why Alex does not want people modifying natives.h c39687 1 Link to comment Share on other sites More sharing options...
sjaak327 Posted May 16, 2015 Share Posted May 16, 2015 It returns unsuable stuff anyway, like 19_USER_RADIO or 01_ROCK_RADIO OR 12_REAGGEA. Hardly stuff I want to use. I prefer proper names Link to comment Share on other sites More sharing options...
ThalonMook Posted May 17, 2015 Author Share Posted May 17, 2015 I dont added a new parameter I saw I wrote the wrong name. Right is GET_RADIO_STATION_NAME and this I changed. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now