24.04.2013, 13:54
This is mine Dialog
How to solfe this?
Sorry for my bad English.
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, "Hi your not registered", "Welcome, your not registered mate, input your registration pw below", "Register", "Leave");
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] = 250000);
dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 10);
dini_IntSet(file, "Kills",PlayerInfo[playerid][pKills] = 0);
dini_IntSet(file, "Deaths",PlayerInfo[playerid][pDeaths] = 0);
dini_IntSet(file, "Robberie's",PlayerInfo[playerid][pRobberies] = 0);
dini_IntSet(file, "Arrest",PlayerInfo[playerid][pArrest] = 0);
dini_IntSet(file, "Tickets",PlayerInfo[playerid][pTickets] = 0);
dini_IntSet(file, "Time",PlayerInfo[playerid][pTime] = 0);
dini_IntSet(file, "BankCash",PlayerInfo[playerid][pBankCash] = 0);
dini_IntSet(file, "Cars",PlayerInfo[playerid][pCars] = 0);
dini_IntSet(file, "Warns",PlayerInfo[playerid][pWarns] = 0);
dini_IntSet(file, "Banned",PlayerInfo[playerid][pBanned] = 0);
dini_IntSet(file, "Kicked",PlayerInfo[playerid][pKicked] = 0);
dini_IntSet(file, "Muted",PlayerInfo[playerid][pMuted] = 0);
dini_IntSet(file, "OnDuty",PlayerInfo[playerid][pOnDuty] = 0);
format(string, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s, you have been auto logged in.", name, inputtext);
SendClientMessage(playerid, COLOR_YELLOW, string);
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, "Nice job your registered", "Thanks for registering, your registered. Input your password below", "Login", "Leave");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp) {
SendClientMessage(playerid, COLOR_RED, "Wrong Password");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Nice job your registered", "Thanks for registering, your registered. Input your password below", "Login", "Leave");
}
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,COLOR_RED, "[SYSTEM]: Successfully logged in!");
}
}
return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new string[64],
mens[MAX_PLAYER_NAME];
GetPlayerName(playerid,mens,MAX_PLAYER_NAME);
switch(reason)
{
case 0: format(string,sizeof string,"%s left Amsterdam Cops 'n Robbers! (Timed out)",mens);
case 1: format(string,sizeof string,"%s left Amsterdam Cops 'n Robbers! (Leaving)",mens);
case 2: format(string,sizeof string,"%s left Amsterdam Cops 'n Robbers! (Kicked/Banned)",mens);
}
SendClientMessageToAll(0x0CED1,string);
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(gPlayerLogged[playerid] == 1)
{
dini_IntSet(file, "Score", PlayerInfo[playerid][pScore]);
dini_IntSet(file, "Money", PlayerInfo[playerid][pCash]);
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
dini_IntSet(file, "Kills",PlayerInfo[playerid][pKills]);
dini_IntSet(file, "Deaths",PlayerInfo[playerid][pDeaths]);
dini_IntSet(file, "Robberie's",PlayerInfo[playerid][pRobberies]);
dini_IntSet(file, "Arrest",PlayerInfo[playerid][pArrest]);
dini_IntSet(file, "Tickets",PlayerInfo[playerid][pTickets]);
dini_IntSet(file, "Time",PlayerInfo[playerid][pTime]);
dini_IntSet(file, "BankCash",PlayerInfo[playerid][pBankCash]);
dini_IntSet(file, "Cars",PlayerInfo[playerid][pCars]);
dini_IntSet(file, "Warns",PlayerInfo[playerid][pWarns]);
dini_IntSet(file, "Banned",PlayerInfo[playerid][pBanned]);
dini_IntSet(file, "Kicked",PlayerInfo[playerid][pKicked]);
dini_IntSet(file, "Muted",PlayerInfo[playerid][pMuted]);
dini_IntSet(file, "OnDuty",PlayerInfo[playerid][pOnDuty]);
}
gPlayerLogged[playerid] = 0;
return 1;
}
Sorry for my bad English.