14.12.2012, 13:34
First of all, you could just write 'else' instead of the whole 'if(udb_hash(inputtext) != PlayerInfo[playerid][pPassHash])' thingy.
- Nevermind -
Edit: You should learn to indent your code better, by the way
Also: Show us your LoadPlayer_ callback.
- Nevermind -
Edit: You should learn to indent your code better, by the way
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
if(dialogid == DIALOG_LOGIN)
{
INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
if(!response)
{
new string[256];
Kick(playerid);
format(string,sizeof(string),"[SERVER]: %s и stato cacciato dal Server.[Motivo: Falsa Identificazione.]",name);
printf("[SERVER]: %s и stato cacciato dal Server.[Motivo: Falsa Identificazione.]",name);
SendClientMessageToAll(COLOR_RED,string);
}
else
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPassHash])
{
GivePlayerMoney(playerid,PlayerInfo[playerid][pSoldi]);
SetPlayerSkin(playerid,PlayerInfo[playerid][pSkin]);
if(PlayerInfo[playerid][pAdmin] >= 1)
{
new string[256];
format(string,sizeof(string),"~L'Admin %s si и Connesso | ID: %d | Lv. Admin: %d ~",name,playerid,PlayerInfo[playerid][pLivello]);
SendClientMessageToAll(YELLOW,string);
printf("~L'Admin %s si и Connesso | ID: %d | Lv. Admin: %d ~",name,playerid,PlayerInfo[playerid][pLivello]);
}
if(PlayerInfo[playerid][pAdmin] == 0)
{
new string[256];
format(string,sizeof(string),"~ %s si и Connesso | ID: %d ~",name,playerid);
SendClientMessageToAll(COLOR_GREEN,string);
printf("~ %s si и Connesso | ID: %d ~",name,playerid);
}
return 1;
}
else
{
new string[256];
Kick(playerid);
format(string,sizeof(string),"[SERVER]: %s и stato cacciato dal Server.[Motivo: Password Errata.]",name);
printf("[SERVER]: %s и stato cacciato dal Server.[Motivo: Password Errata.]",name);
SendClientMessageToAll(COLOR_RED,string);
}
return 1;
}
}
if(dialogid == DIALOG_REGISTER)
{
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Bari Multimode - Registrazione","Password non valida.\nScrivi una Password per registrarti.","Registra","Annulla");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Pass Hash",udb_hash(inputtext));
INI_WriteInt(File,"Soldi",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Livello",0);
INI_WriteInt(File,"Rep",0);
INI_WriteInt(File,"Vip",0);
INI_WriteInt(File,"Num. Morti",0);
INI_WriteInt(File,"Num. Uccisioni",0);
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
INI_Close(File);
new string[256];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"{99FF00}Complimenti %s, Account Registrato!",name);
SendClientMessage(playerid,WHITE,string);
}
}
return 0;
}