CLEO Help Problem with cars

CLEO related
Status
Not open for further replies.

RewardK

Member
Joined
Jun 2, 2018
Messages
13
Reaction score
0
Hello ugbase!

I have a small problem. I tried to create a script that when a player enters in my car, to automatically type /heal [playerid] 1000.

I had some cases. If the player is Paramedic, i need to offer to him heal for only $1.
If that player have enough health (> 95.0) to type "You have enough health!".

But I have a small problem.

My script:

Rich (BB code):
{$CLEO .cs}
0000: NOP

repeat
wait 0
until 0AFA: is_samp_structures_available

0B34: "tog" @turn
0B34: "heals" @heals

10@ = 0
11@ = 0
12@ = 0                           
                          
// main loop

while true
    wait 0

    if 0@ == true
    then

        for 1@ = 0 to 999
            if and 
                0B23: samp is_player_connected 1@
                0B20: samp 2@ = actor_handle_from_samp_playerid 1@
            then
                00D9: 3@ = actor $PLAYER_ACTOR car
                00D9: 4@ = actor 2@ car

                0226: 5@ = actor 2@ health                                                                                                       
            
                6@ = SAMP.GetPlayerNickname(1@)
                0B37: samp 7@ = get_player_color 1@
                0AD3: 8@v = format "%x" 7@
            
                if and
                    003B: 3@ == 4@
                
                    003B: 3@ != 0
                    003B: 4@ != 0
                then
                
                    if 5@ >= 95
                    then
                        0AF9: samp say_msg "You have enough health, %s." 6@
                        000A: 12@ += 1
                    
                        wait 10000
                    else
                
                        if 0C29: $NOT_USED = stristr string1 8@v string2 "ffff6347"
                        then
                            0AF9: samp say_msg "/heal %d 1" 1@
                            0AF9: samp say_msg "/cw Thanks, %s!" 6@
                            000A: 11@ += 1
                        
                            wait 10000
                        else       
                            0AF9: samp say_msg "/heal %d 1000" 1@
                            0AF9: samp say_msg "/cw Thanks, %s for help!" 6@
                            000A: 10@ += 1
                        
                            wait 10000
                        end
                    end
                    
                end
            end
        
        end

    end
end

:heals

chatmsg " --- Heal Stats --- " -1
chatmsg "Players healed: %d" -1 10@
chatmsg "Paramedics healed: %d" -1 11@
chatmsg "Players that had enough health: %d" -1 12@

SAMP.CmdRet()


// cmd
:turn
0B12: 0@ = 0@ XOR true

if 0@ == true
then
    chatmsg "Program turned on." -1
else
    chatmsg "Program turned off." -1
end
SAMP.CmdRet()

Now, the problem is where i check if the player is in my vehicle, there:
Code:
if and
   003B: 3@ == 4@
             
   003B: 3@ != 0
   003B: 4@ != 0
then

Is there any problem for my script doesn't work?
When I turn on my code, i get this: (see attach)

What I type in chat means: "I can't give you heal, %s, you have enough health. Please get down from the car", but in another language.
My code run for every player, like that verify where i check if the player is in my car (as passenger) doesn't exists.

What's wrong? I can't understand.

Thanks in advice. Sorry for my bad english.

EDIT: I forgot to say something. I tried something. Paramedics, on the server, have that nick color. To check if a player is paramedic I tried to check if his color is like this: "ffff6347". You can see that on the script.

EDIT2: I tried something. Maybe is close to the answer:
Code:
{$CLEO .cs}
0000: NOP

repeat
wait 0
until 0AFA: is_samp_structures_available

0B34: "tog" @turn
0B34: "heals" @heals

10@ = 0
11@ = 0
12@ = 0                              
                              
// main loop

while true
    wait 500
   
    if 0@ == true
    then
   
        for 1@ = 0 to 999
            if and     
                0B23: samp is_player_connected 1@
                0B20: samp 2@ = actor_handle_from_samp_playerid 1@
            then
                                       
                00D9: 3@ = actor $PLAYER_ACTOR car
                00D9: 4@ = actor 2@ car
                                                                                                              
                6@ = SAMP.GetPlayerNickname(1@)
                0B37: samp 7@ = get_player_color 1@   
                0AD3: 8@v = format "%x" 7@
               
                0226: 5@ = actor 2@ health
                               
                chatmsg "%s (%d) (actorhandle: %d) is streamed (car: %d | mycar: %d | color: %s | health: %d)." -1 6@ 1@ 2@ 4@ 3@ 8@v 5@
               
                if and
                    003B:   3@ == 4@
                    0039:   3@ != -1
                    0039:   4@ != -1
                then
                   
                    if
                        5@ >= 95.0
                    then
                        0AF9: samp say_msg "You have enough health %s." 6@
                        000A: 12@ += 1
                       
                        wait 10000
                    else
                   
                        if 0C29: $NOT_USED = stristr string1 8@v string2 "ffff6347"
                        then
                            0AF9: samp say_msg "/heal %d 1" 1@
                            0AF9: samp say_msg "/cw Thanks, %s!" 6@
                            000A: 11@ += 1
                           
                            wait 10000
                        else          
                            0AF9: samp say_msg "/heal %d 1000" 1@
                            0AF9: samp say_msg "/cw Thanks, %s!" 6@
                            000A: 10@ += 1
                           
                            wait 10000
                        end
                    end
                        
                end
            end
           
        end

    end
end

:heals // in romanian (unused)

chatmsg " --- Statistici heal-uri --- " -1
chatmsg "Puncte la raport obtiunte: %d" -1 10@
chatmsg "Paramedici vindecati: %d" -1 11@
chatmsg "Playeri care aveau destula viata: %d" -1 12@

SAMP.CmdRet() 


// cmd
:turn
0B12: 0@ = 0@ XOR true

if 0@ == true
then
    chatmsg "Program turned on." -1
else
    chatmsg "Program turned off." -1
end
SAMP.CmdRet()

In my debug i see this: Why player health is 0.00000?
Why even if i am in a car, 'car' and 'mycar' are 0?
What are the problems?
 

Attachments

  • 1563453371410.png
    1563453371410.png
    306.3 KB · Views: 5
Last edited:

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
PHP:
{$CLEO .cs}
0000: NOP

repeat
wait 0
until 0AFA:

0B34: "tog" @turn
0B34: "heals" @heals 
 
WHILE TRUE
    WAIT 0   
IF AND
0@ == TRUE
056D:   actor $PLAYER_ACTOR defined 
THEN
    WAIT 0 
    // GET ALL STREAMED PEDS     
    0A8D: 29@ = read_memory 0xB74490 size 4 virtual_protect 0
    000A: 29@ += 0x4
    0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0
    FOR 30@ = 0 to 35584 step 0x100
        0A8D: 31@ = read_memory 29@ size 1 virtual_protect 0
        000A: 29@ += 0x1
        IF AND
            0029:  31@ >= 0x00 
            001B:  0x80 > 31@
        THEN 
            005A: 31@ += 30@
                IF AND
                803B:   31@ == $PLAYER_ACTOR  // (int)
                056D:   actor 31@ defined
                THEN
                    IF AND
                    00DF:   actor 31@ in_car_or_driving
                    00DF:   actor $PLAYER_ACTOR in_car_or_driving
                    THEN
                        03C0: 1@ = actor $PLAYER_ACTOR car
                        03C0: 2@ = actor 31@ car
                        IF
                        003B:   1@ == 2@  // if same car
                        THEN
                            0B2B: samp 3@ = get_player_id_by_actor_handle 31@
                            0226: 4@ = actor 3@ health
                            0B37: samp 5@ = get_player_color 3@
                            0B36: samp 6@ = get_player_nickname 3@
                            IF
                            4@ >= 95
                            THEN
                                0AF9: samp say_msg "You have enough health, %s." 6@
                                12@ += 1
                                wait 10000 
                            ELSE
                                IF
                                5@ == 0xFFFF6347
                                THEN
                                    0AF9: samp say_msg "/heal %d 1" 3@
                                    0AF9: samp say_msg "/cw Thanks, %s!" 6@
                                    000A: 11@ += 1
                                    wait 10000
                                ELSE
                                    0AF9: samp say_msg "/heal %d 1000" 3@
                                    0AF9: samp say_msg "/cw Thanks, %s for help!" 6@
                                    000A: 10@ += 1
                                    wait 10000
                                END
                            END
                        END
                    END
               END 
           END
       END
   END
END

:heals
chatmsg " --- Heal Stats --- " -1
chatmsg "Players healed: %d" -1 10@
chatmsg "Paramedics healed: %d" -1 11@
chatmsg "Players that had enough health: %d" -1 12@
SAMP.CmdRet()


// cmd
:turn
0B12: 0@ = 0@ XOR true
if 0@ == true
then chatmsg "Program turned on." -1
else chatmsg "Program turned off." -1
end
SAMP.CmdRet()
 
Status
Not open for further replies.
Top