Quantcast

Jump to content

» «
Photo

[SA|CLEO4]Killed ped opcode

4 replies to this topic
Ghost_Rider3
  • Ghost_Rider3

    KEEP CALM

  • Members
  • Joined: 21 May 2014
  • Romania

#1

Posted 24 June 2014 - 11:10 AM

Hi.Is there any ocpode that "see" is PLAYER_ACTOR killed any ped ,then for example draw a texture on screen.


fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009
  • None

#2

Posted 24 June 2014 - 11:23 AM

Stat:
121 People you've wasted

You have to read this stat in loop.
Read new value, check if new value is higher than previous value. If yes, then do something, then assign a new value to variable.

Untested code
{$CLEO}
0000: NOP

:loop
wait 0

0652: get_int_stat 121 store_to 1@  // get new value
if
001D:   1@ > 0@   // is new value greater than old value
goto_if_false @loop
0085: 0@ = 1@  // (int)  ; update value of people killed in variable.

// do something
// draw some texture
goto @loop


  • Silent and Ghost_Rider3 like this

Ghost_Rider3
  • Ghost_Rider3

    KEEP CALM

  • Members
  • Joined: 21 May 2014
  • Romania

#3

Posted 24 June 2014 - 05:19 PM Edited by Ghost_Rider3, 24 June 2014 - 05:21 PM.

@fastman92 Thanks,but your example don't work;i get when i want to compile unknown directive goto_if_false.I put in place of goto_if_false ,else_jump @loop;and i compiled it (now worked),but the game crash at loading screen.(i have a file named ped with texture named 1 in models/txd)

 

This is the code:

{$CLEO}
0000: NOP
0390: load_txd_dictionary "ped"
038F: load_texture "1" as 1

:loop
wait 0
0652: get_int_stat 121 store_to 1@  
if
001D:   1@ > 0@
else_jump @loop
0085: 0@ = 1@
038D: draw_texture 1 position 570.0 85.0 size 133.0 23.0 RGBA 255 255 255 255
0001: wait 6000
03F0: enable_text_draw 0  
goto @loop

 

The i made this code,and don't worked aswell:

{$CLEO}
0000: NOP
thread 'loop'
0390: load_txd_dictionary "ped"
038F: load_texture "1" as 1
0652: get_int_stat 121 store_to 0@   

:loop
wait 0
0652: get_int_stat 121 store_to 1@  
if
001D:   1@ > 0@
else_jump @loop
0085: 0@ = 1@
038D: draw_texture 1 position 570.0 85.0 size 133.0 23.0 RGBA 255 255 255 255
0001: wait 6000
03F0: enable_text_draw 0  
jump @loop

 

Can you help me,please?






 


Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#4

Posted 24 June 2014 - 07:28 PM Edited by Deji, 24 June 2014 - 09:39 PM.

I preferred the first snippet (though the fact you initialised 0@ before starting the loop in the 2nd deserves bonus credit), so I'll work from that.
 

This is the code:
 

{$CLEO}
0000: NOP
0390: load_txd_dictionary "ped"
038F: load_texture "1" as 1
 
0652: get_int_stat 121 store_to 0@  // good idea, the stat might not start from 0 - in which case the condition would pass immediately the first time

:loop
wait 0
0652: get_int_stat 121 store_to 1@  
if
001D:   1@ > 0@
else_jump @loop
0085: 0@ = 1@

 
Logically valid so far. In fact, you could simply add this to the end and you'd have a working example of what you asked for:
 
0ACC: print_string "Look at me, look at me!" time 1000
jump @loop
 
In fact, it's the code you didn't ask for help for which is more concerning:
 
038D: draw_texture 1 position 570.0 85.0 size 133.0 23.0 RGBA 255 255 255 255
0001: wait 6000
03F0: enable_text_draw 0  
jump @loop
You should look up 03F0.

Since you've not set the 03F0 flag, it could currently be anything, depending on other running scripts (including the main.scm in some cases). Really, you should use the 'enable once' mode and re-draw the texture every frame (applying the same flag each time) until you want it to disappear, because otherwise another script can change the setting and cause the draws to stack up infinitely until the game crashes or simply not show the texture at all.

EDIT: And once again, GTAF loses half my post. Fixed.
  • Ghost_Rider3 likes this

Ghost_Rider3
  • Ghost_Rider3

    KEEP CALM

  • Members
  • Joined: 21 May 2014
  • Romania

#5

Posted 25 June 2014 - 10:53 AM

Thanks fastman for helping me.I used your cod with 2nd end(with texture draw,not printstring) and the game crash at loadin screen(i have the txd file).I texted on 3 gta sa cleo version cleo 4.3.1 non modded,cleo 4.1.1 modded,cleo 4.1.1 non modded ....crash every time.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users