Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #include <dfile>
- #include <kolory>
- #include <sscanf>
- #pragma tabsize 0
- #define MENU01 3
- #define FOLDER_KONT "/Konta/"
- #define DIALOG_REJESTRACJA 0
- #define DIALOG_LOGOWANIE 1
- #define PUNKTY_NA_START 10
- #define KASA_NA_START 10500
- main()
- {
- print("\n----------------------------------");
- print(" Mapa stworzona przez Dj_Malina!");
- print("----------------------------------\n");
- }
- enum Dgracza
- {
- bool:Zalogowany
- };
- new DaneGracza[MAX_PLAYERS][Dgracza];
- public OnGameModeInit()
- {
- for(new idskina=0; idskina < 311; idskina++)
- {
- AddPlayerClass(idskina, 00.00, 00.00, 00.00, 00.00, 0, 0, 0, 0, 0, 0);
- }
- UsePlayerPedAnims();
- // Don't use these lines if it's a filterscript
- /*SetGameModeText("Aktualizacja 1.1.2 ");
- AddPlayerClass(19, 00.00, 00.00, 00.00, 00.00, 0, 0, 0, 0, 0, 0);
- AddPlayerClass(22, 00.00, 00.00, 00.00, 00.00, 0, 0, 0, 0, 0, 0);
- AddPlayerClass(26, 00.00, 00.00, 00.00, 00.00, 0, 0, 0, 0, 0, 0);
- AddPlayerClass(302, 00.00, 00.00, 00.00, 00.00, 0, 0, 0, 0, 0, 0);
- AddPlayerClass(303, 00.00, 00.00, 00.00, 00.00, 0, 0, 0, 0, 0, 0);
- AddPlayerClass(251, 00.00, 00.00, 00.00, 00.00, 0, 0, 0, 0, 0, 0);*/
- if(!dfile_FileExists(FOLDER_KONT))
- return printf("Folder %s nie istnieje w folderze Scriptfiles! Stwórz go!", FOLDER_KONT);
- else printf("Folder %s istnieje i jest gotowy do wczytania kont!", FOLDER_KONT);
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext [])
- if(dialogid == DIALOG_LOGOWANIE)
- {
- if(response)
- {
- dfile_Open(SciezkaKontaGracza(playerid));
- new haslo[300];
- haslo = dfile_ReadString("Haslo");
- dfile_CloseFile();
- if(strcmp(inputtext, haslo, false) == 0)
- {
- }
- WczytajKonto(playerid);
- DaneGracza[playerid][Zalogowany] = true;
- TogglePlayerSpectating(playerid, false);
- WymusWyborPostaci(playerid);
- SendClientMessage(playerid, COLOR_GREEN, "Serwer: Hasło się zgadza, zostałeś(aś) pomyśle zalogowany(a)!");
- {
- else
- OknoLogowania(playerid);
- SendClientMessage(playerid, COLOR_GREEN, "Serwer: Hasło musi posiadać minimum 6 znaków");
- }
- }
- else Kick(playerid);
- if(dialogid == DIALOG_REJESTRACJA)
- if (response)
- if(strlen(inputtext) >= 6)
- {
- StworzKonto(playerid, inputtext);
- OknoLogowania(playerid);
- SendClientMessage(playerid, COLOR_GREEN, "Serwer: Konto zostało pomyślnie założone");
- }
- else
- {
- OknoRejestracji(playerid);
- SendClientMessage(playerid, COLOR_RED, "Serwer: Hasło się nie zgadza!");
- }
- else Kick(playerid);
- }
- public OnPlayerSpawn(playerid)
- {
- if(DaneGracza[playerid][Zalogowany] == false)
- {
- TogglePlayerSpectating(playerid, true);
- if(!dfile_FileExists(SciezkaKontaGracza(playerid)))
- OknoRejestracji(playerid);
- }
- else
- OknoLogowania(playerid);
- }
- public OnPlayerRequestClass(playerid,classid)
- {
- if(DaneGracza[playerid][Zalogowany] == false)
- {
- SetTimerEx("SpawnujGracza", 150, false, "i", playerid);
- }
- SetPlayerPos(playerid, 245.7793,-63.5309,4.3786);
- SetPlayerFacingAngle(playerid, 87.6020);
- SetPlayerCameraPos(playerid, 234.7242,-65.7141,1.4222);
- SetPlayerCameraLookAt(playerid, 245.7793,-63.5309,4.3786);
- return 1;
- }
- stock SciezkaKontaGracza(playerid)
- {
- new sciezka[128];
- format(sciezka, sizeof sciezka, FOLDER_KONT "%s.ini", NazwaGracza(playerid));
- return sciezka;
- }
- stock WczytajKonto(playerid)
- {
- ResetPlayerMoney(playerid);
- dfile_Open(SciezkaKontaGracza(playerid));
- SetPlayerScore(playerid, dfile_ReadInt("Punkty"));
- GivePlayerMoney(playerid, dfile_ReadInt("Kasa"));
- dfile_CloseFile();
- return 1;
- }
- {
- stock StworzKonto(playerid, haslo[])
- dfile_Create(SciezkaKontaGracza(playerid));
- dfile_Open(SciezkaKontaGracza(playerid));
- dfile_WriteString("Haslo", haslo);
- dfile_WriteInt("Punkty", PUNKTY_NA_START);
- dfile_WriteInt("Kasa", KASA_NA_START);
- dfile_WriteInt("Level", 9);
- dfile_SaveFile();
- dfile_CloseFile();
- return 1;
- }
- stock OknoRejestracji(playerid)
- {
- ShowPlayerDialog(playerid, DIALOG_REJESTRACJA, DIALOG_STYLE_PASSWORD, "Rejestracja", "Witaj na serwerze!\nNie posiadasz konta, proszę się zarejestrować!", "Zarejestruj", "Wyjdź");
- return 1;
- }
- stock OknoLogowania(playerid)
- {
- ShowPlayerDialog(playerid, DIALOG_LOGOWANIE, DIALOG_STYLE_PASSWORD, "Logowanie", "Witaj na serwerze!\nproszę się Zalogować!", "Zaloguj", "Wyjdź");
- return 1;
- }
- stock NazwaGracza(playerid)
- {
- new nazwa [MAX_PLAYER_NAME];
- GetPlayerName(playerid, nazwa, sizeof nazwa);
- return nazwa;
- }
- forward SpawnujGracza(playerid);
- public SpawnujGracza(playerid)
- {
- SpawnPlayer(playerid);
- return 1;
- }
- //FILM - 1H 30MIN 07SEC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement