CLEO Help If a player is in a vehicle do a chat command.

CLEO related
Status
Not open for further replies.

hardkor

Active member
Joined
Jun 16, 2019
Messages
28
Reaction score
0
I want to create if a player is in a vehicle do a chat command. In this case, I need every time the player enters a vehicle after like a 3-sec chat command /upgrade gets sent.
I found a code in this thread http://ugbase.eu/index.php?threads/snippet-write-in-chat-without-sfuncs-0af8-0af9.3814/
I tried making it by myself but I don't know Cleo. And it's for 0.3DL.


Code:
{$CLEO .cs}
0000:

wait 10000 /// wait 10sec until samp is redy

const
SAMP_CHAT_INFO_OFFSET_03DL = 0x2ACA10
FUNC_ADDTOCHATWND_03DL = 0x67650
FUNC_SAY_03DL = 0x5860
FUNC_SEND_CMD_03DL = 0x69340
end

0AC8: 0@ = allocate_memory_size 260
0AD3: 0@ = format "/upgrade"


WHILE TRUE
    WAIT 0
 

wait 1500
0AB1: @SEND_CMD 1 text 0@
 
END

:SAY
//0AB1: @SAY 1 $text
IF 0AA2: 1@ = "samp.dll"
THEN
    1@ += FUNC_SAY_03DL
    0AA5: call 1@ num_param 1 pop 0 0@
END
0AB2: 0


:Chatmsg
//0AB1: @Chatmsg 2 $color $text
IF 0AA2: 2@ = "samp.dll"
THEN
    0085: 3@ = 2@
    3@ += SAMP_CHAT_INFO_OFFSET_03DL
    0A8D: 3@ = readMem 3@ sz 4 vp 1
    0085: 4@ = 2@
    4@ += FUNC_ADDTOCHATWND_03DL 
    0AA6: call 4@ struct 3@ num_params 5 pop 0 params 0 0@ 0 1@ 8
END
0AB2: 0

:SEND_CMD
//0AB1: @SEND_CMD 1 $text
IF 0AA2: 1@ = "samp.dll"
THEN
    1@ += FUNC_SEND_CMD_03DL
    0AA5: call 1@ num_param 1 pop 0 0@
END
0AB2: 0
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
PHP:
if and
0AB0:   key_pressed 75
00DF:   actor $PLAYER_ACTOR driving
then
0AB1: @SEND_CMD 1 text 0@
wait 1000 // 1000 ms = 1sec - timer to block key spam
End

or

PHP:
if
0AB0:   key_pressed 75
then
0AB1: @SEND_CMD 1 text 0@
wait 1000 // 1000 ms = 1sec - timer to block key spam
End
 

hardkor

Active member
Joined
Jun 16, 2019
Messages
28
Reaction score
0
PHP:
if and
0AB0:   key_pressed 75
00DF:   actor $PLAYER_ACTOR driving
then
0AB1: @SEND_CMD 1 text 0@
wait 1000 // 1000 ms = 1sec - timer to block key spam
End

or

PHP:
if
0AB0:   key_pressed 75
then
0AB1: @SEND_CMD 1 text 0@
wait 1000 // 1000 ms = 1sec - timer to block key spam
End


This works but for some weird reason, it only works in the lobby when the actual game starts bind stops working.
 

hardkor

Active member
Joined
Jun 16, 2019
Messages
28
Reaction score
0
Which one?
This one.


PHP:
{$CLEO .cs}
0000:

wait 10000 /// wait 10sec until samp is redy

0AC8: 0@ = allocate_memory_size 260
0AD3: 0@ = format "/upgrade"


WHILE TRUE
    WAIT 0
if
0AB0:   key_pressed 75
then
0AB1: @SEND_CMD 1 text 0@
wait 1000 // 1000 ms = 1sec - timer to block key spam
End

END

:SAY
//0AB1: @SAY 1 $text
IF 0AA2: 1@ = "samp.dll"
THEN
    1@ +=  0x5860 //FUNC_SAY_03DL
    0AA5: call 1@ num_param 1 pop 0 0@
END
0AB2: 0


:Chatmsg
//0AB1: @Chatmsg 2 $color $text
IF 0AA2: 2@ = "samp.dll"
THEN
    0085: 3@ = 2@
    3@ += 0x2ACA10 //SAMP_CHAT_INFO_OFFSET_03DL
    0A8D: 3@ = readMem 3@ sz 4 vp 1
    0085: 4@ = 2@
    4@ +=  0x67650 //FUNC_ADDTOCHATWND_03DL
    0AA6: call 4@ struct 3@ num_params 5 pop 0 params 0 0@ 0 1@ 8
END
0AB2: 0

:SEND_CMD
//0AB1: @SEND_CMD 1 $text
IF 0AA2: 1@ = "samp.dll"
THEN
    1@ += 0x69340   //FUNC_SEND_CMD_03DL
    0AA5: call 1@ num_param 1 pop 0 0@
END
0AB2: 0
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
This one.

PHP:
{$CLEO .cs}

0000:

wait 8500 // wait until samp is redy

0AC8: 0@ = allocate_memory_size 260
0AD3: 0@ = format "/upgrade"

WHILE TRUE
    WAIT 0
    
IF
0AB0: 75
THEN
    0AB1: @PROCESS_CHAT_INPUT 3 OpenChatBox=> 0 InputText 0@ ProcessInput 1 // 1 = true , 0 = false
    REPEAT
    WAIT 0
    UNTIL 8AB0: 75 // repeat wait until key 85 will be released
END
                    
END

:PROCESS_CHAT_INPUT
{
    0.3.DL
    Ex.: 
    0AB1: @PROCESS_CHAT_INPUT 3 OpenChatBox=> 1 InputText 0@ ProcessInput 1
}
IF 0AA2: 20@ = "samp.dll"
THEN
    0A8E: 21@ = 20@ + 0x2ACA14            // SAMP_CHAT_INPUT_INFO_OFFSET
    0A8D: 22@ = readMem 21@ sz 4 vp 0     // pChatInput;
    0A8E: 26@ = 22@ + 0x8                // pChatInput->pEditBox;
    0A8D: 27@ = readMem 26@ sz 4 vp 0     // pEditBox;
    
    IF
    0@ == 1
    THEN
        0A8E: 23@ = 20@ + 0x68EC0 //SAMP_CHAT_INPUT_OPEN
    ELSE
        0A8E: 23@ = 20@ + 0x68FC0 //SAMP_CHAT_INPUT_CLOSE
    END
    0AA8: call_function_method 23@ struct 22@ num_params 0 pop 0 _retVal 6@
    
    0A8E: 24@ = 20@ + 0x85000 // CDXUTEditBox::SetText
   
    0AA8: call_function_method 24@ struct 27@ num_params 2 pop 0 _bSelected 0 _pszText 1@ _retVal 6@
    
    IF
    2@ == 1
    THEN
        0A8E: 25@ = 20@ + 0x69410 // PROCESS_INPUT 
        0AA8: call_function_method 25@ struct 22@ num_params 0 pop 0 _retVal 6@ 
    END
END
0AB2: 0

:SAY
{
    0.3.DL
    Ex.: 
    0AB1: @SAY 1 0@
}
IF 0AA2: 1@ = "samp.dll"
THEN
    1@ += 0x5860 //FUNC_SAY_03DL
    0AA5: call 1@ num_param 1 pop 0 0@
END
0AB2: 0


:Chatmsg
{
    0.3.DL
    Ex.: 
    0AB1: @Chatmsg 2 0xFF0000FF 0@
}
IF 0AA2: 2@ = "samp.dll"
THEN
    0085: 3@ = 2@
    3@ += 0x2ACA10 // SAMP_CHAT_INFO_OFFSET_03DL
    0A8D: 3@ = readMem 3@ sz 4 vp 1
    0085: 4@ = 2@
    4@ += 0x67650 // FUNC_ADDTOCHATWND_03DL
    0AA6: call 4@ struct 3@ num_params 5 pop 0 params 0 0@ 0 1@ 8
END
0AB2: 0
 
Status
Not open for further replies.
Top