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
 

san11

Active member
Joined
Aug 13, 2015
Messages
51
Reaction score
3
I tried this, every 3 seconds it will type /upgrade in chatbox

Code:
{$CLEO .cs}

0000:

while true
wait 0

if
00DF:   actor $PLAYER_ACTOR driving
then
    wait 3000
    say "/upgrade"
 end
 end
 

Attachments

  • sayupgrade.cs
    17.3 KB · Views: 1

Ravenous

Active member
Joined
Jan 21, 2016
Messages
61
Reaction score
4
use this
Code:
{$CLEO}
0000: NOP
repeat
wait 50
until 0AFA: is_samp_structures_available
1@ = 1

while true
wait 0
alloc 0@ 256
format 0@ "z"
    if Actor.Driving($PLAYER_ACTOR)
    then
        if 1@ == 1
        then
            wait 500
            0AB1: @SAY 1 0@
            1@ = 0
        end
    else
        1@ = 1
    end
free 0@
end

:SAY
IF 0AA2: 1@ = "samp.dll"
THEN
    1@ += 0x5860
    0AA5: call 1@ num_param 1 pop 0 0@
END
0AB2: 0
 
Last edited:

hardkor

Active member
Joined
Jun 16, 2019
Messages
28
Reaction score
0
I this but I get compiler error Unknown directive say "/upgrade"

Code:
{$CLEO .cs}

0000:

while true
wait 0

if
00DF:   actor $PLAYER_ACTOR driving
then
    wait 3000
    say "/upgrade"
 end
 end

And I tried this and I get compiler error alloc 0@ 256.

Code:
{$CLEO}
0000: NOP
repeat
wait 50
until 0AFA: is_samp_structures_available
1@ = 1

while true
wait 0
alloc 0@ 256
format 0@ "z"
    if Actor.Driving($PLAYER_ACTOR)
    then
        if 1@ == 1
        then
            wait 500
            0AB1: @SAY 1 0@
            1@ = 0
        end
    else
        1@ = 1
    end
free 0@
end

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

Parazitas

God
Joined
Jan 2, 2017
Messages
3,103
Solutions
5
Reaction score
882
Location
Lithuania
PHP:
{$CLEO .cs}
0000:

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

const
FUNC_SEND_CMD_03DL = 0x69340
end

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


WHILE TRUE
    WAIT 0
if
00DF:   actor $PLAYER_ACTOR driving
then
wait 700 // ms
0AB1: @SEND_CMD 1 text 0@
Repeat
Wait 0
Until 80DF:   actor $PLAYER_ACTOR driving /// not driving , not in car
End

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
 

hardkor

Active member
Joined
Jun 16, 2019
Messages
28
Reaction score
0
PHP:
{$CLEO .cs}
0000:

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

const
FUNC_SEND_CMD_03DL = 0x69340
end

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


WHILE TRUE
    WAIT 0
if
00DF:   actor $PLAYER_ACTOR driving
then
0AB1: @SEND_CMD 1 text 0@
Repeat
Wait 0
Until 80DF:   actor $PLAYER_ACTOR driving /// not driving , not in car
End

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

I tried I get this when I try to compile

Code:
Incorrect expression 1@ += FUNC_SAY_03DL.
One of the variables has unknown type, or operands are incompatible.
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,103
Solutions
5
Reaction score
882
Location
Lithuania
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
00DF:   actor $PLAYER_ACTOR driving
then
wait 700 // ms
0AB1: @SEND_CMD 1 text 0@
Repeat
Wait 0
Until 80DF:   actor $PLAYER_ACTOR driving /// not driving , not in car
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
 
Last edited:

hardkor

Active member
Joined
Jun 16, 2019
Messages
28
Reaction score
0
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
00DF:   actor $PLAYER_ACTOR driving
then
wait 700 // ms
0AB1: @SEND_CMD 1 text 0@
Repeat
Wait 0
Until 80DF:   actor $PLAYER_ACTOR driving /// not driving , not in car
End

END

:SAY
//0AB1: @SAY 1 $text
IF 0AA2: 1@ = "samp.dll"
THEN
    1@ += 0x69340
    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

I am sorry but I don't know is there is a problem on my end but I get this error from the compiler.

Code:
Incorrect expression 3@ += SAMP_CHAT_INFO_OFFSET_03DL.
One of the variables has unknown type, or operands are incompatible.
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,103
Solutions
5
Reaction score
882
Location
Lithuania
I am sorry but I don't know is there is a problem on my end but I get this error from the compiler.

Code:
Incorrect expression 3@ += SAMP_CHAT_INFO_OFFSET_03DL.
One of the variables has unknown type, or operands are incompatible.
Edited last post.
 

hardkor

Active member
Joined
Jun 16, 2019
Messages
28
Reaction score
0
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
00DF:   actor $PLAYER_ACTOR driving
then
wait 700 // ms
0AB1: @SEND_CMD 1 text 0@
Repeat
Wait 0
Until 80DF:   actor $PLAYER_ACTOR driving /// not driving , not in car
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



It works but only when I enter the vehicle but when I am spawned in a vehicle the command doesn't get sent.
I am sorry I said in the original post I want when the player enters the vehicle command gets sent. but I forgot you can get spawned in-vehicle sometimes.
 

hardkor

Active member
Joined
Jun 16, 2019
Messages
28
Reaction score
0
So make it work with key
I haven't time , i did this with phone...

Okay, thanks for the help I tried to add key _pressed but it doesn't seem to work. I know you said you don't have time can you just please tell me where do I need to move key pressed in which section.

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 and
0AB0:   key_pressed 75
00DF:   actor $PLAYER_ACTOR driving
then
wait 700 // ms
0AB1: @SEND_CMD 1 text 0@
Repeat
Wait 0
Until 80DF:   actor $PLAYER_ACTOR driving /// not driving , not in car
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
 
Status
Not open for further replies.
Top