whyperioN Posted September 7, 2019 Share Posted September 7, 2019 I want to give money when I destroy the model {$CLEO .cs} //-------------MAIN--------------- thread 'MONEY' wait 0 [email protected] = 0 // NEW PLAYER MONEY Model.Load(#KMB_ATM1) 038B: load_requested_models :MONEY wait 0 if Player.Defined($PLAYER_CHAR) jf @MONEY [email protected] = Object.Create(#KMB_ATM1, 316.0755, -1776.6301, 4.7053) jf @MONEY 03F0: enable_text_draw 1 060D: draw_text_shadow 0 color_RGBA 0 0 0 0 033F: set_text_draw_letter_size 0.55 2.2 081C: draw_text_outline 2 RGBA 0 0 0 255 0349: set_text_draw_font 3 045A: draw_text_1number 499.0 139.0 GXT 'MONEY' number [email protected] // fxt file = MONEY ~w~$~1~ jf @MONEY if 051A: object [email protected] damaged_by_actor $PLAYER_ACTOR jf @MONEY [email protected] += 50 jump @MONEY sorry for bad english Link to comment Share on other sites More sharing options...
ZAZ Posted September 7, 2019 Share Posted September 7, 2019 (edited) your script spawns thousand of objects, because everything is running in one loop make shure to create only one object and remove it from game if user don't play there this OPCODE is INCORRECT 051A: object [email protected] damaged_by_actor $PLAYER_ACTOR it is for actors only if 051A: actor 1@ damaged_by_actor $PLAYER_ACTOR jf OPCODE 051A: CHECKS ACTOR DAMAGE ----------------------------------------------------------------- check for the object health to display the progress 071E: get_object 1@ health_to 30@ check with opcode 0366: if object is shattered 0366: object 1@ broken Test this {$CLEO .cs} //2942, kmb_atm1 thread 'MONEY' wait 0 :MONEY_1 wait 0 if Player.Defined($PLAYER_CHAR) jf @MONEY_1 if 00FE: actor $PLAYER_ACTOR sphere 0 in_sphere 316.07 -1776.63 4.7 radius 70.0 70.0 70.0 jf @MONEY_1 31@ = 0 // NEW PLAYER MONEY Model.Load(2942) 038B: load_requested_models 1@ = Object.Create(2942, 316.0755, -1776.6301, 3.75) 071F: set_object 1@ health_to 5000 :MONEY_2 wait 0 if Player.Defined($PLAYER_CHAR) jf @MONEY_cleanup if 00FE: actor $PLAYER_ACTOR sphere 0 in_sphere 316.07 -1776.63 4.7 radius 90.0 90.0 90.0 jf @MONEY_cleanup 071E: get_object 1@ health_to 30@ 03F0: enable_text_draw 1 060D: draw_text_shadow 0 color_RGBA 0 0 0 0 033F: set_text_draw_letter_size 0.55 2.2 081C: draw_text_outline 2 RGBA 0 0 0 255 0349: set_text_draw_font 3 045A: draw_text_1number 499.0 170.0 GXT 'number' number 30@ 060D: draw_text_shadow 0 color_RGBA 0 0 0 0 033F: set_text_draw_letter_size 0.55 2.2 081C: draw_text_outline 2 RGBA 0 0 0 255 0349: set_text_draw_font 3 045A: draw_text_1number 499.0 139.0 GXT 'number' number 31@ // fxt file = MONEY ~w~$~1~ if //051A: object 1@ damaged_by_actor $PLAYER_ACTOR <------INCORRECT OPCODE //051A: actor 1@ damaged_by_actor $PLAYER_ACTOR <------ OPCODE 051A: CHECKS ACTOR DAMAGE 0366: object 1@ broken jf @MONEY_2 31@ += 50 00BA: show_text_styled GXT 'FEM_OK' time 1000 style 4 0109: player $PLAYER_CHAR money += 1000000 :MONEY_3 wait 0 if Player.Defined($PLAYER_CHAR) jf @MONEY_cleanup if 00FE: actor $PLAYER_ACTOR sphere 0 in_sphere 316.07 -1776.63 4.7 radius 50.0 50.0 50.0 jf @MONEY_cleanup jump @MONEY_3 :MONEY_cleanup 0108: destroy_object 1@ jump @MONEY_1 If you still need to check the damage then find out how this code works 08FF: object 1@ received_damage_type 57 Edited September 7, 2019 by ZAZ whyperioN and Sloth- 2 CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
whyperioN Posted September 7, 2019 Author Share Posted September 7, 2019 It's working thank you, you deserve to the end. Link to comment Share on other sites More sharing options...
PCjero Posted October 13, 2019 Share Posted October 13, 2019 Very interesting my friend... whyperioN 1 Link to comment Share on other sites More sharing options...