if (fexist(string))
{
SendClientMessage(playerid, COLOR_YELLOW, "That Username is already taken, please choose a different one.");
Kick(playerid);
return 1;
}
if(dialogid == 11)
{
if (response == 1)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "users/%s.ini", sendername);
//new File: hFile = fopen(string, io_read);
if (fexist(string))
{
SendClientMessage(playerid, COLOR_YELLOW, "That Username is already taken, please choose a different one.");
Kick(playerid);
return 1;
}
if(!strlen(inputtext))
{
new msg[256];
format(msg,256,"Welcome to Quyz Role Play Community\nPlease enter your password to create new account\n\nEnter the new password:");
ShowPlayerDialog(playerid,11,DIALOG_STYLE_INPUT,"Please Register!",msg,"Register","Quit");
return 1;
}
OnPlayerRegister(playerid,inputtext);
}
return 1;
}
else return Kick(playerid);
}
if(listitem == 1) // They selected the second item - AK-47
{
ClearChatbox(playerid, 4);
SendClientMessage(playerid, COLOR_LIGHTRED, "!!!!!!Wrong!!!!!!");
ClearChatbox(playerid, 1);
SendClientMessage(playerid, COLOR_LIGHTRED, ">> You can visit ******.co.il and read guides about RolePlay! <<");
Kick(playerid);
}
if(listitem == 2) // They selected the third item - Desert Eagle
{
ClearChatbox(playerid, 4);
SendClientMessage(playerid, COLOR_LIGHTRED, "!!!!!!Wrong!!!!!!");
ClearChatbox(playerid, 1);
SendClientMessage(playerid, COLOR_LIGHTRED, ">> You can visit ******.co.il and read guides about RolePlay! <<");
Kick(playerid);
}
}
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
This code doesn't give you any opportunity to login the server, so when you connect you can just register! You should write another function about login like 'OnPlayerRegister'.
|