Weird character using strlen(inputtext)? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Weird character using strlen(inputtext)? (
/showthread.php?tid=390983)
Weird character using strlen(inputtext)? -
mSlat3r - 09.11.2012
I have this under a dialog response;
pawn Код:
if(strlen(inputtext) < 64 || strlen(inputtext) > 0)
{
new iFac;
iFac = 0;
FactionData[iFac][pFacName] = strlen(inputtext);
format(string, sizeof(string), "You have just re-named faction ID 0 to %s.", inputtext);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
It will say in the client message correctly what I entered but when I look at it after its a weird character like a |_ kinda shape? Idk why, also putting just 'FactionData[iFac][pFacName] = inputtext;' doesn't work so, any other ideas?
Re: Weird character using strlen(inputtext)? -
[KHK]Khalid - 09.11.2012
Hmm, you may try this:
pawn Код:
format(FactionData[iFac][pFacName], /*some length here*/, "%s", inputtext);
instead of:
pawn Код:
FactionData[iFac][pFacName] = strlen(inputtext);
Re: Weird character using strlen(inputtext)? -
Vince - 09.11.2012
Just want to mention that you probably would want to use the AND operator in your structure. If the player types something with length 120, that statement will still hold true because of the last part (> 0). Or use this, which is more straightforward:
pawn Код:
if(0 < strlen(inputtext) < 64)