Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <md5>
- #include <Dini>
- #include <Dutils>
- //Okna
- #define LOGIN 1
- #define REJESTRACJA 2
- #define WYRZUCENIE 3
- main()
- {
- print("Poland Transport Server");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new Gracz [64];
- new Gname [MAX_PLAYER_NAME];
- GetPlayerName(playerid,Gname,sizeof(Gname));
- format(Gracz,sizeof(Gracz),"/Gracze/%s.txt");
- if(dini_Exists(Gracz))
- {
- ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"Logowanie","Witaj na serwerze!","Podaj haslo aby sie zalogowac!","Login","Anuluj");
- }
- else
- {
- ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"Rejestracja","Wybierz haslo, aby sie zarejestrowac!","Rejestruj","Anuluj");
- }
- return 1;
- }
- stock Rejestruj(playerid,key[])
- {
- new Gracz [64];
- new Gname [MAX_PLAYER_NAME];
- GetPlayerName(playerid,Gname,sizeof(Gname));
- format(Gracz,sizeof(Gracz),"/Gracze/%s.txt");
- dini_Create(Gracz);
- dini_Set(Gracz,"Haslo",key);
- dini_IntSet(Gracz,"Kasa",1000);
- dini_IntSet(Gracz,"Punkty",0);
- return 1;
- }
- stock Login(playerid,key[])
- {
- new Gracz [64];
- new Gname [MAX_PLAYER_NAME];
- GetPlayerName(playerid,Gname,sizeof(Gname));
- format(Gracz,sizeof(Gracz),"/Gracze/%s.txt");
- if(!strcmp(key,dini_Get(Gracz), false))
- {
- WczytajGracza(playerid);
- }
- else
- {
- ShowPlayerDialog(playerid,LOGIN,DIALOG_STYLE_PASSWORD,"Logowanie","Zle Haslo!","\nPodaj haslo aby sie zalogowac!","Login","Anuluj");
- }
- return 1;
- }
- stock WczytajGracza(playerid)
- {
- new Gracz [64];
- new Gname [MAX_PLAYER_NAME];
- GetPlayerName(playerid,Gname,sizeof(Gname));
- format(Gracz,sizeof(Gracz),"/Gracze/%s.txt");
- if(dini_Exists(Gracz))
- {
- GivePlayerMoney(playerid,dini_Int(Gracz,"Kasa"));
- SetPlayerScore(playerid,dini_Int(Gracz,"Punkty"));
- }
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- }
- if(dialogid == REJESTRACJA)
- {
- if(response = 0)
- }
- ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"Informacja","Anulowales/as rejestracje!","\nZaraz zostaniesz wyrzucony/a z serwera","Rozumiem","Rozumiem");
- Kick(playerid);
- }
- if(response = 1)
- {
- if(!strcmp(inputtext))
- {
- ShowPlayerDialog(playerid,LOGIN,DIALOG_STYLE_PASSWORD,"Logowanie","Zle Haslo!","\nPodaj haslo aby sie zalogowac!","Login","Anuluj");
- }
- Rejestruj(playerid,MD5_Hash(inputtext));
- {
- if (dialogid == LOGIN)
- }
- if(response == 0)
- {
- ShowPlayerDialog(playerid,LOGIN,DIALOG_STYLE_PASSWORD,"Logowanie","Zle Haslo!","\nPodaj haslo aby sie zalogowac!","Login","Anuluj");
- Kick(playerid);
- }
- if(response == 1)
- {
- Login(playerid,MD5_Hash(inputtext));
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment