Код:
public OnPlayerRequestClass(playerid, classid)
{
new string[128];
PlayerPlaySound(playerid, 1185, 0.0, 0.0, 0.0);
PlayerInfo[playerid][pModel] = Peds[classid][0];
if (RegistrationStep[playerid] == 0 && gPlayerLogged[playerid] != 1)
{
ClearChatbox(playerid, 10);
/*format(string, sizeof(string), "Bem vindo ao %s", SCRIPT_VERSION);*/
SendClientMessage(playerid, COLOR_YELLOW, string);
SendClientMessage(playerid, COLOR_YELLOW2, " ");
if (gPlayerConta[playerid] != 0)
{
new loginstring[128];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
format(loginstring,sizeof(loginstring),"Bem vindo, %s\nEste nick esta registrado.\nVoce pode logar agora:",loginname);
ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Logar",loginstring,"Logar","Sair");
}
else
{
new regstring[128];
new regname[64];
GetPlayerName(playerid,regname,sizeof(regname));
SendClientMessage(playerid, 0xD900D3C8, "Voce ainda nao esta registrado use Nome_Sobrenome Ex:GoodLife_Owna");
format(regstring,sizeof(regstring),"Bem vindo, %s\nVoce nao tem uma conta.\nPor favor registre-se:",regname);
ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Registrar",regstring,"Registrar","Sair");
}
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 1558.7385,-1675.7007,16.1953);
SetPlayerFacingAngle(playerid, 160.0);
SetPlayerCameraPos(playerid, 1506.7966,-1645.9325,22.3203);
SetPlayerCameraLookAt(playerid, 1537.1453,-1670.2620,12.6740);
PlayerInfo[playerid][pModel] = Peds[classid][0];
SetPlayerTeamFromClass(playerid,classid);
}
else SpawnPlayer(playerid);
return false;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
//new sendername[MAX_PLAYER_NAME];
new string[128];
if(response)
{
if(dialogid == 12346 || dialogid == 12347)
{
if(strlen(inputtext))
{
new tmppass[64];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
Encrypt(tmppass);
OnPlayerLogin(playerid,tmppass);
}
else
{
new loginstring[128];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
format(loginstring,sizeof(loginstring),"Senha Erada\nPor favor informe a senha correta:",loginname);
ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Logar",loginstring,"Logar","Sair");
gPlayerLogTries[playerid] += 4;
if(gPlayerLogTries[playerid] == 4) { Kick(playerid); }
}
}
if(dialogid == 12345)
{
if(strlen(inputtext))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s.ini", sendername);
new File: hFile = fopen(string, io_read);
if (hFile)
{
SendClientMessage(playerid, COLOR_YELLOW, "Este Nome de Usario ja estб em uso , por favor escolha outro");
fclose(hFile);
return 1;
}
new tmppass[64];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
Encrypt(tmppass);
OnPlayerRegister(playerid,tmppass);
}
else
{
new regstring[128];
new regname[64];
GetPlayerName(playerid,regname,sizeof(regname));
format(regstring,sizeof(regstring),"Bem vindo, %s\nVoce nao tem uma conta.\nPor favor registre-se",regname);
ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Registrar",regstring,"Registrar","Sair");
}
}
}
else
{
Kick(playerid);
}
return 1;
}
public SetupPlayerForClassSelection(playerid)
{