SA-MP Forums Archive
Problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem (/showthread.php?tid=241323)



Problem - GiS - 17.03.2011

Hey,

I got a problem: When I use the following it only saves 3 of the 4 numbers. For example if I insert 1234 it only saves 123.

My Code:

Код:
format(PlayerInfo[playerid][userpin], 4, "%i", strval(inputtext));



Re: Problem - legodude - 17.03.2011

serach for enum and look in that enum for userpin.
adjust the size there to 4


Re: Problem - maramizo - 17.03.2011

Quote:
Originally Posted by legodude
Посмотреть сообщение
adjust the size there to 4
Be more specific?


Re: Problem - GiS - 17.03.2011

Well 1234 is an integer so I don't need to set the size in the enum. Aswell I tested it anyways and I still got the result that it saves 123.


Re: Problem - maramizo - 17.03.2011

Quote:
Originally Posted by GiS
Посмотреть сообщение
Well 1234 is an integer so I don't need to set the size in the enum. Aswell I tested it anyways and I still got the result that it saves 123.
new userpin[MAX_PLAYERS][20];
Use that? lol


Re: Problem - GiS - 18.03.2011

I don't get it why I need to add this? I got them userpin in my pInfo enum so why should I add new userpin[MAX_PLAYERS][20]??


Re: Problem - JamesC - 18.03.2011

Yes, 1234 is an integer. But you're formatting PlayerInfo[playerid][userpin] which is a string.

You need to change the size from 4 to 5. This is because after the content of the string, there is another character '/0' which denotes the end of the string. It is automatically added in for you, but it needs one cell space.


Re: Problem - GiS - 18.03.2011

Solved - Thanks