Jump to content
  • 0

Problema inregistrare


VladA13D

Question

Problema intalnita (descriere): Dupa ce ma loghez,imi arata si chestia de la " Request Class ",cu selectarea skinului si butonul spawn.
Ero(area / rile) / warning-(ul / urile): Niciuna
Liniile de cod / sursa / script-ul:

 

#include <a_samp>

#include <dini>
#include <dudb>
 
#pragma unused ret_memcpy
 
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
 
 
enum pInfo
{
    pAdminLevel,
    pCash,
    pScore,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new gPlayerLogged[MAX_PLAYERS];
 
#define SERVER_USER_FILE "Account/%s.ini"
 
public OnFilterScriptInit()
{
        print("n--------------------------------------");
        print(" registration & login by [RSS]Cops_sandu");
        print("--------------------------------------n");
        return 1;
}
 
public OnFilterScriptExit()
{
        return 1;
}
 
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, "Salut,nu esti registrat", "scri mai jos parola dorit", "Register", "inchide");
    }
    if(fexist(file))
    {
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Salut,Esti inregistrat", "ai registrat,scri mai jos parola tau", "Login", "inchide");
    }
        return 1;
}
 
public OnPlayerDisconnect(playerid, reason)
{
    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]);
    }
    gPlayerLogged[playerid] = 0;
        return 1;
}
 
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, "Salut,nu esti registrat", "scri mai jos parola dorit", "Register", "inchide");
        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] = 0);
        dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0);
        format(string, 128, "[sYSTEM]: succes registrat numele asta %s cu parola %s, ai intrat autologin.", 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, "Hi your registered", "Fucken awesome mate, your registered :D. Inpute your pw below", "Login", "Leave");
        new tmp;
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp) {
            SendClientMessage(playerid, COLOR_RED, "Wrong PW sir.");
            ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Salut,Esti inregistrat", "ai registrat,scri mai jos parola tau", "Login", "inchide");
        }
        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]: succes login!");
        }
    }
        return 1;
}

Imagini / Video (optional):
Ati incercat sa rezolvati singur?: Da,dar nu ma descurc indeajuns.

Edited by VladA13D
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
public OnPlayerRequestClass(playerid, classid)
{
SetSpawnInfo(playerid,0,294,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
TogglePlayerSpectating(playerid,1);
TogglePlayerSpectating(playerid,0);
 return 1;
}
 
public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

Link to comment
Share on other sites

  • 0

Nu reusesc,si vad ca acest filterscript are si bug-uri...imi puteti da un tutorial,eu am gasit dar primesc erori,pentru a face un sistem de logare direct in gamemode?

Nu, nu are buguri ci tu nu ai stiut cum sa il continui, Ph0eniX ti-a dat o idee pentru inceput... Tu trebuie sa il continui ^_^.

Edited by KnowN .

242086.png

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.