Converting strings
#1

Hiho! I was thinking, is there any simple way to convert strings in pawno to values since integer, ending on hex.

Regards.

// I'm not talking about strings like "123", just normal characters ~` "hello", "welcome world" etc.
Reply
#2

I don't quite understand what you're asking...
Reply
#3

like this?
pawn Код:
/*Credits to Dracoblue*/
stock udb_hash(buf[]) {
    new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}
Copied from Kush's y_ini tutorial
Reply
#4

Yes! This is exactly what I want! Thank you rpg.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)