Jump to content
Hostul a fost schimbat. Daca vedeti serverul offline readaugati rpg.b-zone.ro sau 141.95.124.78:7777 in clientul de sa-mp ×

Problema cleo script


Murus
 Share

Recommended Posts

Salutare, mi-am facut acest cleo prin care pot scrie o propozitie in .ini, iar apoi sa o trimit in mai multe locuri cu o singura comanda.
Functioneaza, dar in momentul in care folosesc /changetext pentru a scrie in .ini, si propozitia trece de 95-100 de caractere, iau crash.
Cum pot face sa verific numarul de caractere al propozitiei? (spre exemplu, daca propozitia are peste 95 de caractere, sa nu imi dea voie sa o adaug in .ini)

 

{$CLEO .cs}
{$USE ini}

0662: "Cleo Script"
thread "Scriu chestii"
wait 2500

0B34: samp register_client_command "text" to_label @Text
0B34: samp register_client_command "send" to_label @Send
0B34: samp register_client_command "changetext" to_label @ChangeText

:Text
0AC8: 19@ = allocate_memory_size 260
0AF4: 19@ = read_string_from_ini_file "CLEO\CustomCleo.ini" section "Text" key "chat"
chatmsg "======================================" -1
chatmsg "Textul tau salvat este:"
chatmsg 19@ -1
chatmsg "======================================" -1
free 19@
cmdret

:Send
SAMP.IsCommandTyped(19@)

0AC8: 19@ = allocate_memory_size 260
0AF4: 19@ = read_string_from_ini_file "CLEO\CustomCleo.ini" section "Text" key "chat"
0AF9: samp say_msg "/ad %s" 19@
0AF9: samp say_msg "%s" 19@
0AF9: samp say_msg "/vip %s" 19@
free 19@
cmdret
  

:ChangeText
if SAMP.IsCommandTyped(0@)
then
  	0AF5: write_string 0@ to_ini_file "cleo\CustomCleo.ini" section "Text" key "chat"
	chatmsg "{00FF00}Textul %s {FFFFFF} a fost salvat in CustomCleo.ini." -1 0@
else
	chatmsg "{FFFFFF}Use: /changetext <text>" -1
end
SAMP.CmdRet

 

Link to comment
Share on other sites

Foarte simplu, foloseste-te de opcode-ul 0C17:

 

0C17: 1@ = strlen 0@

 

:ChangeText
if SAMP.IsCommandTyped(0@)
then
    0C17: 1@ = strlen 0@
    if 1@ <= 95
    then
        0AF5: write_string 0@ to_ini_file "cleo\CustomCleo.ini" section "Text" key "chat"
        chatmsg "{00FF00}Textul %s {FFFFFF} a fost salvat in CustomCleo.ini." -1 0@
    else chatmsg "{FF0000}Textul este prea lung, acesta depaseste limita de 95 caractere!" -1
    end
else
    chatmsg "{FFFFFF}Use: /changetext <text>" -1
end
SAMP.CmdRet

 

Imi cer scuze pentru intarziere, sper sa iti fie de ajutor

Edited by Tupi
Link to comment
Share on other sites

  • Tupi locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.