22.08.2013, 20:46
Hello, community! I am, newbie to pawn scripting, decided to script something bigger that I was scripting before (I was scripting bullshit for VC:MP
) and the first thing I wanted to make is registering/logging-in system. I may look gay, cuz, as I think, most of you guys are veterans of scripting, but every times I am trying to compile my crappy .pwn I am getting this:
The code is (in the beginning):
Then,
I am ashamed of asking help, but, please.
) and the first thing I wanted to make is registering/logging-in system. I may look gay, cuz, as I think, most of you guys are veterans of scripting, but every times I am trying to compile my crappy .pwn I am getting this:Код:
D:\Games\GTA SAMP PROJECTS\Samp windows server\gamemodes\Main.pwn(242) : error 035: argument type mismatch (argument 1) D:\Games\GTA SAMP PROJECTS\Samp windows server\gamemodes\Main.pwn(243) : error 035: argument type mismatch (argument 1) D:\Games\GTA SAMP PROJECTS\Samp windows server\gamemodes\Main.pwn(259) : error 035: argument type mismatch (argument 1) D:\Games\GTA SAMP PROJECTS\Samp windows server\gamemodes\Main.pwn(270) : error 035: argument type mismatch (argument 1)
Код:
#define DIALOG_REGISTER 0 #define DIALOG_LOGIN 1
Код:
new IsLogged[MAX_PLAYERS];
Код:
public OnPlayerConnect(playerid)
{
new PlrName[64];
format(PlrName, sizeof(PlrName), "/Users/%s.ini", DispPlayerName(playerid));
if(!fexist(PlrName))
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Creating an account.", "Please, type your password below:", "Register", "Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Logging-into account.", "Please, type your password below:", "Login", "Quit");
}
return 1;
}
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_REGISTER)
{
if(response == 0)
{
SendClientMessage(playerid, 0xFF0000AA, "Use /q to exit.");
Kick(playerid);
}
else if(response == 1)
{
new password = strlen(inputtext);
if(password <= 5 || password >= 33)
{
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "The password is too short.", "The password must be between 6 and 32 symbols", "Okay", "");
}
else
{
new PlrName[64];
format(PlrName, sizeof(PlrName), "/Users/%s.ini", DispPlayerName(playerid));
fopen(PlrName, io_write);
fwrite(PlrName, inputtext); //the line number 242
fclose(PlrName); // 243rd line
}
}
}
else if(dialogid == DIALOG_LOGIN)
{
if(response == 0)
{
SendClientMessage(playerid, 0xFF0000AA, "Use /q to exit.");
}
else if(response == 1)
{
new PlrName[64];
format(PlrName, sizeof(PlrName), "/Users/%s.ini", DispPlayerName(playerid));
fopen(PlrName, io_read);
new PrmPass[32];
fread(PlrName, PrmPass, 32, false); //259th
if(strcmp(inputtext, PrmPass, false)==0)
{
SendClientMessage(playerid, 0xFFFFFFFF, "You have successfully logged in.");
SpawnPlayer(playerid);
IsLogged[playerid] = 1;
}
else
{
ShowPlayerDialog(playerid, 4, DIALOG_STYLE_MSGBOX, "You have typed wrong password.", "Please, type the correct password", "Okay", "");
}
fclose(PlrName); //270th
}
}
else if(dialogid == 3)
{
if(response == 0)
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Creating an account.", "Please, type your password below:", "Register", "Quit");
}
}
else if(dialogid == 4)
{
if(response == 0)
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Logging-into account.", "Please, type your password below:", "Login", "Quit");
}
}
return 1;
}
Код:
stock DispPlayerName(playerid)
{
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
return PlayerName;
}


