CLEO Help Short question about CLEO (Crashes).

CLEO related
Status
Not open for further replies.

Oplosthee

New member
Joined
Feb 25, 2014
Messages
4
Reaction score
0
Hello UGBase,

I've recently gotten into creating CLEO scripts and followed Blackhat's tutorial to get a basic understanding of how it works and decided to try something myself, but I just can't get it working. I'm not asking for you to fix my code and provide working code, just an explanation on what I'm doing wrong. This is my current code (which crashes upon pressing 8):

Code:
{$CLEO .cs}

0000: NOP

:MAIN
wait 0
if
0AB0:   key_pressed 104 //Numpad 8
jf @MAIN
wait 0
1@ = SAMP.GetDialogID()
0AF8: samp add_message_to_chat 1@ color 12451840
wait 5000
jump @MAIN

What I'm trying to achieve is:
Reading the text of a dialog and entering the text into the field of the dialog window (for paychecks on roleplay servers, for example). I'm not sure if this is possible though.

I've tried doing something else as well, getting the current player hp and posting it to the chat, but that code also just crashes the game upon pressing Numpad 8, which is obviously not what I want.

Code:
0B25: samp 2@ = get_player_health $PLAYER_ACTOR
0AF8: samp add_message_to_chat 2@ color 12451840

What is causing this to crash? I understand that this question may seem retarded to people more experienced with scripting in CLEO, but I'm just lost. Thank you for taking your time to answer my question :)
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
271
You need to use formatting,

0AF8: samp add_message_to_chat "%d" color 12451840 2@

And 0B25 requires ID as parameter, not actor handle.
 

Oplosthee

New member
Joined
Feb 25, 2014
Messages
4
Reaction score
0
springfield link said:
You need to use formatting,

0AF8: samp add_message_to_chat "%d" color 12451840 2@

And 0B25 requires ID as parameter, not actor handle.

That seemed to fix it, thanks a lot!

I already suspected that that was the problem with 0B25, guess I'll have to play around some more to figure out how everything works :) I assume I'll have to use something like
Code:
0B2B: samp 1@ = get_player_id_by_actor_handle $PLAYER_ACTOR
0B25: samp 2@ = get_player_health 1@
But that might be wrong as well.

Thanks again for your help.




Forgot to ask, Is what I wanted to do even possible? Reading the dialog text in CLEO.
 
Status
Not open for further replies.
Top