Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <dof2>
- #include <dudb>
- #define Hesla "/Ucty/Hesla/%s.txt"
- #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
- new Text:TDEditor_TD0;
- new Text:TDEditor_TD1;
- new Text:TDEditor_TD2;
- public OnFilterScriptInit()
- {
- TDEditor_TD0 = TextDrawCreate(291.405975, -1.333245, "_");
- TextDrawLetterSize(TDEditor_TD0, 0.384538, 7.911665);
- TextDrawTextSize(TDEditor_TD0, 8.760105, 1072.000000);
- TextDrawAlignment(TDEditor_TD0, 2);
- TextDrawColor(TDEditor_TD0, -1);
- TextDrawUseBox(TDEditor_TD0, 1);
- TextDrawBoxColor(TDEditor_TD0, 255);
- TextDrawSetShadow(TDEditor_TD0, 87);
- TextDrawSetOutline(TDEditor_TD0, 212);
- TextDrawBackgroundColor(TDEditor_TD0, 255);
- TextDrawFont(TDEditor_TD0, 1);
- TextDrawSetProportional(TDEditor_TD0, 0);
- TextDrawSetShadow(TDEditor_TD0, 87);
- TDEditor_TD1 = TextDrawCreate(280.630065, 375.500213, "_");
- TextDrawLetterSize(TDEditor_TD1, 0.384538, 7.911665);
- TextDrawTextSize(TDEditor_TD1, 8.760105, 1072.000000);
- TextDrawAlignment(TDEditor_TD1, 2);
- TextDrawColor(TDEditor_TD1, -1);
- TextDrawUseBox(TDEditor_TD1, 1);
- TextDrawBoxColor(TDEditor_TD1, 255);
- TextDrawSetShadow(TDEditor_TD1, 87);
- TextDrawSetOutline(TDEditor_TD1, 212);
- TextDrawBackgroundColor(TDEditor_TD1, 255);
- TextDrawFont(TDEditor_TD1, 1);
- TextDrawSetProportional(TDEditor_TD1, 0);
- TextDrawSetShadow(TDEditor_TD1, 87);
- TDEditor_TD2 = TextDrawCreate(227.218048, 24.916673, "NAZEV_SERVERU");
- TextDrawLetterSize(TDEditor_TD2, 0.648784, 3.349999);
- TextDrawAlignment(TDEditor_TD2, 1);
- TextDrawColor(TDEditor_TD2, -5963521);
- TextDrawSetShadow(TDEditor_TD2, 0);
- TextDrawSetOutline(TDEditor_TD2, 0);
- TextDrawBackgroundColor(TDEditor_TD2, 255);
- TextDrawFont(TDEditor_TD2, 2);
- TextDrawSetProportional(TDEditor_TD2, 1);
- TextDrawSetShadow(TDEditor_TD2, 0);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new nick[MAX_PLAYER_NAME], soubor[256];
- GetPlayerName(playerid, nick, sizeof(nick));
- format(soubor, sizeof(soubor), Hesla, nick);
- if (DOF2_FileExists(soubor))
- {
- ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "{73C0E6}Přihlašování...", "{66F2BE}Vítej zpátky na serveru XXX! Zde zadej svoje heslo:", "{FF80C0}LOGIN", "");
- PlayAudioStreamForPlayer(playerid, "http://k007.kiwi6.com/hotlink/7r8pac2erw/Alesso_vs_OneRepublic_-_If_I_Lose_Myself_Alesso_Remix_.mp3");
- TextDrawShowForPlayer(playerid,TDEditor_TD0);
- TextDrawShowForPlayer(playerid,TDEditor_TD1);
- TextDrawShowForPlayer(playerid,TDEditor_TD2);
- }
- else
- {
- ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "{73C0E6}Registrace...","{66F2BE}Vítej na serveru XXX! Zde zadej svoje nové heslo:", "{FF80C0}REGISTRACE", "");
- PlayAudioStreamForPlayer(playerid, "http://k007.kiwi6.com/hotlink/7r8pac2erw/Alesso_vs_OneRepublic_-_If_I_Lose_Myself_Alesso_Remix_.mp3");
- TextDrawShowForPlayer(playerid,TDEditor_TD0);
- TextDrawShowForPlayer(playerid,TDEditor_TD1);
- TextDrawShowForPlayer(playerid,TDEditor_TD2);
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- dcmd(changepass,10,cmdtext);
- return 0;
- }
- dcmd_changepass(playerid,params[])
- {
- #pragma unused params
- ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"{73C0E6}Změna hesla","{66F2BE}Zadej prosím svoje staré heslo","{FF80C0}Další","{FE635A}Zavřít");
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if (dialogid == 1)
- {
- new nick[MAX_PLAYER_NAME], soubor[256], string[128];
- GetPlayerName(playerid, nick, sizeof(nick));
- format(soubor, sizeof(soubor), Hesla, nick);
- if(!response) return Kick(playerid);
- if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "{73C0E6}Registrace...","{66F2BE}Vítej na serveru XXX! Zde zadej svoje nové heslo:", "{FF80C0}REGISTRACE", "");
- TextDrawShowForPlayer(playerid,TDEditor_TD0);
- TextDrawShowForPlayer(playerid,TDEditor_TD1);
- TextDrawShowForPlayer(playerid,TDEditor_TD2);
- DOF2_CreateFile(soubor);
- DOF2_SetInt(soubor, "Heslo", udb_hash(inputtext));
- DOF2_SaveFile();
- format(string, 128, "Byl jsi úspěšně zaregistrovaný na jméno %s. Tvoje heslo je %s.", nick, inputtext);
- SendClientMessage(playerid, 0x66F2BEFF, string);
- StopAudioStreamForPlayer(playerid);
- TextDrawHideForPlayer(playerid,TDEditor_TD0);
- TextDrawHideForPlayer(playerid,TDEditor_TD1);
- TextDrawHideForPlayer(playerid,TDEditor_TD2);
- }
- if (dialogid == 2)
- {
- new nick[MAX_PLAYER_NAME], soubor[256];
- GetPlayerName(playerid, nick, sizeof(nick));
- format(soubor, sizeof(soubor), Hesla, nick);
- if(!response) return Kick(playerid);
- new tmp;
- tmp = DOF2_GetInt(soubor, "Heslo");
- if(udb_hash(inputtext) != tmp)
- ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "{73C0E6}Přihlašování...", "{66F2BE}Vítej zpátky na serveru XXX! Zde zadej svoje heslo:\n{FE635A}Zadal jsi špatné heslo!", "{FF80C0}LOGIN", "");
- TextDrawShowForPlayer(playerid,TDEditor_TD0);
- TextDrawShowForPlayer(playerid,TDEditor_TD1);
- TextDrawShowForPlayer(playerid,TDEditor_TD2);
- if(!strcmp(inputtext,DOF2_GetString(soubor,"Heslo"),false))
- {
- ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "{73C0E6}Přihlašování...", "{66F2BE}Vítej zpátky na serveru XXX! Zde zadej svoje heslo:", "{FF80C0}LOGIN", "");
- TextDrawShowForPlayer(playerid,TDEditor_TD0);
- TextDrawShowForPlayer(playerid,TDEditor_TD1);
- TextDrawShowForPlayer(playerid,TDEditor_TD2);
- }
- else
- {
- SendClientMessage(playerid,0x66F2BEFF, "Byl jsi úspěšně přihlášený!!");
- TextDrawHideForPlayer(playerid,TDEditor_TD0);
- TextDrawHideForPlayer(playerid,TDEditor_TD1);
- TextDrawHideForPlayer(playerid,TDEditor_TD2);
- StopAudioStreamForPlayer(playerid);
- }
- }
- if(dialogid == 3)
- {
- new nick[MAX_PLAYER_NAME], slozka[256];
- GetPlayerName(playerid, nick, sizeof(nick));
- format(slozka, sizeof(slozka), Hesla, nick);
- if(response)
- {
- if(udb_hash(inputtext) != DOF2_GetInt(slozka, "Heslo"))
- {
- ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"{73C0E6}Změna hesla","{66F2BE}Zadej prosím svoje staré heslo\n{FE635A}Zadal jsi špatné heslo!","{FF80C0}Další","{FE635A}Zavřít");
- }
- else
- {
- ShowPlayerDialog(playerid,4,DIALOG_STYLE_INPUT,"{73C0E6}Změna hesla","{66F2BE}Zadej prosím svoje nové heslo","{FF80C0}Hotovo","{FE635A}Zavřít");
- }
- }
- }
- if(dialogid == 4)
- {
- new nick[MAX_PLAYER_NAME], slozka[256];
- GetPlayerName(playerid, nick, sizeof(nick));
- format(slozka, sizeof(slozka), Hesla, nick);
- if(response)
- {
- DOF2_SetInt(slozka, "Heslo", udb_hash(inputtext));
- DOF2_SaveFile();
- SendClientMessage(playerid,0x66F2BEFF,"Heslo bylo úspěšně změněho! Svoje heslo si zapamatuj pro další přihlášení.");
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement