LLstylish.NSFW Posted June 12, 2021 Share Posted June 12, 2021 (edited) Hey, I'm a fresh newbie at coding and I've been trying to code a cleo mod for GTA SA:MP which reads the chat and automatically triggers a command after a specified text in chat. For example, i want to create a mod in which, whenever it says in chat "Your job waiting time is over. You can now start working again.", it automatically sends a command "/work". I tried coding to make this code but it doesnt read the chat and make my game like in slowmotion {$CLEO .cs} 0000: repeat wait 0 until 0afa: 0B34: samp register_client_command "redeem" to_label @cmd while true wait 0 FOR 6@ = 98 TO 99 0AC8: 0@ = allocate_memory_size 260 // ALLOCATE MEMORY FOR THE CHAT STRING 0AB1: @GETCHATENTRYTEXT 1 id 6@ to 0@ // THIS IS A FUNCTION THAT STORES THE LAST CHAT STRING INTO 0@ if 31@ == true then if 0AD4: $NOT_USED = scan_string 0@ format "Your job waiting time is over. You can now start working again." $NOT_USED 5@ then 0AF9: samp say_msg "/work" wait 200 end end END // END FOR 0@ = 98 TO 99 end :cmd if 31@ == false then 31@ = true chatmsg "Autowork ON" -1 else 31@ = false chatmsg "Autowork OFF" -1 end 0B43: samp cmd_ret :getChatEntryText 0AF7: samp 1@ = get_base 1@ += 0x21A0E4 0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0 1@ += 0x136 0@ *= 252 // size of stChatEntry 005A: 1@ += 0@ // (int) 1@ += 28 0AB2: 1 1@ Edited June 12, 2021 by D J C Topic name correction Link to comment Share on other sites More sharing options...
D J C Posted June 12, 2021 Share Posted June 12, 2021 (edited) Check this out: :auto_chat 0BE5: raknet 31@ = get_hook_param PARAM_PACKETID if 31@ == RPC_ScrClientMessage then 0C11: memset destination 29@ value 0 size 256 0BE5: raknet 31@ = get_hook_param PARAM_BITSTREAM 0BE7: raknet 30@ = bit_stream_read 31@ type BS_TYPE_INT //color 0BE7: raknet 30@ = bit_stream_read 31@ type BS_TYPE_INT //lenght 0BE8: raknet bit_stream 31@ read_array 29@ size 30@ //string 0C0D: struct 29@ offset 30@ size 1 = 0 if or 0C29: $NULL_STIRNG = stristr string1 29@ string2 "Timpul tau de asteptare la job s-a incheiat. Acum poti munci din nou." 0C29: $NULL_STIRNG = stristr string1 29@ string2 "Your job waiting time is over. You can now start working again." then say "/work" end end 0BE0: raknet hook_ret true Edited June 12, 2021 by D J C 1 Link to comment Share on other sites More sharing options...
LLstylish.NSFW Posted June 12, 2021 Author Share Posted June 12, 2021 3 hours ago, D J C said: Check this out: :auto_chat 0BE5: raknet 31@ = get_hook_param PARAM_PACKETID if 31@ == RPC_ScrClientMessage then 0C11: memset destination 29@ value 0 size 256 0BE5: raknet 31@ = get_hook_param PARAM_BITSTREAM 0BE7: raknet 30@ = bit_stream_read 31@ type BS_TYPE_INT //color 0BE7: raknet 30@ = bit_stream_read 31@ type BS_TYPE_INT //lenght 0BE8: raknet bit_stream 31@ read_array 29@ size 30@ //string 0C0D: struct 29@ offset 30@ size 1 = 0 if or 0C29: $NULL_STIRNG = stristr string1 29@ string2 "Timpul tau de asteptare la job s-a incheiat. Acum poti munci din nou." 0C29: $NULL_STIRNG = stristr string1 29@ string2 "Your job waiting time is over. You can now start working again." then say "/work" end end 0BE0: raknet hook_ret true didnt work doesnt read the chat so it doesnt type ./work Link to comment Share on other sites More sharing options...
D J C Posted June 12, 2021 Share Posted June 12, 2021 How did you use those codes? The specific code that I gave you were right, there is all code (tested and works well): {$CLEO} {$INCLUDE SF} 0000: repeat wait 0 until SAMP.Available() alloc 29@ 256 0BE3: raknet setup_incoming_rpc_hook @auto_chat while true wait 0 if and 8B21: samp is_chat_opened 8C7E: is_console_active then if 0ADC: test_cheat "JOB" THEN if 2@ == 0 then 0ACD: show_text_highpriority "AutoJob ~g~ON" time 1000 018C: play_sound 1083 at 0.0 0.0 0.0 2@ = 1 wait 250 else 0ACD: show_text_highpriority "AutoJob ~r~OFF" time 1000 018C: play_sound 1084 at 0.0 0.0 0.0 2@ = 0 wait 250 end end END END :looperulee wait 0 jump @looperulee :auto_chat 0BE5: raknet 31@ = get_hook_param PARAM_PACKETID if 31@ == RPC_ScrClientMessage then 0C11: memset destination 29@ value 0 size 256 0BE5: raknet 31@ = get_hook_param PARAM_BITSTREAM 0BE7: raknet 30@ = bit_stream_read 31@ type BS_TYPE_INT //color 0BE7: raknet 30@ = bit_stream_read 31@ type BS_TYPE_INT //lenght 0BE8: raknet bit_stream 31@ read_array 29@ size 30@ //string 0C0D: struct 29@ offset 30@ size 1 = 0 if or 0C29: $NULL_STIRNG = stristr string1 29@ string2 "Timpul tau de asteptare la job s-a incheiat. Acum poti munci din nou." 0C29: $NULL_STIRNG = stristr string1 29@ string2 "Your job waiting time is over. You can now start working again." then if 2@ == 1 then say "/work" end end end 0BE0: raknet hook_ret true Link to comment Share on other sites More sharing options...
D J C Posted June 12, 2021 Share Posted June 12, 2021 @LLstylish.NSFW Problem solved? Link to comment Share on other sites More sharing options...
LLstylish.NSFW Posted June 12, 2021 Author Share Posted June 12, 2021 1 minute ago, D J C said: @LLstylish.NSFW Problem solved? Yes Thank You ❤️ Link to comment Share on other sites More sharing options...
D J C Posted June 12, 2021 Share Posted June 12, 2021 With pleasure 1 Link to comment Share on other sites More sharing options...
Recommended Posts