firedihm Posted February 4, 2022 Share Posted February 4, 2022 My current scripts works as following: 05E2: call_function_return 0x4A1030 num_params 0 pop 0 [email protected] //FindPlayerCoors 05E1: call_function 0x40AA30 num_params 1 pop 1 [email protected] //CStreaming::StreamZoneModels The first function returns player coordinates as CVector. The second one accepts it as it's only argument. The game crashes with code. Link to comment Share on other sites More sharing options...
OrionSR Posted February 5, 2022 Share Posted February 5, 2022 I'm not familiar with these functions but, wouldn't you need more variables? struct CVector { float x; float y; float z; }; firedihm 1 Link to comment Share on other sites More sharing options...
firedihm Posted February 5, 2022 Author Share Posted February 5, 2022 @OrionSR I've tried that – it still crashes. The first function only returns CVector Link to comment Share on other sites More sharing options...
cjfan_ Posted February 5, 2022 Share Posted February 5, 2022 Use 00A0 GET_CHAR_COORDINATES to get the coordinates. CStreaming::StreamZoneModels needs a pointer argument so if store the coords at vars [email protected] [email protected] [email protected] then if you use 0AC7 GET_VAR_POINTER on [email protected] it should work. firedihm 1 Link to comment Share on other sites More sharing options...
firedihm Posted February 5, 2022 Author Share Posted February 5, 2022 @cjfan_ It did not, unfortunately. I even tried writing [email protected] [email protected] [email protected] into array and getting pointer to [email protected] to no avail Link to comment Share on other sites More sharing options...
cjfan_ Posted February 5, 2022 Share Posted February 5, 2022 13 minutes ago, firedihm said: @cjfan_ It did not, unfortunately. I even tried writing [email protected] [email protected] [email protected] into array and getting pointer to [email protected] to no avail Post the script firedihm 1 Link to comment Share on other sites More sharing options...
firedihm Posted February 5, 2022 Author Share Posted February 5, 2022 @cjfan_ the two lines in OP should be enough. I just need to make two calls work. Link to comment Share on other sites More sharing options...
Jack Posted February 5, 2022 Share Posted February 5, 2022 (edited) 13 hours ago, firedihm said: My current scripts works as following: 05E2: call_function_return 0x4A1030 num_params 0 pop 0 [email protected] //FindPlayerCoors 05E1: call_function 0x40AA30 num_params 1 pop 1 [email protected] //CStreaming::StreamZoneModels The first function returns player coordinates as CVector. The second one accepts it as it's only argument. The game crashes with code. Usually in scm CVector is defined like this: [email protected] [email protected] [email protected] // coordinates [email protected] // CVector so: {$CLEO} 0000: repeat wait 250 until 0256: player $PLAYER_CHAR defined while true wait 0 0054: store_player $PLAYER_CHAR position_to [email protected] [email protected] [email protected] 05E1: call 0x40AA30 num_params 1 pop 1 [email protected] end I didn't use the 1st function though. EDIT: Also new versions of cleo should support opcode IDs such as: 00A0: store_actor $PLAYER_ACTOR position_to $sound_x $sound_y $sound_z // 0054 0A8C: write_memory 0xC0BC15 size 4 value 1 virtual_protect 0 // 05DF 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // 05E0 0A96: [email protected] = actor $PLAYER_ACTOR struct // 05E6 0AA5: call $hPROC num_params 1 pop 1 $param // 05E1 0AA6: call_method $Destroy struct [email protected] num_params 0 pop 0 // 05E2 0AA7: call_function 0x569660 num_params 2 pop 2 $COORD_Y $COORD_X $GROUND // 05E3 0AA8: call_function_method 0x4048E0 struct [email protected] num_params 1 pop 0 $MyCar [email protected] // 05E4 . . . Edited February 5, 2022 by Jack firedihm 1 Wanted Level Editor Gore Level Effect [III] My YouTube Channel Link to comment Share on other sites More sharing options...
firedihm Posted February 5, 2022 Author Share Posted February 5, 2022 Thanks for the replies, everyone. I/ve instead decided to call CStreaming::Update and it did the trick Link to comment Share on other sites More sharing options...
OrionSR Posted February 5, 2022 Share Posted February 5, 2022 (edited) 7 hours ago, firedihm said: @OrionSR I've tried that – it still crashes. The first function only returns CVector I've got one working example of using CVector in a function. The key lesson I learned was to pop the arguments in the reverse order - something to do with how variables are arranged on the stack. From DK22Pac's plugin reference for CWanted: static int WorkOutPolicePresence(CVector posn, float radius); Function is expecting CVector and radius. Relevant codes in my scripts: 00A0: store_actor $PLAYER_ACTOR position_to x_float y_float z_float 0AA7: WorkOutPolicePresence num_params 4 pop 4 civil z_float y_float x_float num_cops So, popping radius, Z, Y, X and expecting an integer of cops within the radius. Full script displays cops in range above the hud (GTASA PCv1): Spoiler {$CLEO .cs} //CopRange.txt const WorkOutPolicePresence = 0x5625F0 civil = 14.0 in_range = 18.0 criminal = 30.0 federal = 60.0 // x_pos = 20.0 // y_pos = 430.0 x_pos = 505.0 y_pos = 14.0 x_float = [email protected] y_float = [email protected] z_float = [email protected] num_cops = [email protected] end 03A4: name_thread 'CRANGE' wait 6000 0ADF: add_dynamic_GXT_entry "Range00" text "~1~ Police > 60m" 0ADF: add_dynamic_GXT_entry "Range14" text "~1~ Police < 14m" 0ADF: add_dynamic_GXT_entry "Range18" text "~1~ Police < 18m" 0ADF: add_dynamic_GXT_entry "Range30" text "~1~ Police < 30m" 0ADF: add_dynamic_GXT_entry "Range60" text "~1~ Police < 60m" while true wait 0 00A0: store_actor $PLAYER_ACTOR position_to x_float y_float z_float 0AA7: WorkOutPolicePresence num_params 4 pop 4 civil z_float y_float x_float num_cops 03F0: enable_text_draw 1 081C: draw_text_outline 1 RGBA 0 0 0 255 0343: set_text_draw_linewidth 640.0 033F: set_text_draw_letter_size 0.36 0.84 if num_cops > 0 then 045A: draw_text_1number x_pos y_pos GXT 'Range14' number num_cops else 0AA7: WorkOutPolicePresence num_params 4 pop 4 in_range z_float y_float x_float num_cops if num_cops > 0 then 045A: draw_text_1number x_pos y_pos GXT 'Range18' number num_cops else 0AA7: WorkOutPolicePresence num_params 4 pop 4 criminal z_float y_float x_float num_cops if num_cops > 0 then 045A: draw_text_1number x_pos y_pos GXT 'Range30' number num_cops else 0AA7: WorkOutPolicePresence num_params 4 pop 4 federal z_float y_float x_float num_cops if num_cops > 0 then 045A: draw_text_1number x_pos y_pos GXT 'Range60' number num_cops // else // 045A: draw_text_1number x_pos y_pos GXT 'Range00' number num_cops end end end end end Edited February 5, 2022 by OrionSR firedihm 1 Link to comment Share on other sites More sharing options...
Grand Theft Tanks 2 Posted February 13, 2022 Share Posted February 13, 2022 Alguien me pasa el Misterix mod Link to comment Share on other sites More sharing options...