Difference between revisions of "Buying property"
Jump to navigation
Jump to search
m |
|||
Line 42: | Line 42: | ||
004E: end_thread | 004E: end_thread | ||
</source> | </source> | ||
− | |||
− | |||
==Full Code== | ==Full Code== | ||
Line 190: | Line 188: | ||
0051: return</source> | 0051: return</source> | ||
− | |||
− | |||
[[Category:Code Snippets]] | [[Category:Code Snippets]] |
Latest revision as of 16:08, 18 May 2010
This is a code snippet of a property for sale in Sanny Builder's format and should work in Vice City and San Andreas. This gives you the basic and compact code to create a working script without creating a mission for it. Remember to read the tutorial on how to create a thread before proceeding to implement this code.
:BUY
0006: 1@ = 100 // set price
0007: 2@ = 308.7745 // x-coordinate of pickup
0007: 3@ = -1298.623 // y-coordinate of pickup
0007: 4@ = 11.07 // z-coordinate of pickup
0518: 0@ = create_available_asset_pickup 'PROP_3' at 2@ 3@ 4@ price 1@ // Press ~k~~PED_ANSWER_PHONE~ to buy this property for $~1~.
03A4: name_thread 'BUY'
:BUY_10
0001: wait 250 ms
00D6: if
0256: player $PLAYER_CHAR defined
004D: jump_if_false @BUY_10
00D6: if
0038: $ONMISSION == 0
004D: jump_if_false @BUY_10
00D6: if
0214: pickup 0@ picked_up
004D: jump_if_false @BUY_10
01B4: set_player $PLAYER_CHAR frozen_state 0
03BF: set_player $PLAYER_CHAR ignored_by_everyone_to 1
02A3: toggle_widescreen 1
015F: set_camera_position 468.3571 1259.458 21.8848 0.0 0.0 0.0 // set your camera location
0160: point_camera 469.2978 1259.797 21.8834 2 // set your camera target location
00BA: text_styled 'BUYPRO' 5000 ms 2 // Property bought!
0394: play_music 1
0001: wait 5000 ms
00D6: if
8256: not player $PLAYER_CHAR defined
004D: jump_if_false @BUY_176
004E: end_thread
:BUY_176
00BE: text_clear_all
0373: set_camera_directly_behind_player
02EB: restore_camera_with_jumpcut
01B4: set_player $PLAYER_CHAR frozen_state 1
03BF: set_player $PLAYER_CHAR ignored_by_everyone_to 0
02A3: toggle_widescreen 0
004E: end_thread
Full Code
Here is a full code to buy a property based on the code in Vice City. The process to buy a property in Vice City and San Andreas involves starting a mission.
Find:
DEFINE MISSIONS
Increment the number of missions by one.
Find the last defined mission and add:
DEFINE MISSION ## AT @BUYPRO
Find:
create_thread
Add above:
create_thread @BUY
Find:
//-------------Mission 0---------------
Add above:
:BUY
0006: 1@ = 100 // set price
0007: 2@ = 308.7745 // x-coordinate of pickup
0007: 3@ = -1298.623 // y-coordinate of pickup
0007: 4@ = 11.07 // z-coordinate of pickup
0518: 0@ = create_available_asset_pickup 'PROP_3' at 2@ 3@ 4@ price 1@ // Press ~k~~PED_ANSWER_PHONE~ to buy this property for $~1~.
03A4: name_thread 'BUY'
:BUY_10
0001: wait 250 ms
00D6: if
0256: player $PLAYER_CHAR defined
004D: jump_if_false @BUY_87
00D6: if
0038: $ONMISSION == 0
004D: jump_if_false @BUY_87
00D6: if
03EE: player $PLAYER_CHAR controllable
004D: jump_if_false @BUY_87
00D6: if
0214: pickup 0@ picked_up
004D: jump_if_false @BUY_87
0417: start_mission BUYPRO
004E: end_thread
:BUY_87
0002: jump @BUY_10
Scroll all the way to the end of the script and add:
//-------------Mission ##---------------
:BUYPRO
03A4: name_thread 'BUYPRO'
0004: $ONMISSION = 1
0169: set_fade_color 0 0 1
016A: fade 0 500 ms
01B4: set_player $PLAYER_CHAR frozen_state 0
03BF: set_player $PLAYER_CHAR ignored_by_everyone_to 1
03F4: set_all_vehicles_apply_damage_rules 0
:BUYPRO_50
00D6: if
016B: fading
004D: jump_if_false @BUYPRO_92
0001: wait 0 ms
00D6: if
8256: not player $PLAYER_CHAR defined
004D: jump_if_false @BUYPRO_85
004E: end_thread
:BUYPRO_85
0002: jump @BUYPRO_50
:BUYPRO_92
02A3: toggle_widescreen 1
0169: set_fade_color 0 0 1
016A: fade 1 500 ms
015F: set_camera_position 468.3571 1259.458 21.8848 0.0 0.0 0.0 // set your camera location
0160: point_camera 469.2978 1259.797 21.8834 2 // set your camera target location
:BUYPRO_162
00D6: if
016B: fading
004D: jump_if_false @BUYPRO_204
0001: wait 0 ms
00D6: if
8256: not player $PLAYER_CHAR defined
004D: jump_if_false @BUYPRO_197
004E: end_thread
:BUYPRO_197
0002: jump @BUYPRO_162
:BUYPRO_204
00BA: text_styled 'BUYPRO' 5000 ms 2 // Property bought!
0394: play_music 1
043C: set_game_sounds_disable_on_fade 0
0001: wait 5000 ms
0169: set_fade_color 0 0 1
016A: fade 0 500 ms
:BUYPRO_247
00D6: if
016B: fading
004D: jump_if_false @BUYPRO_293
0001: wait 0 ms
00D6: if
8256: not player $PLAYER_CHAR defined
004D: jump_if_false @BUYPRO_286
043C: set_game_sounds_disable_on_fade 1
004E: end_thread
:BUYPRO_286
0002: jump @BUYPRO_247
:BUYPRO_293
0373: set_camera_directly_behind_player
02EB: restore_camera_with_jumpcut
01B4: set_player $PLAYER_CHAR frozen_state 1
03BF: set_player $PLAYER_CHAR ignored_by_everyone_to 0
03F4: set_all_vehicles_apply_damage_rules 1
02A3: toggle_widescreen 0
0169: set_fade_color 0 0 1
:BUYPRO_327
016A: fade 1 500 ms
00D6: if
016B: fading
004D: jump_if_false @BUYPRO_358
0001: wait 0 ms
0002: jump @BUYPRO_327
:BUYPRO_358
00D6: if
0256: player $PLAYER_CHAR defined
004D: jump_if_false @BUYPRO_379
011C: actor $PLAYER_ACTOR clear_objective
:BUYPRO_379
043C: set_game_sounds_disable_on_fade 1
0004: $ONMISSION = 0
00D8: mission_cleanup
004E: end_thread
0051: return