Checking if inputtext is 4 digits.
#9

Quote:
Originally Posted by Ahmad45123
Посмотреть сообщение
Make sure to save the pin as a string because numbers that start with a zero will bug out.. like "0000" or "0123"..

It should be:
PHP код:
strcpy(passPlayerInfo[playerid][pSecKey]); 
instead of sscanf.. for strings.

And don't forget to change all instances of integer to a 4 digit string.
False, it will not bug out. If you want to print the leading zero's you can easily do so.

Quote:
Originally Posted by faff
Посмотреть сообщение
Not what I asked for, check my last message.
You shouldn't use two sscanf strings for that. If you'd do it like I said it would be better. It's your code however, do as you will.

Now about the leading zero's. You shouldn't store it as a string to get them. You said:
Quote:

Weird, It works perfect now but if I set someone else or mine admin pin to "0000" the "SendClientMessage" displays "0". How to solve this?

The correct way to do this would be this (example):
pawn Код:
printf("This number will have three leading zeros: %4i", 0);
//Output: "This number will have three leading zeros: 0000"

printf("These numbers will all be four digits, with leading zeros if needed: %4i, %4i, %4i", 12, 555, 045);
//Output: "These numbers will all be four digits, with leading zeros if needed: 0012, 0555, 0045"
Reply


Messages In This Thread
Checking if inputtext is 4 digits. - by faff - 09.10.2015, 20:54
Re: Checking if inputtext is 4 digits. - by ThePhenix - 09.10.2015, 20:56
Re: Checking if inputtext is 4 digits. - by Crayder - 09.10.2015, 21:00
Re: Checking if inputtext is 4 digits. - by faff - 09.10.2015, 21:01
Re: Checking if inputtext is 4 digits. - by faff - 09.10.2015, 21:06
Re: Checking if inputtext is 4 digits. - by faff - 09.10.2015, 21:15
Re: Checking if inputtext is 4 digits. - by Ahmad45123 - 09.10.2015, 21:19
Re: Checking if inputtext is 4 digits. - by faff - 09.10.2015, 21:40
Re: Checking if inputtext is 4 digits. - by Crayder - 09.10.2015, 21:53
Re: Checking if inputtext is 4 digits. - by Ahmad45123 - 09.10.2015, 22:08

Forum Jump:


Users browsing this thread: 4 Guest(s)