Jump to content

[SannyBuilder]Problema script citire chat.


Mihay.
 Share

Recommended Posts

Descriere problema: Salutare am incercat sa fac o bucata de script care sa execute comanda /id <id> in chat, sa citeasca acea linie de chat si sa vada daca acel string contine un anumit cuvant cheie iar un functie de asta daca gaseste acel cuvant cheie sau nu sa imi trimita un mesaj cum ca a gasit sau nu cuvantul cheie in acea linie de chat dar cand il testez cumva imi citeste penultima linie de chat adica se executa functia de citire a chatului inainte de executia comenzii /id <id> daca ma intelegeti, ma scuzati daca ma exprim ca din topor sunt foarte nou in ce priveste scriptare cleo, am incercat sa pun o pauza de 100 de milisecunde intre executia comenzii /id <id> si citirea chatului dar functia wait nu vrea neam sa functioneze.

Poze / Video (optional): https://imgur.com/Hbn4acX

Cod (sursa pe baza caruia sa ajutam, daca e cazul): 

{$CLEO}
0000: NOP


0B34: samp register_client_command "test" to_label @test

REPEAT 
wait 1500
UNTIL samp.Available()

while true
wait 0
end


:test
while true
SAMP.IsCommandTyped(20@)
if
    0AD4: 20@ = scan_string 20@ format "%d" 21@
then
    alloc 11@ 256
    say "/id %d" 21@
    wait 100
    0B75: samp get_chat_string 99 text_to 11@ -1 -1 -1

    if 
        0C29:$NOT_USED = stristr string1 11@ string2 "Paramedics"
    then 
        chatmsg "Codul a gasit cuvantul paramedics in linia de text" -1
    else
        chatmsg "Codul nu a gasit cuvantul paramedics in linia de text" -1
    end
else
    print "~y~/test + <id jucator>" 2000
end
SAMP.CmdRet()
end

Alte precizări: aveti vreo idee? sau daca stiti o alta metoda de a verifica in ce factiune se afla un anumit player as fi vesnic recunoscator

 

Edited by Mihay.
Link to comment
Share on other sites

{$CLEO}
0000: NOP

REPEAT 
wait 1500
UNTIL samp.Available()

0B34: samp register_client_command "test" to_label @test


while true
wait 0
    if 10@ == 1
    then
            alloc 11@ 256
            say "/id %d" 21@
            wait 100
            0B75: samp get_chat_string 99 text_to 11@ -1 -1 -1
        
            if 
                0C29:1@ = stristr string1 11@ string2 "Paramedics"
            then 
                chatmsg "The code found the word paramedics in the text line" -1
            else
                chatmsg "The code did not find the word paramedics in the text line" -1
            end
    
        10@ = 0
    end
end

:test
SAMP.IsCommandTyped(20@)
if
0AD4: 20@ = scan_string 20@ format "%d" 21@
then
    10@ = 1
else
    print "~ y~/test + <player id>" 2000
end
SAMP.CmdRet()


im not an expert on these but try this.

Link to comment
Share on other sites

 bun acum am alta problema, am incercat sa le nestuiesc impreuna

 

REPEAT
WAIT 1500
UNTIL samp.available()

chatmsg "{FF6347}[Paramedics CMD]{FFFFFF} by Chevy, updated by Mihay [/para] si [/paraupdates]." 0xFFFFFF
chatmsg "{FF6347}[Paramedics CMD]{FFFFFF} by Chevy, updated by Mihay [/para] si [/paraupdates]." 0xFFFFFF

WAIT 25000

say "/pin"

 

 

 while true
 wait 0

 

 

:autofvr
wait 0
3@ = 0 // Initialize the variable
while true
    wait 250
    if
        3@ == 1 //If is enabled
    then
        chatmsg "{FF6347}[Paramedics CMD]{FFFFFF}Comanda a functionat cu succes." -1
        say "/r Atentie, dau FVR in 10 secunde!"
        wait 2000
        chatmsg "{FF6347}[Paramedics CMD]{FFFFFF}Foloseste comanda [/sfvr] pentru a anula FVR-ul automat." -1
        wait 8000
          if 3@ == 1 //If is still enabled
          then
            say "/fvr"
            say "/r Fvr done!"
              3@ = 0 //Disabled
          end
    end
end

 

 

while true 
wait 0

 

 

:autoheal
wait 0
10@ = 0
while true
    wait 250
    if 10@ == 1
    then
            alloc 11@ 256
            say "/id %d" 21@
            wait 10
            0B75: samp get_chat_string 99 text_to 11@ -1 -1 -1
        
            if 
                0C29:1@ = stristr string1 11@ string2 "Paramedics"
            then 
                chatmsg "The code found the word paramedics in the text line" -1
            else
                chatmsg "The code did not find the word paramedics in the text line" -1
            end
    
        10@ = 0
    end
end
end

 

 

si daca pun autoheal inaintea la fvr merge autoheal si nu merge fvr daca le pun invers se intampla invers merge fvr si nu merge autofvr , unde gresesc?

 

 

si comenzile arata asa

0B34: samp register_client_command "afvr" to_label @afvr
0B34: samp register_client_command "sfvr" to_label @sfvr
0B34: samp register_client_command "test" to_label @test
 

 

:test
SAMP.IsCommandTyped(20@)
if
0AD4: 20@ = scan_string 20@ format "%d" 21@
then
    10@ = 1
else
    print "~y~/test + <player id>" 2000
end
SAMP.CmdRet()

 

 

:afvr
SAMP.IsCommandTyped(20@)
3@ = 1 // Set the variable as enabled (use 3@)
SAMP.CmdRet()

 

 

:sfvr
SAMP.IsCommandTyped(20@)
if 3@ == 1
  then
        3@ = 0
        chatmsg "{FF6347}[Paramedics Help]{FFFFFF}Comanda a functionat cu succes." -1
        chatmsg "{FF6347}[Paramedics Help]{FFFFFF}Ai oprit FVR-ul automat." -1
      say "/r Am oprit FVR-ul."
  else
        chatmsg "{FF6347}[Paramedics Help]{FFFFFF}Nu exista nici un FVR automat pe care sa il opresti." -1
  end
SAMP.CmdRet()

 

Edited by Mihay.
Link to comment
Share on other sites

Salut,

 

Greșești prin faptul că într-un mod poate exista o singură buclă globală.

 

while true
wait 0

if 3@ == 1 //If is enabled
then
    chatmsg "{FF6347}[Paramedics CMD]{FFFFFF}Comanda a functionat cu succes." -1
    say "/r Atentie, dau FVR in 10 secunde!"
    wait 2000
    chatmsg "{FF6347}[Paramedics CMD]{FFFFFF}Foloseste comanda [/sfvr] pentru a anula FVR-ul automat." -1
    wait 8000
    if 3@ == 1 //If is still enabled
    then
        say "/fvr"
        say "/r Fvr done!"
        3@ = 0 //Disabled
    end
end

if 10@ == 1
then
    alloc 11@ 256
    say "/id %d" 21@
    wait 100
    0B75: samp get_chat_string 99 text_to 11@ -1 -1 -1

    if 0C29:1@ = stristr string1 11@ string2 "Paramedics"
    then chatmsg "The code found the word paramedics in the text line" -1
    else chatmsg "The code did not find the word paramedics in the text line" -1
    end
    10@ = 0
end

END

 

Link to comment
Share on other sites

Esti un erou in haine civile stiai asta? mersi mult de tot si scuze de deranj, topicul poate fi inchis.

In caz ca mai am nevoie de ajutor cu ceva voi deschide un alt topic.

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.