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 ×

[CLEO] [SNIPPET] CaracterIsExistInString


Tupi
 Share

Recommended Posts

Snippet:

 

:CaracterIsExistInString
{
	0AB1: @CaracterIsExistInString 2 String 0@ Caracter_As_ASCII 47 // 47 - slesh in ASCII Table
}
0085: 2@ = 0@
0C17: 3@ = strlen 0@
FOR 4@ = 0 TO 3@
    0A8D: 5@ = readMem 2@ sz 1 vp 1
    IF 003B: 5@ == 1@ 
    THEN 0485: return_true
    ELSE 059A: return_false
    END
END
RET 0

 

Exemple of use:

{$CLEO}

0000:
repeat
wait 50
until 0AFA:

0B34: "command" @command

WHILE TRUE
WAIT 0
END

:command
// simulate an string
alloc 0@ 128
format 0@ "Exist / in this string ??"

if 0AB1: @CaracterIsExistInString 2 String 0@ Caracter_As_ASCII 47
then chatmsg "In string (%s) exist caracter (/)" -1 0@
else chatmsg "In string (%s) not exist caracter (/)" -1 0@
end

// empty test string
free 0@
SAMP.CmdRet

 

Explicația:

Snippet-ul transformă fiecare caracter din string folosit în caracter de tip ASCII după care îl verifică dacă corespunde cu cel selectat de voi.

O să vă las aici inclusiv o listă unde puteți găsi fiecare caracter din tabelul ASCII : https://www.w3schools.com/charsets/ref_html_ascii.asp

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.