Jump to content

[CLEO] Script cu wait - wait nu functioneaza


Moderat
 Share

Recommended Posts

Salut,

 

Am un script de tip "TaxiCMD", care are diverse comenzi utile.

 

Ce incerc sa fac este sa adaug o comanda "/fvr10", care anunta pe /f ca se va da /fvr, asteapta 10 secunde, si apoi da comanda /fvr.

 

Problema este ca "wait" functioneaza doar in loops, si desi stiind asta, tot nu reusesc sa fac sa functioneze cum trebuie.

 

Nu am mai codat CLEO initial, insa ma descurc in general, astfel ca am reusit sa adaug diverse chestii noi, intrucat erau similare cu alte chestii deja existente in script.

 

Nu inteleg exact ce gresesc.

 

De asemenea, as vrea si pentru /fvr5 sa imi spuna dupa 5 secunde pe chat ca au trecut 5 secunde si ca pot da /fvr, daca nu e ceva super greu (deja pare greu de adaugat un wait).

 

https://pastebin.com/7UNnAdD8

Link to comment
Share on other sites

WHILE TRUE
WAIT 0

IF 0@ == 1
THEN
    0AF9: "/F Atentie dau FVR in 10 secunde!"
    WAIT 10000
    IF 0@ == 1
    THEN 
        0AF9: "/fvr"
        0@ = 0
    END
END

END

 

Link to comment
Share on other sites

@Gugustiuc. As far as I can see, the script has no problem except line 65,

You used the 0006 functions which are set/change the variable on 3@.

 

The goal is to see if I have the variable enabled, so you have to use the 0039 Function. there is a fixed code:

0B34: samp register_client_command "ffvr" to_label @fvr_1

while true
    wait 20
    if
        3@ == 1
    then
        0AF9: samp say_msg "Atentie, dau FVR in 10 secunde!"
        0AF8: "{FFFFFF}{F1C40F}[TaxiTool]{FFFFFF} Doing {FFFF00}[/fvr]{FFFFFF} in 10 seconds..."
        wait 10000
        0AF9: samp say_msg "/fvr"
        0AF8: "{FFFFFF}{F1C40F}[TaxiTool]{FFFFFF} {FFFF00}[/fvr]{FFFFFF} done!"
    end
    3@ = 0
end
  
:fvr_1
3@ = 1 //Set the variable as enabled
0B43: samp cmd_ret

 

If you would to add Stop fvr, use this code:

0B34: samp register_client_command "ffvr" to_label @fvr_1
0B34: samp register_client_command "sfvr" to_label @fvr_2

while true
    wait 20
    if
        3@ == 1 //If is enabled
    then
        0AF9: samp say_msg "Atentie, dau FVR in 10 secunde!"
        0AF8: "{FFFFFF}Use {FF0000}[/sfvr] {FFFFFF}To stop /fvr automatic." -1
        wait 10000
  		if 3@ == 1 //If is still enabled
  		then
        	0AF9: samp say_msg "/fvr"
        	0AF8: "{FFFFFF}{F1C40F}[TaxiTool]{FFFFFF} {FFFF00}[/fvr]{FFFFFF} done!"
  			3@ = 0 //Disabled
  		end
    end
end
  
:fvr_1
3@ = 1 //Set the variable as enabled
0B43: samp cmd_ret
  
:fvr_2
if 3@ == 1
  then
  	  3@ = 0
  	  chatmsg "You've stopped the automatic FVR." -1
      0AF9: samp say_msg "/f The FVR has been stopped."
  else
  	  chatmsg "There's no automatic FVR at the moment." -1
  end
0B43: samp cmd_ret

 

Edited by D J C
Link to comment
Share on other sites

Scuze de delay!

 

Am implementat exemplul lui @D J C, insa cand execut /fvr10, primesc crash.

 

Nu am nicio idee ce e in neregula.

 

_______________________

 

 

Sorry for the delay!

 

I implemented @D J C's example, but when I execute /fvr10, my game crashes.

 

I really have no idea what's wrong.

 

 

https://pastebin.com/VytT3c7j

Link to comment
Share on other sites

@Gugustiuc. primești crash deoarece opcode-ul 0AF8: executa prea multe culori de tipul "{FFFFFF}", încearcă să folosesti maxim 2 culori să vezi daca mai primesti crash.

 

Înlocuiește așa

while true
    wait 20
    if
        3@ == 1
    then
        0AF9: samp say_msg "Dau FVR in 10 secunde / FVR in 10 seconds"
        chatmsg "{F1C40F}[TaxiTool] {FFFFFF}Doing [/fvr] in 10 seconds..." -1
        wait 10000
        if
            3@ == 1
        then
            0AF9: samp say_msg "/fvr"
            chatmsg "{F1C40F}[TaxiTool] {FFFFFF}[/fvr] done!" -1
            3@ = 0
        end
    end
end

 

Problema ar trebui să fie rezolvată.

Link to comment
Share on other sites

1 hour ago, Tupi said:

@Gugustiuc. primești crash deoarece opcode-ul 0AF8: executa prea multe culori de tipul "{FFFFFF}", încearcă să folosesti maxim 2 culori să vezi daca mai primesti crash.

 

Înlocuiește așa


while true
    wait 20
    if
        3@ == 1
    then
        0AF9: samp say_msg "Dau FVR in 10 secunde / FVR in 10 seconds"
        chatmsg "{F1C40F}[TaxiTool] {FFFFFF}Doing [/fvr] in 10 seconds..." -1
        wait 10000
        if
            3@ == 1
        then
            0AF9: samp say_msg "/fvr"
            chatmsg "{F1C40F}[TaxiTool] {FFFFFF}[/fvr] done!" -1
            3@ = 0
        end
    end
end

 

Problema ar trebui să fie rezolvată.

 

Incerc imediat, insa cand se incarca prima oara scriptul, este:

 

0AF8: "{F1C40F}[TaxiTool]{FFFFFF} is {FF8E7A}[TaxiHelp by Konny]{FFFFFF}, modified by {8DA5ED}[Gugustiuc.]{FFFFFF}."

 

si atunci jocul nu ia crash.

 

 

Edti: tot iau crash. Forma curenta a scriptului: https://pastebin.com/4UFKNSKa

 

Edit2: am pus si "chatmsg" in locul opcode-ului 0AF8 si situatia ramane aceeasi.

Edited by Gugustiuc.
Link to comment
Share on other sites

@Gugustiuc. 

 

Acolo cand se incarca modul modifică

chatmsg "{F1C40F}[TaxiTool] (v1.1){FFFFFF} has been loaded." -1 
chatmsg "Use [/tt] to see all the available commands." -1
chatmsg "{F1C40F}[TaxiTool]{FFFFFF} is [TaxiHelp by Konny] modified by [Gugustiuc.]." -1

 

Edited by Tupi
Link to comment
Share on other sites

27 minutes ago, Tupi said:

@Gugustiuc. 

 

Acolo cand se incarca modul modifică


chatmsg "{F1C40F}[TaxiTool] (v1.1){FFFFFF} has been loaded." -1 
chatmsg "Use [/tt] to see all the available commands." -1
chatmsg "{F1C40F}[TaxiTool]{FFFFFF} is [TaxiHelp by Konny] modified by [Gugustiuc.]." -1

 

 

Ok, dupa ce ai scris post-ul asta, mi-am dat seama ca nu am pus -1 la chatmsg.

 

Observa ca acum functioneaza ok.

 

Multumesc mult pentru ajutor (tuturor)!

Link to comment
Share on other sites

8 minutes ago, Gugustiuc. said:

Ok, dupa ce ai scris post-ul asta, mi-am dat seama ca nu am pus -1 la chatmsg.

Acel "-1" reprezinta culoarea timestamp-ului (ora din chat).

 

Se pot folosi si mai mult de 2 culori intr-un altfel de mesaj insa este ceva mai complicat, trebuie sa definesti cate o variabila constanta pentru fiecare culoare dorita. O sa iti las aici un exemplu simplu in caz ca vrei neaparat mai mult de 2 culori.

cont
_WHITE = 0xFFFFFF
_RED = 0xFF0000
_GREEN = 0x00FF00
end

chatmsg "{%x}WHITE {%x}RED {%x}GREEN" -1 _WHITE _RED _GREEN

Variabilele constante se pun inainte de loop-ul principal.

 

Cu placere si spor la treaba!

Edited by Tupi
Link to comment
Share on other sites

13 minutes ago, Tupi said:

Acel "-1" reprezinta culoarea timestamp-ului (ora din chat).

 

Se pot folosi si mai mult de 2 culori intr-un altfel de mesaj insa este ceva mai complicat, trebuie sa definesti cate o variabila constanta pentru fiecare culoare dorita. O sa iti las aici un exemplu simplu in caz ca vrei neaparat mai mult de 2 culori.


cont
_WHITE = 0xFFFFFF
_RED = 0xFF0000
_GREEN = 0x00FF00
end

chatmsg "{%x}WHITE {%x}RED {%x}GREEN" -1 _WHITE _RED _GREEN

Variabilele constante se pun inainte de loop-ul principal.

 

Cu placere si spor la treaba!

 

Mersi pentru explicatie, nu stiam ce face acel -1!

 

Patesc sa am timestamps de culoare neagra cateodata, si de-aia mai puneam un extra {FFFFFF} inainte de textul care voiam sa apara, in ideea ca poate se aplica la timestamp.

Link to comment
Share on other sites

De asemenea am uitat sa iti precizez ca si timestamp-ul poate fi colorat, nu neparat alb.

chatmsg "{%x}Text!" 0xFF0000 _WHITE

In aceasta situatie timestamp-ul va avea culoarea rosie, iar textul va fi alb.

 

[!] Trebuie sa mai ai in vedere ca NU poti folosi aceasta forma

chatmsg "{FFFFFF}Text!" 0xFF0000

Daca vrei ca timestamp-ul sa aibe o culoare anume iar textul alta culoare trebuie sa folosesti obligatoriu variabile constante care sa aibe culorile dorite pentru textul din chat care urmeaza dupa timestamp.

Link to comment
Share on other sites

48 minutes ago, Tupi said:

De asemenea am uitat sa iti precizez ca si timestamp-ul poate fi colorat, nu neparat alb.


chatmsg "{%x}Text!" 0xFF0000 _WHITE

In aceasta situatie timestamp-ul va avea culoarea rosie, iar textul va fi alb.

 

[!] Trebuie sa mai ai in vedere ca NU poti folosi aceasta forma


chatmsg "{FFFFFF}Text!" 0xFF0000

Daca vrei ca timestamp-ul sa aibe o culoare anume iar textul alta culoare trebuie sa folosesti obligatoriu variabile constante care sa aibe culorile dorite pentru textul din chat care urmeaza dupa timestamp.

 

Mersi!

 

By the way, daca as vrea ca dialog-ul sa nu fie sub forma hex, cum as putea sa il pun direct in script, in loc de:

 

hex
AB CD EF 10 20 etc
end

 

Portiunea de cod este 

0AC6: 17@ = label @content offset 
SAMP.ShowDialog(7777, "{F1C40F}[TaxiTool] (v1.1){FFFFFF} - comenzi disponibile", 17@, "{FFFC3C}Close", "", 0)

 

si apoi

 

:content
hex
AB CD EF 10 20 etc
end

 

De exemplu:

:content
{33FFFF}[/fa] {FFFFFF}- te pui {FFFF00}ON DUTY{FFFFFF} cu {FFFF00}[/fare 20]{FFFFFF}.
{33FFFF}[/fa1] {FFFFFF}- te pui {FFFF00}ON DUTY{FFFFFF} cu {FFFF00}[/fare 1]{FFFFFF}.

 

Exista ceva pentru a inchide sectiunea "content", daca e posibil sa nu fie folosit "hex"?

Link to comment
Share on other sites

Da, este posibil

:content
hex
"{FFFFFF}Text"A
"{FFFFFF}Text2"00
end

Ultimul rand din codul hex e obligatoriu sa contina la final "00" iar toate celelalte "A"

Link to comment
Share on other sites

6 minutes ago, Tupi said:

Da, este posibil


:content
hex
"{FFFFFF}Text"A
"{FFFFFF}Text2"00
end

Ultimul rand din codul hex e obligatoriu sa contina la final "00" iar toate celelalte "A"

 

Perfect, functioneaza!

 

Intentia mea e de a scapa de caracterele aiurea care apar la finalul textului - odata am observat ca scria "SAMP.dll", care era parte din cod la un moment dat, deci tot din script veneau acele caractere. Inainte era recomandat ca la final sa ai un {000000}, ca acele caractere sa fie mai putin vizibile cel putin, insa cu metoda mentionata de tine acele caractere aiurea nu mai apar deloc.

Link to comment
Share on other sites

  • D J C 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.