Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <dini>
- #define DIALOG_REGISTER 0
- #define DIALOG_REGISTERED 1
- #define DIALOG_LOGIN 2
- #define DIALOG_LOGGED 3
- #define USER_FILE "Users/%s.ini"
- new PlayerLogged[MAX_PLAYERS];
- enum pInfo
- {
- pVisits,
- pKills,
- pDeaths
- }
- new PlayerInfo[MAX_PLAYERS][pInfo];
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Blank Filterscript by your name here");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #else
- main()
- {
- print("\n----------------------------------");
- print(" Blank Gamemode by your name here");
- print("----------------------------------\n");
- }
- #endif
- public OnGameModeInit()
- {
- // Don't use these lines if it's a filterscript
- SetGameModeText("Blank Script");
- AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- PlayerLogged[playerid] = 0;
- new IP[16]; GetPlayerIp(playerid, IP, 16);
- new name[MAX_PLAYER_NAME], file[256], str[500];
- GetPlayerName(playerid, name, sizeof(name));
- format(file, sizeof(file), USER_FILE, name);
- if (!dini_Exists(file))
- {
- format(str, sizeof(str),"Konto {66FF00}%s {FFFFFF}nie jest zarejestrowane.\nWpisz poniżej hasło, aby się zarejestrować.", name);
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Rejestracja", str, "Zarejestruj", "Anuluj");
- }
- if(fexist(file))
- {
- format(str, sizeof(str),"Konto {66FF00}%s {FFFFFF}jest już zarejestrowane.\nWpisz poniżej hasło, aby się zalogować.", name);
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Logowanie", str, "Zaloguj", "Anuluj");
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/mycommand", cmdtext, true, 10) == 0)
- {
- // Do something here
- return 1;
- }
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- return 1;
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- return 1;
- }
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- return 1;
- }
- public OnPlayerStreamOut(playerid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamOut(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_REGISTER)
- {
- new IP[16]; GetPlayerIp(playerid, IP, 16);
- new name[MAX_PLAYER_NAME], file[256], string[1900];
- GetPlayerName(playerid, name, sizeof(name));
- format(file, sizeof(file), USER_FILE, name);
- if(!response) return Kick(playerid);
- if (!strlen(inputtext)) return
- format(string, sizeof(string),"Konto {66FF00}%s {FFFFFF}nie jest zarejestrowane.\nWpisz poniżej hasło, aby się zarejestrować.", name);
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Rejestracja", string, "Zarejestruj", "Anuluj");
- dini_Create(file);
- dini_Set(file, "Name", name);
- dini_Set(file, "Password", inputtext);
- dini_Set(file, "IP", IP);
- dini_IntSet(file, "Visits", PlayerInfo[playerid][pVisits] = 1);
- dini_IntSet(file, "Money", GivePlayerMoney(playerid, 1));
- dini_IntSet(file, "Score", SetPlayerScore(playerid, 1));
- dini_IntSet(file, "Kills", PlayerInfo[playerid][pKills] = 0);
- dini_IntSet(file, "Deaths", PlayerInfo[playerid][pDeaths] = 0);
- format(string, sizeof(string),"Witaj %s twoje konto zostało zarejestrowane, a hasło do niego to %s\nZapaniętaj powyższe dane ponieważ będą potrzebne ci do zalogowania się.\n", name, inputtext);
- strcat(string, "\n");
- strcat(string, "{66FF00}Zakładając konto na serwerze automatycznie akceptujesz regulamin serwera oraz zobowiązujesz się do jego przestrzegania.\n");
- strcat(string, "\n");
- strcat(string, "{FF0000}1. {FFFFFF}Zakaz reklamowania stron oraz podawnia IP innych serwerów.\n");
- strcat(string, "{FF0000}2. {FFFFFF}Zakaz używania wszelkiego rodzaju modyfikacji oraz oprogramowań ułatwiających grę.\n");
- strcat(string, "{FF0000}3. {FFFFFF}Zakaz wykorzystywania błędów SA-MP oraz serwera na swoją korzyść i rozpowszechniania bez zgłoszenia administracji o błędzie.\n");
- strcat(string, "{FF0000}4. {FFFFFF}Zakaz tworzenia MultiKont.\n");
- strcat(string, "{FF0000}5. {FFFFFF}Zakaz ubliżania innym graczom.\n");
- strcat(string, "{FF0000}6. {FFFFFF}Zakaz spamowania na czacie.\n");
- strcat(string, "{FF0000}7. {FFFFFF}Zakaz nadmiernego używania wulgaryzmów.\n");
- strcat(string, "{FF0000}8. {FFFFFF}Zakaz stosowania gróźb wobec graczy jak i szantażu.\n");
- ShowPlayerDialog(playerid, DIALOG_REGISTERED, DIALOG_STYLE_MSGBOX, "Zarejestrowany", string, "Rozumiem", "");
- PlayerLogged[playerid] = 1;
- }
- if(dialogid == DIALOG_LOGIN)
- {
- new name[MAX_PLAYER_NAME], file[256], string[500];
- GetPlayerName(playerid, name, sizeof(name));
- format(file, sizeof(file), USER_FILE, name);
- if(!response) return Kick(playerid);
- format(string, sizeof(string),"Konto %s jest już zarejestrowane.\nWpisz poniżej hasło, aby się zalogować.", name);
- if (!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Logowanie", string, "Zaloguj", "Anuluj");
- if(strcmp(inputtext, dini_Get(file, "Password"), false))
- {
- Kick(playerid);
- }
- else
- {
- PlayerLogged[playerid] = 1;
- PlayerInfo[playerid][pVisits] = dini_Int(file, "Visits");
- GivePlayerMoney(playerid, dini_Int(file, "Money"));
- SetPlayerScore(playerid, dini_Int(file, "Score"));
- PlayerInfo[playerid][pKills] = dini_Int(file, "Kills");
- PlayerInfo[playerid][pDeaths] = dini_Int(file, "Deaths");
- PlayerInfo[playerid][pVisits] += 1;
- format(string, sizeof(string),"Witaj %s zostałeś zalogowany. Życzymy miłej gry!", name);
- ShowPlayerDialog(playerid, DIALOG_LOGGED, DIALOG_STYLE_MSGBOX, "Zalogowany", string, "Zamknij", "");
- }
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement