Trouble Overwriting A String -
ReneG - 21.05.2012
I have never used strmid until now, and I'm not sure if I'm using it correctly.
pawn Код:
WP_Hash(wpHash, 129, inputtext); // I hash it
printf("Booboo Test: %s", wpHash); // It prints it
strmid(PlayerInfo[playerid][pKey], wpHash, 0, sizeof(wpHash)); // Idk what I'm doing
printf("Hope-fucking-ly: %s", PlayerInfo[playerid][pKey]); // It prints nothing.
I'm trying to extract all the characters from the Whirlpool hashed inputtext into the player's password variable. Before you ask, yes, pKey is exactly 129 cells.
Server console printed this.
Код:
[04:41:23] Booboo Test: 0D22FB7594D51AD1429447E311C477C01884CF8DDEC6427146FCE64BD817D8A4522458613941237CB5954415A05C49B7D03D753711AA8C28467AB24708F0EC59
[04:41:23] Hope-fucking-ly:
Any help would be greatly appreciated.
Re: Trouble Overwriting A String -
Azazelo - 21.05.2012
Quote:
stock cutstring(string[],myLENofSTRING )
{
new tmp,out[129];
tmp = myLENofSTRING ; //END OF STR
strmid(out, string, 0, tmp);
return out;
}
|
I think this will help you to understand.
Re: Trouble Overwriting A String -
ReneG - 21.05.2012
Quote:
Originally Posted by Azazelo
I think this will help you to understand.
|
Thank you for your reply, but that is exactly what I'm doing.
pawn Код:
new
wpHash[129],
pKey[MAX_PLAYERS][129]
;
WP_Hash(wpHash, 129, inputtext);
strmid(pKey, wpHash, 0, sizeof(wpHash));
EDIT: I'll try to temporarily use that stock, and see if it gets me anywhere.
EDIT 2: Wow, I used the stock, and it worked perfectly. But I don't see a difference in.
pawn Код:
strmid(PlayerInfo[playerid][pKey], wpHash, 0, sizeof(wpHash));
Than I do with
pawn Код:
PlayerInfo[playerid][pKey] = cutstring(wpHash, 129);
stock cutstring(string[], length )
{
new tmp, out[129];
tmp = length; //END OF STR
strmid(out, string, 0, tmp);
return out;
}
Re: Trouble Overwriting A String -
Azazelo - 21.05.2012
You use sizeof(wpHash) and this return size in reference not in integer like strmid wants i hit a head few time about this.
Re: Trouble Overwriting A String -
ReneG - 21.05.2012
Quote:
Originally Posted by Azazelo
You use sizeof(wpHash) and this return size in reference not in integer like strmid wants i hit a head few time about this.
|
Ahhh, thank you for clearing this up for me. I got what I was doing wrong.