Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

ThalonMook

GET_PLAYER_RADIO_STATION_NAME to Text

Recommended Posts

ThalonMook

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 :D

 

Cu

Thalon

Edited by ThalonMook

Share this post


Link to post
Share on other sites
ThalonMook

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

Share this post


Link to post
Share on other sites
BenBaron

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.

Share this post


Link to post
Share on other sites
c39687

here is another example (pretty much what BenBaron wrote)...

char* hey = "HEY";std::string heyStr(hey);
Edited by c39687

Share this post


Link to post
Share on other sites
ThalonMook

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 *"

Share this post


Link to post
Share on other sites
c39687

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 by c39687

Share this post


Link to post
Share on other sites
Harry11223344

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.

Share this post


Link to post
Share on other sites
ThalonMook

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 :D

 

@Harry11223344

You also can change your natives.h so that your problem is solved ;)

 

Thx for your help

Share this post


Link to post
Share on other sites
c39687

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 by c39687

Share this post


Link to post
Share on other sites
Harry11223344

Awesomesauce!!!!

Share this post


Link to post
Share on other sites
ThalonMook

@c39687

 

there I found out that something is wrong with the natives.h :D

 

But I din't found the download button :D

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

Share this post


Link to post
Share on other sites
c39687

@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 by c39687

Share this post


Link to post
Share on other sites
ThalonMook

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 :D

 

Cu

Thalon

Share this post


Link to post
Share on other sites
Fireboyd78

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 :D

 

Cu

Thalon

 

Why did you add a parameter to the native? This is why Alex does not want people modifying natives.h :p

Share this post


Link to post
Share on other sites
sjaak327

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 :)

Share this post


Link to post
Share on other sites
ThalonMook

I dont added a new parameter :p

 

I saw I wrote the wrong name.

 

Right is GET_RADIO_STATION_NAME and this I changed.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • 1 User Currently Viewing
    0 Members, 0 Anonymous, 1 Guest

×

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.