Spawn Help
#7

So , i have this OnPlayerConnect:
Код:
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;
}
and this OnDialogRespons:
Код:
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;
}
Reply


Messages In This Thread
Spawn Help - by CrisTany - 31.08.2011, 10:22
Re: Spawn Help - by Lorenc_ - 31.08.2011, 10:48
Re: Spawn Help - by CrisTany - 31.08.2011, 11:28
Re: Spawn Help - by Venice - 31.08.2011, 11:29
Re: Spawn Help - by CrisTany - 31.08.2011, 11:37
Re: Spawn Help - by Venice - 31.08.2011, 11:38
Re: Spawn Help - by CrisTany - 31.08.2011, 11:40
Re: Spawn Help - by Venice - 31.08.2011, 11:41
Re: Spawn Help - by mprofitt - 31.08.2011, 11:45
Re: Spawn Help - by CrisTany - 31.08.2011, 18:26

Forum Jump:


Users browsing this thread: 1 Guest(s)