Well' im currently making a 0.3 Registration system using the Dialog boxes, but when i try to compile my script i get this Error:
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new playername[MAX_PLAYER_NAME];
if(dialogid == 0) { // Our example msgbox
if(response) {
new loginmsg[256+1];
new tmp[256];
new loginname[MAX_PLAYER_NAME+1];
GetPlayerName(playerid,loginname,MAX_PLAYER_NAME);
format(loginmsg,256,"Welcome to NY-Roleplay.\n %s\n\nPlease login!",loginname);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"NY-Gaming Login!",loginmsg,"Login","Cancel");
new tmppass[64];
new idx;
if(gPlayerLogged[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREY, " You are already logged in.");
return 1;
}
tmp = strtok(inputtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, " USAGE: /login [password]");
return 1;
}
strmid(tmppass, tmp, 0, strlen(inputtext), 255);
Encrypt(tmppass);
OnPlayerLogin(playerid,tmppass);
} else {
new regmsg[256+1];
new regname[MAX_PLAYER_NAME+1];
GetPlayerName(playerid,regname,MAX_PLAYER_NAME);
format(regmsg,256,"Welcome to NY-Roleplay.\n %s\n\nPlease Register!",regname);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"NY-Gaming Register!",regmsg,"Register","Cancel");
new string[265];
new idx;
new tmp[256];
tmp = strtok(inputtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /register [password]");
return 1;
}
if (gPlayerAccount[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREY, " That name is already registered");
return 1;
}
strmid(PlayerInfo[playerid][pPassword], tmp, 0, strlen(inputtext), 255);
Encrypt(PlayerInfo[playerid][pPassword]);
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "%s.cer", playername);
new File: file = fopen(string, io_read);
if (file)
{
SendClientMessage(playerid, COLOR_GREY, " That name is already registered");
fclose(file);
return 1;
}
new File:hFile;
hFile = fopen(string, io_append);
new var[32];//
format(var, 32, "%s\n", PlayerInfo[playerid][pPassword]);fwrite(hFile, var);
format(var, 32, "Kills=%d\n",PlayerInfo[playerid][pKills]);fwrite(hFile, var);
format(var, 32, "Deaths=%d\n",PlayerInfo[playerid][pDeaths]);fwrite(hFile, var);
PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
format(var, 32, "Money=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
fclose(hFile);
SendClientMessage(playerid, COLOR_WHITE, "Succesfully Registered!");
SendClientMessage(playerid, COLOR_WHITE, "Next time you connect, type /login <password> to log in.");
OnPlayerLogin(playerid,PlayerInfo[playerid][pPassword]);
}
}
return 1; // we processed this. no need for other filterscripts to process it.
}
return 0; // we didn't handle anything.
}