Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <easyDialog>
- #include <ysilib\YSI_Storage\y_ini>
- #include <ysilib\YSI_Coding\y_hooks>
- #include <ysilib\YSI_Coding\y_malloc>
- #include <ysilib\YSI_Coding\y_timers>
- #include <ysilib\YSI_Coding\y_va>
- #include <ysilib\YSI_Core\y_master>
- #include <ysilib\YSI_Core\y_utils>
- #include <ysilib\YSI_Data\y_foreach>
- #include <sscanf2>
- #include <streamer>
- #define KORISNIK_PATH "/Korisnici/%s.ini"
- enum korisnikInfo {
- pLozinka,
- pNovac,
- pBankaNovac,
- pLevel,
- pRespekti,
- pPotrebnoRespekta,
- pSkin,
- pAdmin,
- pUbistva,
- pSmrti
- };
- new KorisnikInfo[MAX_PLAYERS][korisnikInfo];
- forward UcitajKorisnike_data(const playerid, name[], value[]);
- public UcitajKorisnike_data(const playerid, name[], value[]) {
- INI_Int("Lozinka", KorisnikInfo[playerid][pLozinka]);
- INI_Int("Novac", KorisnikInfo[playerid][pNovac]);
- INI_Int("BankaNovac", KorisnikInfo[playerid][pBankaNovac]);
- INI_Int("Level", KorisnikInfo[playerid][pLevel]);
- INI_Int("Respekti", KorisnikInfo[playerid][pRespekti]);
- INI_Int("PotrebnoRespekta", KorisnikInfo[playerid][pPotrebnoRespekta]);
- INI_Int("Skin", KorisnikInfo[playerid][pSkin]);
- INI_Int("Admin", KorisnikInfo[playerid][pAdmin]);
- INI_Int("Ubistva", KorisnikInfo[playerid][pUbistva]);
- INI_Int("Smrti", KorisnikInfo[playerid][pSmrti]);
- return 1;
- }
- forward KickujIgraca(const playerid);
- public KickujIgraca(const playerid) {
- SendClientMessage(playerid, -1, ""c_srv"BO > "c_white"Kickovani ste sa servera!");
- Kick(playerid);
- return 1;
- }
- stock KorisnikPath(const playerid) {
- new string[128],playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid,playername,sizeof(playername));
- format(string,sizeof(string),KORISNIK_PATH,playername);
- return string;
- }
- stock udb_hash(const buf[]) {
- new length=strlen(buf);
- new s1 = 1;
- new s2 = 0;
- new n;
- for (n=0; n<length; n++)
- {
- s1 = (s1 + buf[n]) % 65521;
- s2 = (s2 + s1) % 65521;
- }
- return (s2 << 16) + s1;
- }
- stock ocistichat(const playerid, lines) {
- for(new i = 0; i < lines; i++) {
- SendClientMessage(playerid, -1, " ");
- }
- return 1;
- }
- stock ImeIgraca(const playerid) {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- return name;
- }
- stock SacuvajIgraca(const playerid) {
- new INI:File = INI_Open(KorisnikPath(playerid));
- INI_SetTag(File, "[Informacije]");
- INI_WriteInt(File, "Novac", GetPlayerMoney(playerid));
- INI_WriteInt(File, "BankaNovac", KorisnikInfo[playerid][pBankaNovac]);
- INI_WriteInt(File, "Level", GetPlayerScore(playerid));
- INI_WriteInt(File, "Respekti", KorisnikInfo[playerid][pRespekti]);
- INI_WriteInt(File, "PotrebnoRespekta", KorisnikInfo[playerid][pPotrebnoRespekta]);
- INI_WriteInt(File, "Skin", KorisnikInfo[playerid][pSkin]);
- INI_WriteInt(File, "Admin", KorisnikInfo[playerid][pAdmin]);
- INI_WriteInt(File, "Ubistva", KorisnikInfo[playerid][pUbistva]);
- INI_WriteInt(File, "Smrti", KorisnikInfo[playerid][pSmrti]);
- INI_Close(File);
- return 1;
- }
- hook OnGameModeInit() {
- print("|------------------------------|");
- print(" reglog is loading... ");
- print(" reglog is founded ");
- print(" reglog is loaded ");
- print("|------------------------------|\n\n");
- return 1;
- }
- hook OnPlayerConnect(playerid) {
- if(fexist(KorisnikPath(playerid))) {
- INI_ParseFile(KorisnikPath(playerid), "UcitajKorisnike_%s", .bExtra = true, .extra = playerid);
- Dialog_Show(playerid, "d_login", DIALOG_STYLE_PASSWORD, ""c_srv"BO "c_white"- Prijava", ""c_white"Unesite svoju lozinku za prijavu\n"c_white"Ako ste zaboravili vasu lozinku javite se na forum:"c_srv"www.bo-samp.info", ""c_white"Prijava", ""c_white"Izlaz");
- }
- else {
- Dialog_Show(playerid, "d_register", DIALOG_STYLE_PASSWORD, ""c_srv"BO "c_white"- Register", ""c_white"Da bi ste se registrovali na server unesite vasu zeljenu lozinku", ""c_white"Registracija", ""c_white"Izlaz");
- }
- return 1;
- }
- hook OnPlayerDisconnect(playerid, reason) {
- SacuvajIgraca(playerid);
- return 1;
- }
- hook OnPlayerSpawn(playerid) {
- SetPlayerSkin(playerid, KorisnikInfo[playerid][pSkin]);
- return 1;
- }
- hook OnPlayerDeath(playerid, killerid, reason) {
- KorisnikInfo[killerid][pUbistva]++;
- KorisnikInfo[playerid][pSmrti]++;
- return 1;
- }
- Dialog:d_register(const playerid, response, listitem, string: inputtext[]) {
- if(!response) return KickujIgraca(playerid);
- if(response) {
- if(!strlen(inputtext)) return Dialog_Show(playerid, "d_register", DIALOG_STYLE_PASSWORD, ""c_srv"BO "c_white"- Register", ""c_white"Da bi ste se registrovali na server unesite vasu zeljenu lozinku", ""c_white"Registracija", ""c_white"Izlaz");
- new INI:File = INI_Open(KorisnikPath(playerid));
- INI_SetTag(File, "[Informacije]");
- INI_WriteInt(File, "Lozinka", udb_hash(inputtext));
- INI_WriteInt(File, "Novac", 15000);
- INI_WriteInt(File, "BankaNovac", 0);
- INI_WriteInt(File, "Level", 3);
- INI_WriteInt(File, "Respekti", 0);
- INI_WriteInt(File, "PotrebnoRespekta", 10);
- INI_WriteInt(File, "Skin", 7);
- INI_WriteInt(File, "Admin", 0);
- INI_WriteInt(File, "Ubistva", 0);
- INI_WriteInt(File, "Smrti", 0);
- INI_Close(File);
- SetSpawnInfo(playerid, 0, KorisnikInfo[playerid][pSkin], 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
- SpawnPlayer(playerid);
- SetPlayerScore(playerid, 3);
- KorisnikInfo[playerid][pSkin] = 7;
- SetPlayerSkin(playerid, KorisnikInfo[playerid][pSkin]);
- KorisnikInfo[playerid][pNovac] = 15000;
- GivePlayerMoney(playerid, KorisnikInfo[playerid][pNovac]);
- KorisnikInfo[playerid][pPotrebnoRespekta] = 10;
- ocistichat(playerid, 20);
- }
- return 1;
- }
- Dialog:d_login(const playerid, response, listitem, string: inputtext[]) {
- if(!response) return KickujIgraca(playerid);
- if(response) {
- if(udb_hash(inputtext) == KorisnikInfo[playerid][pLozinka]) {
- INI_ParseFile(KorisnikPath(playerid), "UcitajKorisnike_%s", .bExtra = true, .extra = playerid);
- SetSpawnInfo(playerid, 0, KorisnikInfo[playerid][pSkin], 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
- SpawnPlayer(playerid);
- GivePlayerMoney(playerid, KorisnikInfo[playerid][pNovac]);
- SetPlayerSkin(playerid, KorisnikInfo[playerid][pSkin]);
- SetPlayerScore(playerid, KorisnikInfo[playerid][pLevel]);
- ocistichat(playerid, 20);
- }
- else {
- Dialog_Show(playerid, "d_login", DIALOG_STYLE_PASSWORD, ""c_srv"BO "c_white"- Prijava", ""c_white"Unesite svoju lozinku za prijavu\n"c_white"Ako ste zaboravili vasu lozinku javite se na forum:"c_srv"www.bo-samp.info", ""c_white"Prijava", ""c_white"Izlaz");
- }
- return 1;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement