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

  • Members
  • Joined: 01 Jan 2014
  • None

#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

  • Members
  • Joined: 01 Jan 2014
  • None

#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

[email protected] = actors health
// google about 33 cleo variable

while true
    wait 0
    [email protected] = actors health
    // checking if actor increased his hp (with code or smtnh)
    if
        [email protected] > [email protected]
        then
        [email protected] = [email protected]
    end
    // if actor was hurt, his hp will be less and then increase timer
    if
        [email protected] > [email protected]
        then
        [email protected] = 0
    end
    // checking if actors health ([email protected]) less than 50, then check timer; if all true - increase hp and store health value for hurt check
    if and
        [email protected] < 50
        [email protected] > 15000
        then
        [email protected] += 1
        set actors health [email protected]
        [email protected] = [email protected]
    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
[email protected] = Actor.Health($PLAYER_ACTOR)
wait 0 
if 
   not [email protected] >= 50 
jf @NONAME_43 
jump @REGEN_43

:REGEN_43 
[email protected] = Actor.Health($PLAYER_ACTOR)
wait 7000  
[email protected] = Actor.Health($PLAYER_ACTOR)
wait 8000 
if  
003B:   not [email protected] == [email protected] // (int) 
jf @REGEN_43 
jump @NONAME_9

:NONAME_9 
[email protected] = Actor.Health($PLAYER_ACTOR)
wait 50
[email protected] += 0.5 
Actor.Health($PLAYER_ACTOR) = [email protected]
jump @NONAME_43   


ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union
  • Contribution Award [Mods]
    Helpfulness Awards [Mods]

#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
[email protected] = Actor.Health($PLAYER_ACTOR)
04DD: [email protected] = actor $PLAYER_ACTOR armour

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

:PLAYDAM_3
if  or
001D:   [email protected] > [email protected] // (int)
001D:   [email protected] > [email protected] // (int)
jf @PLAYDAM_2
[email protected] = Actor.Health($PLAYER_ACTOR)
04DD: [email protected] = 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