SA-MP Forums Archive
Numbers stay in 1. - 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: Numbers stay in 1. (/showthread.php?tid=334238)



Numbers stay in 1. - RollTi - 14.04.2012

Well i'm creating a Registered.ini in /Logs
but when i make a second account it still 1. instead 2.

i try this

pawn Код:
new file[256], PCount = 0;
PCount++;
format(file, sizeof(file), "Server/Logs/Registered.ini");
new File:User = fopen(file, io_append);
format(string, sizeof(string), "%d. %s\r\n", PCount, GetName(playerid));
fwrite(User, string);
fclose(User);
printf("New Registered User %s, User Number %d", GetName(playerid), PCount);
+ How can i check the Registered.ini for my Player Counting?


Re: Numbers stay in 1. - RollTi - 14.04.2012

Bump


Re: Numbers stay in 1. - IstuntmanI - 14.04.2012

Because you are creating PCount in this code, not global and with loading.


Re: Numbers stay in 1. - [MG]Dimi - 14.04.2012

Quote:
Originally Posted by costel_nistor96
Посмотреть сообщение
Because you are creating PCount in this code, not global and with loading.
As said you are creating variable pCount each time someone registers and setting it to 0.
pawn Код:
new PCount = 0;
Then you add 1 unit to it:
pawn Код:
PCount++;
PCount is now 1.
And then it saves it as one. Each time someone registers same process happens. To fix this add
pawn Код:
new pCount = 0;
When someone registers only
pawn Код:
PCount++;