Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* SKRYPT ZOSTAŁ STWORZONY PRZEZ SLASH
- © Copyright by Slash */
- //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=DEFINE-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- #include a_samp.inc
- #include zcmd.inc
- #include sscanf2.inc
- #define FILTERSCRIPT
- #define GUI_ADMIN (4500)
- #define GUI_ADD (4501)
- #define GUI_EDIT (4502)
- #define GUI_DELETE (4503)
- #define GUI_WRITE (4504)
- #define GUI_ADMIN_2 (4505)
- #define GUI_CZAS (4506)
- #define GUI_MIEJSC (4507)
- #define MAX_MIEJSC 20
- #define C_CZERWONY 0xFF0000FF
- #define C_ZIELONY 0x008006FF
- new Timer, TrwajaZapisy, Czas[2], update[200], Miejsc[2], Text:TextDraw[2], p;
- enum ssInfo {
- NazwaSS[24],
- Float:X,
- Float:Y,
- Float:Z,
- Float:Ang
- }
- new SS[MAX_MIEJSC][ssInfo];
- forward StartujSS();
- public OnFilterScriptInit()
- {
- print("\n\tSkoki Spadochronowe 2.0 by Slash");
- print("\tZapraszam na Pawno.PL\n");
- Czas[0] = 30;
- Czas[1] = 30;
- Miejsc[0] = 30;
- Miejsc[1] = 30;
- new File:f;
- if(!fexist("ss.ini"))
- {
- f = fopen("ss.ini", io_write);
- for(new i = 0; i != MAX_MIEJSC; i++)
- fwrite(f, "Pusta|0.0|0.0|0.0|0.0\r\n");
- fclose(f);
- } else {
- new string[64], x;
- f = fopen("ss.ini", io_read);
- while(fread(f, string))
- {
- sscanf(string, "p<|>e<s[24]ffff>", SS[x]);
- x++;
- }
- }
- TextDraw[1] = TextDrawCreate(221.000000, 350.000000, "_");
- TextDrawBackgroundColor(TextDraw[1], 255);
- TextDrawFont(TextDraw[1], 1);
- TextDrawLetterSize(TextDraw[1], 0.500000, 10.499998);
- TextDrawColor(TextDraw[1], -1);
- TextDrawSetOutline(TextDraw[1], 0);
- TextDrawSetProportional(TextDraw[1], 1);
- TextDrawSetShadow(TextDraw[1], 1);
- TextDrawUseBox(TextDraw[1], 1);
- TextDrawBoxColor(TextDraw[1], 90);
- TextDrawTextSize(TextDraw[1], 420.000000, 10.000000);
- TextDraw[0] = TextDrawCreate(321.000000, 351.000000, "~w~Skoki Spadochronowe~n~~n~Uzyj ~g~/ss ~w~by sie zapisac!~n~~n~Pozostalo ~g~30 ~w~sekund!~n~~n~Pozostalo ~g~30 ~w~wolnych miejsc!");
- TextDrawAlignment(TextDraw[0], 2);
- TextDrawBackgroundColor(TextDraw[0], 255);
- TextDrawFont(TextDraw[0], 1);
- TextDrawLetterSize(TextDraw[0], 0.360000, 1.399999);
- TextDrawColor(TextDraw[0], -1);
- TextDrawSetOutline(TextDraw[0], 1);
- TextDrawSetProportional(TextDraw[0], 1);
- return 1;
- }
- //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- public OnFilterScriptExit()
- {
- TextDrawDestroy(TextDraw[0]);
- TextDrawDestroy(TextDraw[1]);
- return 1;
- }
- //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)
- {
- case GUI_ADMIN:
- {
- if(!response)
- return 1;
- if(PustaPozycja(listitem))
- ShowPlayerDialog(playerid, GUI_ADD, DIALOG_STYLE_INPUT, ">> PA MIEJSC >> Zapisz Nową Pozycję", "Podaj nazwę tej pozycji, a następnie wciśnij 'OK'.", "Ok", "Anuluj");
- else
- ShowPlayerDialog(playerid, GUI_EDIT, DIALOG_STYLE_LIST, ">> PA MIEJSC >> Edycja Pozycji", "Startuj SS z tej pozycji\nNadpisz tą pozycję\nUsuń tę pozycję", "Ok", "Anuluj");
- SetPVarInt(playerid, "miejsce", listitem);
- return 1;
- }
- case GUI_EDIT:
- {
- if(!response)
- return 1;
- switch(listitem)
- {
- case 0:
- {
- Timer = SetTimer("StartujSS", 1000, 1);
- TrwajaZapisy = 1;
- TextDrawShowForAll(TextDraw[1]);
- TextDrawShowForAll(TextDraw[0]);
- Miejsc[0] = Miejsc[1];
- Czas[0] = Czas[1];
- p = GetPVarInt(playerid, "miejsce");
- return 1;
- }
- case 1: ShowPlayerDialog(playerid, GUI_WRITE, DIALOG_STYLE_INPUT, ">> PA MIEJSC >> Edycja Pozycji >> Nadpisz Pozycję", "Podaj nazwę tej pozycji, a następnie wciśnij 'OK'.", "Ok", "Anuluj");
- case 2:
- {
- new x = GetPVarInt(playerid, "miejsce");
- format(SS[x][NazwaSS], 24, "Pusta");
- SS[x][X] = 0;
- SS[x][Y] = 0;
- SS[x][Z] = 0;
- SS[x][Ang] = 0;
- ZapiszPozycje();
- DeletePVar(playerid, "miejsce");
- SendClientMessage(playerid, C_ZIELONY, "> Pozycja została usunięta! <");
- return 1;
- }
- }
- return 1;
- }
- case GUI_ADD:
- {
- if(!response)
- return 1;
- new x = GetPVarInt(playerid, "miejsce"), Float:pos[4];
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- GetPlayerFacingAngle(playerid, pos[3]);
- format(SS[x][NazwaSS], 24, "%s", inputtext);
- SS[x][X] = pos[0];
- SS[x][Y] = pos[1];
- SS[x][Z] = pos[2];
- SS[x][Ang] = pos[3];
- ZapiszPozycje();
- DeletePVar(playerid, "miejsce");
- SendClientMessage(playerid, C_ZIELONY, "> Pozycja została zapisana! <");
- return 1;
- }
- case GUI_WRITE:
- {
- if(!response)
- return 1;
- new x = GetPVarInt(playerid, "miejsce"), Float:pos[4];
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- GetPlayerFacingAngle(playerid, pos[3]);
- format(SS[x][NazwaSS], 24, "%s", inputtext);
- SS[x][X] = pos[0];
- SS[x][Y] = pos[1];
- SS[x][Z] = pos[2];
- SS[x][Ang] = pos[3];
- ZapiszPozycje();
- SendClientMessage(playerid, C_ZIELONY, "> Pozycja została nadpisana! <");
- return 1;
- }
- case GUI_ADMIN_2:
- {
- if(!response)
- return 1;
- switch(listitem)
- {
- case 0: ShowPlayerDialog(playerid, GUI_CZAS, DIALOG_STYLE_INPUT, ">> PA >> Ustaw czas", "Podaj czas (w sekundach) odliczania!", "Ok", "Anuluj");
- case 1: ShowPlayerDialog(playerid, GUI_MIEJSC, DIALOG_STYLE_INPUT, ">> PA >> Ustaw ilość miejsc", "Podaj ilość miejsc!", "Ok", "Anuluj");
- case 2:
- {
- new string[512];
- for(new i = 0; i < MAX_MIEJSC; i++)
- format(string, sizeof string, "%s%s\n", string, SS[i][NazwaSS]);
- ShowPlayerDialog(playerid, GUI_ADMIN, DIALOG_STYLE_LIST, ">> PA MIEJSC", string, "OK", "Anuluj");
- return 1;
- }
- }
- }
- case GUI_CZAS:
- {
- if(!response)
- return 1;
- Czas[1] = strval(inputtext);
- SendClientMessage(playerid, C_ZIELONY, "> Ustawiłeś nowy czas odliczania! <");
- return 1;
- }
- case GUI_MIEJSC:
- {
- if(!response)
- return 1;
- Miejsc[1] = strval(inputtext);
- SendClientMessage(playerid, C_ZIELONY, "> Ustawiłeś nową liczbę miejsc! <");
- return 1;
- }
- }
- return 1;
- }
- //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- public StartujSS()
- {
- if(Czas[0] >= 1)
- {
- format(update, sizeof update, "~w~Skoki Spadochronowe~n~~n~Uzyj ~g~/ss ~w~by sie zapisac!~n~~n~Pozostalo ~g~%d ~w~sekund!~n~~n~Pozostalo ~g~%d ~w~wolnych miejsc!", Czas[0], Miejsc[0]);
- TextDrawSetString(TextDraw[0], update);
- }
- if(Czas[0] == 0)
- {
- if(Miejsc[0] == Miejsc[1])
- return 1, SendClientMessageToAll(C_CZERWONY, "> Skoki spadochrone nie wystartowały! (Zapisało się zbyt mało osób)");
- RozpocznijSS();
- } else if(Miejsc[0] == 0)
- RozpocznijSS();
- Czas[0]--;
- return 1;
- }
- //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- stock PustaPozycja(listitem)
- {
- if(!strcmp(SS[listitem][NazwaSS], "Pusta", true))
- return 1;
- return 0;
- }
- stock RozpocznijSS()
- {
- Czas[0] = Czas[1];
- KillTimer(Timer);
- TextDrawHideForAll(TextDraw[0]);
- TextDrawHideForAll(TextDraw[1]);
- TrwajaZapisy = 0;
- Miejsc[0] = Miejsc[1];
- for(new i = 0; i < GetMaxPlayers(); i++)
- {
- if(GetPVarInt(i, "ZapisalSS"))
- {
- SetPlayerPos(i, SS[p][X], SS[p][Y], SS[p][Z]);
- SetPlayerFacingAngle(i, SS[p][Ang]);
- SetCameraBehindPlayer(i);
- GivePlayerWeapon(i, 46, 1);
- SetPVarInt(i, "ZapisalSS", 0);
- }
- }
- return 1;
- }
- stock ZapiszPozycje()
- {
- new string[64], File:f = fopen("ss.ini", io_write);
- for(new i = 0; i != MAX_MIEJSC; i++)
- {
- format(string, sizeof string, "%s|%0.3f|%0.3f|%0.3f|%0.3f\r\n", SS[i][NazwaSS], SS[i][X], SS[i][Y], SS[i][Z], SS[i][Ang]);
- fwrite(f, string);
- }
- fclose(f);
- return 1;
- }
- //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- CMD:admin(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid))
- return 1, SendClientMessage(playerid, C_CZERWONY, "> Nie jesteś administratorem! <");
- if(TrwajaZapisy == 1)
- return 1, SendClientMessage(playerid, C_CZERWONY, "> Trwają zapisy na skoki spadochronowe! <");
- ShowPlayerDialog(playerid, GUI_ADMIN_2, DIALOG_STYLE_LIST, ">> PA ", "Ustaw czas zapisów (domyślnie 30s)\nUstaw ilość miejsc (domyślnie 30)\nPanel zarządzania miejscami", "Ok", "Anuluj");
- return 1;
- }
- CMD:ss(playerid, params[])
- {
- if(!TrwajaZapisy)
- return 1, SendClientMessage(playerid, C_CZERWONY, "> Obecnie nie ma zapisów na skoki spadochronowe! <");
- if(GetPVarInt(playerid, "ZapisalSS"))
- return 1, SendClientMessage(playerid, C_CZERWONY, "> Już się zapisałeś na skoki spadochronowe! <");
- SetPVarInt(playerid, "ZapisalSS", 1);
- SendClientMessage(playerid, C_ZIELONY, "> Zapisałeś się na skoki spadochronowe! <");
- Miejsc[0]--;
- return 1;
- }
- CMD:about(playerid, params[])
- return 1, ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_MSGBOX, "Skoki Spadochronowe 1.0", "Autor: \t\tSlash/Slasheer www.slasheer.xaa.pl\nZapraszam na:\twww.Pawno.PL\n\nSerdeczne podziękowania dla bocian941", "Ok", "");
Advertisement
Add Comment
Please, Sign In to add comment