31.08.2011, 11:40
So , i have this OnPlayerConnect:
and this OnDialogRespons:
Код:
public OnPlayerConnect(playerid) { gPlayerLogged[playerid] = 0; new name[MAX_PLAYER_NAME], file[256]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if (!dini_Exists(file)) { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Bine ai Venit", "Bine ai venit, Nu esti Inregistrat in Baza de date \n Pentru Inregistrare Scrie Parola ta aici:", "Register", "Iesi"); } if(fexist(file)) { ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Bine ai Venit", "Bine ai Venit, Esti deja Inregistrat \n Pentru Logare Scrie Parola ta aici:", "Login", "Iesi"); } PlayerInfo[playerid][pAdminLevel] = 0; return 1; }
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if (dialogid == 1) { new name[MAX_PLAYER_NAME], file[256]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if(!response) return Kick(playerid); if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Bine ai Venit", "Bine ai Venit, nu esti inregistrat in baza de date \n Pentru Inregistrare Scrie Parola ta aici:", "Register", "Iesi"); dini_Create(file); dini_IntSet(file, "Password", udb_hash(inputtext)); dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0); dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 500); dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0); SendClientMessage(playerid, 0xFFF900FF, "Te-ai Inregistrat cu Succes!"); gPlayerLogged[playerid] = 1; } if (dialogid == 2) { new name[MAX_PLAYER_NAME], file[256]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if(!response) return Kick(playerid); if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, " Bine ai Venit", "Bine ai Venit, Esti deja Inregistrat \n Pentru Logare Scrie Parola ta aici:", "Login", "Iesi"); new tmp; tmp = dini_Int(file, "Password"); if(udb_hash(inputtext) != tmp) { SendClientMessage(playerid, 0xFF0000FF, "Parola Incorecta!"); ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Bine ai Venit", "Bine ai Venit, Esti deja Inregistrat \n Pentru Logare Scrie Parola ta aici:", "Login", "Iesi"); } else { gPlayerLogged[playerid] = 1; PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel"); SetPlayerScore(playerid, PlayerInfo[playerid][pScore]); GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid)); SendClientMessage(playerid,0xFF0000FF, "Server: Te-ai logat cu Succes!"); } } return 1; }