03.08.2011, 12:40
Well.. i got Register / login System in my GM - If player has non-rp name , Ex: Batman , it kick him , only RP name such as Alex_Black , so i wanted to remove this , here :
ondialogresponse :
Can someoen help please in this ?
ondialogresponse :
pawn Код:
if(dialogid == 1) //LOGIN
{
if(gPlayerLogged[playerid] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are already logged in.");
return 1;
}
if(response)
{
if(!strlen(inputtext))
{
DisplayDialogForPlayer(playerid, 1); //login
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You must enter a password.");
return 1;
}
if(strlen(inputtext) >= 50)
{
DisplayDialogForPlayer(playerid, 1); //login
SendClientMessage(playerid, COLOR_WHITE, "SERVER: Password is too long.");
return 0;
}
new tmppass[64];
//Store Player ID & TMP pass in echo to find string used to crash server
new playername[MAX_PLAYER_NAME];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
GetPlayerName(playerid, playername, sizeof(playername));
// printf("[login] [%s] %s", playername, inputtext[0]);
if(strlen(playername) == 3)
{
if(strcmp(playername, "Smo", true) == 0)
{
return 0;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Sorry, that name is too short, please change it.");
Kick(playerid);
return 1;
}
}
Encrypt(tmppass);
OnPlayerLogin(playerid,tmppass);
}
else
{
DisplayDialogForPlayer(playerid, 1); //login
}
}
if(dialogid == 2) //REGISTER
{
if(gPlayerLogged[playerid] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are already logged in.");
return 1;
}
if(response)
{
if(strlen(inputtext) >= 50)
{
DisplayDialogForPlayer(playerid, 2); //register
SendClientMessage(playerid, COLOR_WHITE, "SERVER: Password is too long.");
return 0;
}
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
{
SendClientMessage(playerid, COLOR_YELLOW, "It would be cooler if your name be Firstname_Lastname format.");
return 1;
}
else
{
if(!strlen(inputtext))
{
DisplayDialogForPlayer(playerid, 2); //register
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You must enter a password.");
return 1;
}
new string[128];
format(string, sizeof(string), "%s.ini", sendername);
// if(dini_Exists(string))
if(fexist(string))
{
SendClientMessage(playerid, COLOR_YELLOW, "That name is already taken, please choose a different one.");
return 1;
}
new tmppass[64];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
Encrypt(tmppass);
OnPlayerRegister(playerid,tmppass);
OnPlayerLogin(playerid,tmppass);
gPlayerAccount[playerid] = 1;
gPlayerSpawned[playerid] = 1;
SendClientMessage(playerid, COLOR_YELLOW, "Account registered, you have been logged in automatically.");
}
}
else
{
DisplayDialogForPlayer(playerid, 2); //register
}
}
Can someoen help please in this ?