13.04.2012, 01:00
Well i seen someone just asked about counting registered players from a file and i decided to work on mine again, i started making one but i couldnt get it figured out. I didnt want to hijack his thread so i made a new one. Heres the register dialog it is in.
And well it works but it only stays 1, it dosnt count up. On my test server there is only 10 registerd accounts from my beta testers and other admins and when i put 10 in it resets back to 1 and stays at 1. How would i make it so it gets the current number and adds 1 to it?
pawn Код:
Dialog_Register(playerid, response, inputtext[])
{
new TotalRegisteredPlayers;
new file[100], bstr[5], Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
format(file, sizeof(file), PlayerFile, Name);
switch (response)
{
case 1:
{
if(strlen(inputtext)>0)
{
TotalRegisteredPlayers++;
format(APlayerData[playerid][PlayerPassword], 50, "%s", inputtext);
PlayerFile_Create(playerid);
PlayerFile_Load(playerid);
SendClientMessage(playerid, 0xFFFFFFFF, TXT_AccountRegistered);
APlayerData[playerid][LoggedIn] = true;
format(bstr, sizeof(bstr), "%d",TotalRegisteredPlayers);
new File:myfile = fopen("AdminFolder/RegisteredPlayers.txt",io_write);
fwrite(myfile, bstr);
fclose(myfile);
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
Kick(playerid);
}
}
case 0:
{
SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerMustRegister);
Kick(playerid);
}
}
return 1;
}