Bine ati venit pe StarTutoriale inregistreazaTE SI daca vrei un post in echipa da add la sportivu_razvan99 administratorul principal.


 
AcasaAcasa  CalendarCalendar  GalerieGalerie  FAQFAQ  CautareCautare  MembriMembri  GrupuriGrupuri  InregistrareInregistrare  ConectareConectare  Info upload  
Site-ul nostru de upload este Site upload
Cautare
 
 

Rezultate pe:
 
Rechercher Cautare avansata
Navigare
 Portal
 Index
 Membri
 Profil
 FAQ
 Cautare
Top postatori
RazVaN
 
Benl4deN
 
DeLuX
 
M3trix
 
DeConnection
 
AlyNNN :X
 
S2m3H
 
Sky
 
Da-Kid
 
seboros
 
Ultimele subiecte
» ce ati face cu 50 lei ?
Dum Noi 13, 2011 7:52 pm Scris de DeLuX

» [TUTORIAL] HL Guard pe server Counter Strike 1.6
Dum Noi 13, 2011 6:33 pm Scris de DeLuX

» Toate Gta-urile
Dum Noi 13, 2011 5:50 pm Scris de RazVaN

» metin2Star
Dum Noi 13, 2011 5:14 pm Scris de Sky

» DS-LAN SV
Dum Noi 13, 2011 5:12 pm Scris de Sky

» Fifa 2012
Dum Noi 13, 2011 5:10 pm Scris de Sky

» [ADDONS] Invision AmxX 2.0 Color [Linux & Windows]
Dum Noi 13, 2011 4:54 pm Scris de DeLuX

» [ADDONS] MaX Security !!
Dum Noi 13, 2011 4:52 pm Scris de DeLuX

» [ADDONS] Interesant
Dum Noi 13, 2011 4:50 pm Scris de DeLuX

Noiembrie 2018
LunMarMierJoiVinSamDum
   1234
567891011
12131415161718
19202122232425
2627282930  
CalendarCalendar
Cine este conectat?
In total sunt 2 utilizatori conectati: 0 Inregistrati, 0 Invizibil si 2 Vizitatori

Nici unul

Recordul de utilizatori conectati a fost de 8, Dum Dec 19, 2010 4:54 pm
Statistici
Avem 118 membri inregistrati
Cel mai nou utilizator inregistrat este: Sky

Membrii nostri au postat un numar de 260 mesaje în 166 subiecte
Subiectele cele mai vizionate
Triburile-Lan v0.1,0.2(download)
DS-LAN SV
Echipa Ds Lan RomaniA
ghiduri triburile .ro
O sa invatam sa facem un sv de triburile cu 2 versiuni
Cum sa-ti pui srvu pe no-ip.org [tutorial cu imagini]
Ce Muzica Mai Ascultati?
Cum sa faci server pe router
CUM SA FACI SERVERUL LAN/PUBLIC
Securitate Antiflood + database!
Cei mai activi postatori ai saptamanii

Distribuiţi | 
 

 Register & login cu dialog(Dini,Dudb)

In jos 
AutorMesaj
RazVaN
administrator
administrator
avatar

Mesaje : 230
Data de inscriere : 18/06/2010

MesajSubiect: Register & login cu dialog(Dini,Dudb)   Mier Sept 21, 2011 10:13 pm

[size=24pt]TUTORIAL[/size]

****************************************************************************************
[size=18pt]ai nevoie[/size]
Dini-http://dracoblue.net/download/dini-16/35/
Dudb-http://dracoblue.net/download/dudb-24/31/
****************************************************************************************

la inceput gamemode
punem
1.#include
#include
#include
2.sub include punem
#pragma unused ret_memcpy
va arata:

Cod:
#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:
Cod:
#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:
Cod:
#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:
Cod:
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:
Cod:

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:
Cod:

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:
Cod:
}

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:
Cod:
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 :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;
}
gata 👼
va arata poze:
[img width=500 height=375]https://i.servimg.com/u/f69/16/09/87/29/gta_sa10.jpg[/img]
daca nu ati inteles, puteti download http://pastebin.com/ACeTDiGP
[size=24pt]Important[/size]
AVERTISMENT: Pentru a face acest lucru, aveti nevoie de un folder numit
Cod:
Account
î️n folderul scriptfiles.
Sus In jos
Vezi profilul utilizatorului http://startutorial.forumz.ro
 
Register & login cu dialog(Dini,Dudb)
Sus 
Pagina 1 din 1

Permisiunile acestui forum:Nu puteti raspunde la subiectele acestui forum
 :: Tutoriale GamEs :: Sa-Mp :: Tutoriale-
Mergi direct la: