Jump to content

Register & login cu dialog(Dini,Dudb)


[RSS]Cops_sandu

Recommended Posts

                                                                              TUTORIAL

            ****************************************************************************************

ai nevoie

Dini-http://dracoblue.net/download/dini-16/35/

Dudb-http://dracoblue.net/download/dudb-24/31/

****************************************************************************************

la inceput gamemode

punem

1.#include <a_samp>

#include <dini>

#include <dudb>

2.sub include punem

#pragma unused ret_memcpy

va arata:

#include <a_samp>
#include <dini>
#include <dudb>

#pragma unused ret_memcpy
3.sub pragma punem: #define COLOR_GREY 0xAFAFAFAA #define COLOR_GREEN 0x33AA33AA #define COLOR_ORANGE 0xFF9900AA #define COLOR_RED 0xAA3333AA #define COLOR_YELLOW 0xFFFF00AA #define SERVER_USER_FILE "Account/%s.ini" va arata asa:
#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
#define SERVER_USER_FILE "Account/%s.ini"
4.sub define punem enum pInfo {     pAdminLevel,     pCash,     pScore, } va arata:
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define SERVER_USER_FILE "Account/%s.ini"



enum pInfo
{
    pAdminLevel,
    pCash,
    pScore,
}
5.sub } punem new PlayerInfo[MAX_PLAYERS][pInfo]; new gPlayerLogged[MAX_PLAYERS]; va arata:
enum pInfo
{
    pAdminLevel,
    pCash,
    pScore,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new gPlayerLogged[MAX_PLAYERS];
6. sub new gPlayerLogged[MAX_PLAYERS]; punem: public OnFilterScriptInit() {         print("\n--------------------------------------");         print(" registration & login by [RSS]Cops_sandu");         print("--------------------------------------\n");         return 1; } public OnFilterScriptExit() {         return 1; } va arata:
new gPlayerLogged[MAX_PLAYERS];
public OnFilterScriptInit()
{
        print("\n--------------------------------------");
        print(" registration & login by [RSS]Cops_sandu");
        print("--------------------------------------\n");
        return 1;
}

public OnFilterScriptExit()
{
        return 1;
}
7.sub } punem: 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; } va arata:
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;
}
8.dupa } punem: 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; } va arata:
}

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;
}
9.acum facem cu OnDialogResponse punem:
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] = 500);
        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 . 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;
}
gata  :angel: va arata poze: gta_sa10.jpg daca nu ati inteles, puteti download http://pastebin.com/ACeTDiGP Important AVERTISMENT: Pentru a face acest lucru, aveti nevoie de un folder numit
Account

  în folderul scriptfiles.

wtf?I fucking then school??????fuck school :))))

coolte12.png

Link to comment
Share on other sites

explicami tu cum sa fac la punctul 9 .. daca sti bineinteles

gPlayerLogged[playerid] = 0;

        return 1;

}

dupa } pui

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] = 500);
        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 . 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;
}

merge? :huh:

ce este OnDialodRespone

playerid-ID-ul de jucator care au raspuns la caseta de dialog.

dialodid-ID-ul de dialog jucatorul a raspuns

response-1 pentru primul buton ?i 0 pentru al doilea buton

listitem-ID-ul elementului din lista selectata de catre jucator

inputtext[]-Textul introdus în caseta de intrare de un jucator sau lista de textul selectat element

wtf?I fucking then school??????fuck school :))))

coolte12.png

Link to comment
Share on other sites

  • 4 weeks later...

L-am pus, dar aceas eroare imi da :|

  EDIT :

  Am rezolvat problema aia... am pus un dutils.inc in Pawno/include...

Dar acum imi alte 3 erori X(

C:\Documents and Settings\dfj\Desktop\Server\filterscripts\cont.pwn(48) : error 010: invalid function or declaration
C:\Documents and Settings\dfj\Desktop\Server\filterscripts\cont.pwn(63) : warning 217: loose indentation
C:\Documents and Settings\dfj\Desktop\Server\filterscripts\cont.pwn(65) : error 010: invalid function or declaration
C:\Documents and Settings\dfj\Desktop\Server\filterscripts\cont.pwn(109) : warning 217: loose indentation
C:\Documents and Settings\dfj\Desktop\Server\filterscripts\cont.pwn(111) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
  • 3 months later...

Am facut tot ce scria in tutorial dar acum am eroarea asta ma poate ajuta cineva sa o rezolv?

[pawn]D:\Jocuri\Full\GTA San Andreas Multi Player Server\gamemodes\vortex.pwn(57) : error 028: invalid subscript (not an array or too many subscripts): "format"

D:\Jocuri\Full\GTA San Andreas Multi Player Server\gamemodes\vortex.pwn(57) : warning 215: expression has no effect

D:\Jocuri\Full\GTA San Andreas Multi Player Server\gamemodes\vortex.pwn(57) : error 020: invalid symbol name ""

D:\Jocuri\Full\GTA San Andreas Multi Player Server\gamemodes\vortex.pwn(57) : warning 215: expression has no effect

D:\Jocuri\Full\GTA San Andreas Multi Player Server\gamemodes\vortex.pwn(57) : error 001: expected token: ";", but found "}"

D:\Jocuri\Full\GTA San Andreas Multi Player Server\gamemodes\vortex.pwn(57) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

4 Errors.

[/pawn]

Link to comment
Share on other sites

Am facut tot ce scria in tutorial dar acum am eroarea asta ma poate ajuta cineva sa o rezolv?

[pawn]D:\Jocuri\Full\GTA San Andreas Multi Player Server\gamemodes\vortex.pwn(57) : error 028: invalid subscript (not an array or too many subscripts): "format"

D:\Jocuri\Full\GTA San Andreas Multi Player Server\gamemodes\vortex.pwn(57) : warning 215: expression has no effect

D:\Jocuri\Full\GTA San Andreas Multi Player Server\gamemodes\vortex.pwn(57) : error 020: invalid symbol name ""

D:\Jocuri\Full\GTA San Andreas Multi Player Server\gamemodes\vortex.pwn(57) : warning 215: expression has no effect

D:\Jocuri\Full\GTA San Andreas Multi Player Server\gamemodes\vortex.pwn(57) : error 001: expected token: ";", but found "}"

D:\Jocuri\Full\GTA San Andreas Multi Player Server\gamemodes\vortex.pwn(57) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

4 Errors.

[/pawn]

Posteaza la Discutii Scripting

468833_437698_362328_hiphop.jpg
Link to comment
Share on other sites

  • 1 month later...
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • 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.