Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Criminal Enterprises
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

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

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

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

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

    2. Support

    3. Suggestions

GET_PLAYER_RADIO_STATION_NAME to Text


ThalonMook
 Share

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
Link to comment
Share on other sites

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

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

char* hey = "HEY";std::string heyStr(hey);
Edited by c39687
Link to comment
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 *"

Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
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

Link to comment
Share on other sites

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
Link to comment
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

Link to comment
Share on other sites

@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
Link to comment
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

Link to comment
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

Link to comment
Share on other sites

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

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.

Link to comment
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
 Share

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

×
×
  • Create New...

Important Information

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