Well, what I made it in my server is when player log in, and he typed the password I wrote it in server script, he should log in as team 1, or other password, he should log in as team 2, and so on..
It's not like registration..just 3 password for all people.. because I only need friends there
However, I wanted to open all files in same time when player log in, then when player write the password, the file should be closed..
This system works when I write the password in pwn file, but I don't want to bother each time to upload my server file.. so I made the /changepassword system and it works perfectly fine.. now, I want my script to detect the file's word and compare with it..
The problem I got here is whenever I log in, even with wrong password it log me in instead of poping me up other dialog of "Wrong password"
pawn Код:
if(dialogid == 104)
{
new pass1[256],pass2[256],pass3[256]; // Create the string to store the read text in
file1 = fopen("Password1.txt", io_read); // Open the file
while(fread(file1, pass1)) //reads the file line-by-line
file2 = fopen("Password2.txt", io_read); // Open the file
while(fread(file2, pass2)) //reads the file line-by-line
file3 = fopen("Password3.txt", io_read); // Open the file
while(fread(file3, pass3)) //reads the file line-by-line
if(response == 1)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid, 0xFFFFFFFF, "You didn't write anything!");
ShowPlayerDialog(playerid, 104, DIALOG_STYLE_INPUT, "Write the password", "You didn't write anything!", "Login", "Cancel");
}
else
{
if(!strcmp(inputtext, pass1))
{
gTeam[playerid] = 0;
IsLogged[playerid] = 1;
TogglePlayerControllable(playerid, 1);
TogglePlayerSpectating(playerid, 0);
SetPlayerTeam(playerid, 0);
SetSpawnInfo( playerid, 0, 165, 1479.3235,-1764.9271,18.7958,267.0782, 0, 0, 0, 0, 0, 0 );
SpawnPlayer(playerid);
SetPlayerColor(playerid, 0xFFFFFF00);
fclose(file1);
}
else if(!strcmp(inputtext, pass2))
{
gTeam[playerid] = 1;
IsLogged[playerid] = 1;
TogglePlayerControllable(playerid, 1);
TogglePlayerSpectating(playerid, 0);
SetPlayerTeam(playerid, 1);
SetSpawnInfo( playerid, 0, 150, 1479.3235,-1764.9271,18.7958,267.0782, 0, 0, 0, 0, 0, 0 );
SpawnPlayer(playerid);
SetPlayerColor(playerid, 0xFFFFFF00);
fclose(file2);
}
else if(!strcmp(inputtext, pass3))
{
gTeam[playerid] = 2;
IsLogged[playerid] = 1;
TogglePlayerControllable(playerid, 1);
TogglePlayerSpectating(playerid, 0);
SetPlayerTeam(playerid, 2);
SetSpawnInfo( playerid, 0, 295, 1479.3235,-1764.9271,18.7958,267.0782, 0, 0, 0, 0, 0, 0 );
AllowPlayerTeleport( playerid, 1 );
SpawnPlayer(playerid);
SetPlayerColor(playerid, 0xCC000000);
fclose(file3);
}
else
{
ShowPlayerDialog(playerid, 104, DIALOG_STYLE_INPUT, "Invalid Password", "Invalid Password, try again", "Login", "Cancel");
}
}
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "You canceled.");
Kick( playerid );
}
return 1;
}