pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == 1)
{
new name[MAX_PLAYER_NAME], file[256], string[128];
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, "{FFFF00}Virtual Pilots register.", "Please register a account to play!", "Register", "Quit");
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] = 5000);
dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0);
dini_IntSet(file, "Warns",PlayerInfo[playerid][pWarns] = 1);
dini_IntSet(file, "Banned",PlayerInfo[playerid][pBanned] = 0);
dini_IntSet(file, "Muted",PlayerInfo[playerid][pMuted] = 0);
dini_IntSet(file, "Jailed",PlayerInfo[playerid][pJailed] = 0);
dini_IntSet(file, "MuteWarns",PlayerInfo[playerid][pMuteWarns] = 1);
dini_IntSet(file, "Skin",PlayerInfo[playerid][pSkin]);
dini_IntSet(file, "Kills",PlayerInfo[playerid][pKills]);
dini_IntSet(file, "Deaths",PlayerInfo[playerid][pDeaths]);
dini_IntSet(file, "Spam",PlayerInfo[playerid][pSpam] = 0);
SetPVarString(playerid,"Tags","<none>");
SetPVarInt(playerid,"Register",1);
new none[30] = "<none>";
dini_Set(file, "Tags", none);
format(string, 128, "Welcome to the server! You have registered the account {80FF00}%s", name);
SendClientMessage(playerid, COLOR_YELLOW, string);
gPlayerLogged[playerid] = 1;
welcomehide(playerid);
}
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, "{FFFF00}Virtual Pilots login.", "Welcome back! Please login to continue!", "Login", "Quit");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp) {
if(Logins[playerid] == 3) {
new tt[128];
format(tt,sizeof(tt),"{80FF00}%s {FFFFFF}was kicked for to many wrong passwords.",name);
SendClientMessageToAll(red,tt);
return Kick(playerid);
}
new textah[256];
format(textah,sizeof(textah),"Incorrect password. Please try again. %i/3",Logins[playerid]);
SendClientMessage(playerid, COLOR_RED, textah);
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{FFFF00}Virtual Pilots login.", "Wrong Password! Please try again!", "Login", "Quit");
Logins[playerid]++;
}
else
{
gPlayerLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
GetPlayerName(playerid,OrName[playerid],20);
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
SendClientMessage(playerid,medblue, "You have successfully logged in!");
if(PlayerInfo[playerid][pAdminLevel] >= 1) {
new atext[128];
format(atext,sizeof(atext),"Level: %i",PlayerInfo[playerid][pAdminLevel]);
SendClientMessage(playerid,lime,atext);
}
welcomehide(playerid);
}
}
if(dialogid == 5) {
new dtext[128];
#pragma unused dtext
if(listitem == 1) {
if(PlayerInfo[playerid][pAdminLevel] >= 2) {
ShowPlayerDialog(playerid,6,DIALOG_STYLE_INPUT,"Reason","Type the reason here:","Go","Cancel");
} else {
return SendClientMessage(playerid,red,"This command only for lvl2 or higher.");
}
}
}
return 1;
}