PtokaX forum

Development Section => Your Developing Problems => Topic started by: NightLitch on 30 January, 2004, 14:26:09

Title: Learning strchar ???
Post by: NightLitch on 30 January, 2004, 14:26:09
this is what I have read:

QuoteAny client with a DC++ tag that sends anything other than strchar( 1 ) is modded. Clients that i know of that do this are:  

know how do I call strchar ??

this is my test code

function NewUserConnected(curUser)
if strfind(curUser.sMyInfoString,"<++") then
SendToAll("CLIENT ++")
if curUser.sMyInfoString == strchar(1) then
SendToAll("CLIENT OK")
else
SendToAll("CLIENT NOT")
end
else
SendToAll("CLIENT ??")
end
end

plz help me understand a thing or 2.
Title:
Post by: NightLitch on 30 January, 2004, 14:42:02
plz brains... how does it work... Am a noob on gsub and strlen & strsub to so plz help me a little here...

strchar (i1, i2, ...)
Receives 0 or more integers. Returns a string with length equal to the number of arguments, wherein each character has the internal numerical code equal to its correspondent argument.
Numerical codes are not necessarily portable across platforms.
Title:
Post by: kepp on 30 January, 2004, 15:26:59
I can tell you this though

LENGTH = "0123456789"
p = strlen(LENGTH)
print(p)

It will print the length, so the output of this became "10"
Title:
Post by: NightLitch on 30 January, 2004, 15:29:04
Thx m8. that will come in handy. Gonna try it later...

*Finally Viking* hehe
Title:
Post by: kepp on 30 January, 2004, 15:35:17
About gsub, play with it :P

To see what results you get

Click Here (http://doris.sourceforge.net/lua/weblua.php)
And try diferent things there :D
Title:
Post by: tezlo on 30 January, 2004, 16:04:08
uhmm.. you need to read the $MyINFO part here (http://wza.digitalbrains.com/DC/doc/Command_Types_(client_to_server).html)

especially..
is a string describing the client's internet connection selected from "56Kbps", "Satellite", "DSL", "Cable", "LAN(T1)", and "LAN(T3)" followed by a byte indicating the speed class. The value of the byte is selected from at least 1 for 56Kbps, 3 for cable or DSL, or 7, also for DSL.

that BYTE should have ordinal value of 1

//www.asciitable.com