Quantcast

Jump to content

» «
Photo

Link Car to Interior

11 replies to this topic
direstraits
  • direstraits

  • Members
  • Joined: 08 Mar 2011
  • Portugal

#1

Posted 25 April 2013 - 10:05 AM Edited by direstraits, 27 April 2013 - 11:52 AM.

Hi.

I need to link a car to a interior in San Andreas

I'm using this:
CODE
03C0: 25@ = actor $PLAYER_ACTOR car
0840: link_car 25@ to_interior 1


But It dosen't work.

I need some help.

New Question , so scroll down.

Silent
  • Silent

    Moderating Cookie Monster

  • Members
  • Joined: 01 Feb 2010
  • Poland

#2

Posted 25 April 2013 - 03:06 PM

It is a proper way of doing it, so perhaps code's failing in a different place. Post a full code please.

direstraits
  • direstraits

  • Members
  • Joined: 08 Mar 2011
  • Portugal

#3

Posted 27 April 2013 - 09:02 AM

Forget, I already fixed the script.

But I have another question, It's possible to get the name of the current radio station playing on the screen, like a permament text?

Silent
  • Silent

    Moderating Cookie Monster

  • Members
  • Joined: 01 Feb 2010
  • Poland

#4

Posted 27 April 2013 - 01:56 PM

Directly, no. But you can get current station's index and get its GXT entry by that.

direstraits
  • direstraits

  • Members
  • Joined: 08 Mar 2011
  • Portugal

#5

Posted 27 April 2013 - 02:38 PM

How? What opcodes can I use?

I've found this:

CODE
1 = "Playback FM"
2 = "K Rose"
3 = "K-DST"
4 = "Bounce FM"
5 = "SF-UR"
6 = "Radio Los Santos"
7 = "Radio X"
8 = "CSR 103.9"
9 = "K-JAH West"
10 = "Master Sounds 98.3"
11 = "WCTR Talk Radio"
12 = "User Track Player"
13 = "Radio Off"





Silent
  • Silent

    Moderating Cookie Monster

  • Members
  • Joined: 01 Feb 2010
  • Poland

#6

Posted 27 April 2013 - 03:07 PM Edited by SilentPL, 27 April 2013 - 03:10 PM.

There's plenty of ways. You can do it without using CLEO opcodes or, if you don't mind using them, you could do it that way:

CODE
051E: 0@ = get_current_radio_station
000A: 0@ += 1

// Gets 2@s pointer - it will contain radio station's name
0A9F: 1@ = current_thread_pointer
000A: 1@ += 0x44        // 0x3C + 2*4 = pointer to 2@
0AA5: call 0x4E8380 num_params 2 pop 0 1@ 0@


Or, wrapped nicely to a SCM function:

CODE
:GET_RADIO_STATION_NAME
051E: 0@ = get_current_radio_station
000A: 0@ += 1

0A9F: 1@ = current_thread_pointer
000A: 1@ += 0x44
0AA5: call 0x4E8380 num_params 2 pop 0 1@ 0@
0AB2: ret 2 2@ 3@


Call it like that:
CODE
0AB1: call_scm_func @GET_RADIO_STATION_NAME 0 0@ 1@     // Gets the name to 0@s



Obviously, untested. I hope it works.


Edit:
Calling convention fixed. It's a thiscall, but the object is unused (making it act like a stdcall). My bad.

direstraits
  • direstraits

  • Members
  • Joined: 08 Mar 2011
  • Portugal

#7

Posted 28 April 2013 - 09:32 AM

I tried This:

CODE
thread 'RADIONAME'
if
  Actor.Driving($PLAYER_ACTOR)
051E: 0@ = get_current_radio_station
000A: 0@ += 1
// Gets 2@s pointer - it will contain radio station's name
0A9F: 1@ = current_thread_pointer
000A: 1@ += 0x44        // 0x3C + 2*4 = pointer to 2@
0AA5: call 0x4E8380 num_params 2 pop 0 1@ 0@
03E0: unknown_text_draw_flag 1
033F: set_text_draw_letter_size 0.3 1.2
0342: enable_text_draw_centered 1
081C: draw_text_outline 2 RGBA 0 0 0 255
033E: set_draw_text_position 200.0 433.0 GXT 0@


But the game crashes, at the end of the loadingscreens.

fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009

#8

Posted 28 April 2013 - 09:40 AM

CODE
if
  Actor.Driving($PLAYER_ACTOR)
051E: 0@ = get_current_radio_station

Unfinished conditional statement? What's this?

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Members
  • Joined: 19 Aug 2006
  • European-Union

#9

Posted 28 April 2013 - 09:44 AM

The game may crash at 033E, because you passed the pointer of the local variable 2@ instead of its index. Use this line:
CODE
033E: set_draw_text_position 200.0 433.0 GXT 2@

direstraits
  • direstraits

  • Members
  • Joined: 08 Mar 2011
  • Portugal

#10

Posted 28 April 2013 - 09:52 AM

Still Crashes.

I'm using this:
CODE
thread 'RADIONAME'
051E: 0@ = get_current_radio_station
0@ += 1
0A9F: 1@ = current_thread_pointer
1@ += 68
0AA5: call 5145472 2 pop 0 1@ 0@
0AB2: ret 2 2@ 3@
03E0: unknown_text_draw_flag 1
033F: set_text_draw_letter_size 0.3 1.2
0342: enable_text_draw_centered 1
081C: draw_text_outline 2 RGBA 0 0 0 255
033E: set_draw_text_position 200.0 433.0 GXT 2@

Silent
  • Silent

    Moderating Cookie Monster

  • Members
  • Joined: 01 Feb 2010
  • Poland

#11

Posted 28 April 2013 - 10:09 AM

Why would you want to inline that SCM function in such a bad way?

Try this full example:

CODE
{$CLEO}
0000: RADIONAME

while true
   0001: wait 0 ms
   051E: 0@ = get_current_radio_station
   000A: 0@ += 1
   
   // Gets 2@s pointer - it will contain radio station's name
   0A9F: 1@ = current_thread_pointer
   000A: 1@ += 0x44        // 0x3C + 2*4 = pointer to 2@
   0AA5: call 0x4E8380 num_params 2 pop 0 1@ 0@
   
   03F0: enable_text_draw 1
   03E0: draw_text_behind_textures 1
   033F: set_text_draw_letter_size 0.3 1.2
   0342: enable_text_draw_centered 1
   081C: draw_text_outline 2 RGBA 0 0 0 255
   033E: set_draw_text_position 200.0 433.0 GXT 2@s
end

direstraits
  • direstraits

  • Members
  • Joined: 08 Mar 2011
  • Portugal

#12

Posted 28 April 2013 - 10:40 AM

It works, but it's only for a few seconds, and it shows when player is on foot




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users