Quantcast

Jump to content

» «
Photo

[SA] CLEO How to check if the player is getting hurt

  • This topic is locked This topic is locked
6 replies to this topic
davis60
  • davis60

    I, me and myself

  • Members
  • Joined: 08 Feb 2014
  • India

#1

Posted 17 July 2014 - 06:50 AM Edited by davis60, 17 July 2014 - 06:51 AM.

I am fixing the gta 5 regeneration cleo. I want the file to check if the player is getting hurt. If the player do not get hurt till 15 secs after his health reaches below 50% then his health will regenerate and it he gets hurt during this process the regeneration stops.

Thanks in advance.


madleg
  • madleg

    Player Hater

  • Members
  • Joined: 01 Jan 2014
  • Russia

#2

Posted 17 July 2014 - 07:59 AM

store actors health on script start > check in loop difference between stored and current hp > if hp less than was, store it (like in step 1) and do your tasks

  • davis60 likes this

davis60
  • davis60

    I, me and myself

  • Members
  • Joined: 08 Feb 2014
  • India

#3

Posted 17 July 2014 - 09:44 AM

Yeah I did that but how to check if he is getting hurt or not?


madleg
  • madleg

    Player Hater

  • Members
  • Joined: 01 Jan 2014
  • Russia

#4

Posted 17 July 2014 - 10:20 AM Edited by madleg, 17 July 2014 - 10:36 AM.

Yeah I did that but how to check if he is getting hurt or not?

so what? the difference between stored i previous script cycle health value and current script cycle health value will tell you got he hurt

0@ = actors health
// google about 33 cleo variable

while true
    wait 0
    1@ = actors health
    // checking if actor increased his hp (with code or smtnh)
    if
        1@ > 0@
        then
        0@ = 1@
    end
    // if actor was hurt, his hp will be less and then increase timer
    if
        0@ > 1@
        then
        33@ = 0
    end
    // checking if actors health (1@) less than 50, then check timer; if all true - increase hp and store health value for hurt check
    if and
        1@ < 50
        33@ > 15000
        then
        1@ += 1
        set actors health 1@
        0@ = 1@
    end
end 
        

  • davis60 likes this

davis60
  • davis60

    I, me and myself

  • Members
  • Joined: 08 Feb 2014
  • India

#5

Posted 17 July 2014 - 10:59 AM Edited by davis60, 17 July 2014 - 11:21 AM.

still not working, I am a newbie :p

// This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.2013
{$CLEO .cs}

//-------------MAIN---------------
0000: NOP 
jump @NONAME_43 

:NONAME_43
1@ = Actor.Health($PLAYER_ACTOR)
wait 0 
if 
   not 1@ >= 50 
jf @NONAME_43 
jump @REGEN_43

:REGEN_43 
3@ = Actor.Health($PLAYER_ACTOR)
wait 7000  
4@ = Actor.Health($PLAYER_ACTOR)
wait 8000 
if  
003B:   not 3@ == 4@ // (int) 
jf @REGEN_43 
jump @NONAME_9

:NONAME_9 
0@ = Actor.Health($PLAYER_ACTOR)
wait 50
0@ += 0.5 
Actor.Health($PLAYER_ACTOR) = 0@
jump @NONAME_43   


ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union

#6

Posted 17 July 2014 - 05:37 PM

script displays a text message when player recieve damage

{$CLEO .cs}
:Player_recieve_damage
thread 'PLAYDAM'

:PLAYDAM_1
wait 0 
if 
   Player.Defined($PLAYER_CHAR)
jf @PLAYDAM_1
0@ = Actor.Health($PLAYER_ACTOR)
04DD: 2@ = actor $PLAYER_ACTOR armour

:PLAYDAM_2
wait 0 
if 
   Player.Defined($PLAYER_CHAR)
jf @PLAYDAM_1
1@ = Actor.Health($PLAYER_ACTOR)
04DD: 3@ = actor $PLAYER_ACTOR armour
if  or
001D:   0@ > 1@ // (int)
001D:   2@ > 3@ // (int) 
jf @PLAYDAM_3
0@ = Actor.Health($PLAYER_ACTOR)
04DD: 2@ = actor $PLAYER_ACTOR armour
00BA: show_text_styled GXT 'BJ_LOSE' time 500 style 4
jump @PLAYDAM_2

:PLAYDAM_3
if  or
001D:   1@ > 0@ // (int)
001D:   3@ > 2@ // (int)
jf @PLAYDAM_2
0@ = Actor.Health($PLAYER_ACTOR)
04DD: 2@ = actor $PLAYER_ACTOR armour
jump @PLAYDAM_2

davis60
  • davis60

    I, me and myself

  • Members
  • Joined: 08 Feb 2014
  • India

#7

Posted 18 July 2014 - 01:34 AM

Thanks, but I already solved that http://gtaforums.com...avis60-version/

 

wow ZAZ replied to my thread :colgate:





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users