Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <dfile>
- #include <sscanf2>
- #include <nfunk>
- #define FOLDERZAPISU "/Konta/" // Gdzie zapisywane są konta
- #define PLAYERMARKERRANGE 250 // Z jakiej odleglosci ma byc widziany marker (pickup)
- #define MESSAGERANGE 30 // Z jakiej odleglosci ma byc widziany czat loklany
- #define NAMETAGSRANGE 30 // Z jakiej odleglosci ma byc widziany name tag
- new Text:Nazwa;
- new Text:Panel;
- new Text:LoginBox;
- new Text:LoginButton;
- new Text:RegisterBox;
- new Text:RegisterButton;
- new Text:ExitBox;
- new Text:ExitButton;
- enum Graczyk
- {
- cammovcount,
- Wiek,
- Miasto,
- Plec
- };
- new Gracz[MAX_PLAYERS][Graczyk];
- new Text3D:Gracz3DText[MAX_PLAYERS];
- /* Rangi
- 7 = Zarzad
- 6 = Administrator
- 5 = GameMaster
- 4 = Support
- 3 = Moderator
- 2 = Premium
- 1 = Gracz
- 0 = Zbanowany
- */
- main
- ()
- {}
- public OnGameModeInit()
- {
- //Ustawienia serwera
- ShowNameTags(false);
- ShowPlayerMarkers(1);
- LimitPlayerMarkerRadius(PLAYERMARKERRANGE);
- SetGameModeText("c-rp");
- //TextDrawy uwaaga duże ich bo się dziwnie bugujo xd
- Nazwa = TextDrawCreate(434.500000, 8.166609, "countyRolePlay"); // nazwa serwera panel
- TextDrawLetterSize(Nazwa, 0.725499, 2.947503);
- TextDrawAlignment(Nazwa, 1);
- TextDrawColor(Nazwa, -1);
- TextDrawSetShadow(Nazwa, 0);
- TextDrawSetOutline(Nazwa, 2);
- TextDrawBackgroundColor(Nazwa, 51);
- TextDrawFont(Nazwa, 0);
- TextDrawSetProportional(Nazwa, 1);
- Panel = TextDrawCreate(364.000000, 1.500000, "usebox"); // sam panel
- TextDrawLetterSize(Panel, 0.000000, 49.396297);
- TextDrawTextSize(Panel, 637.500000, 0.000000);
- TextDrawAlignment(Panel, 1);
- TextDrawColor(Panel, 0);
- TextDrawUseBox(Panel, true);
- TextDrawBoxColor(Panel, 102);
- TextDrawSetShadow(Panel, 0);
- TextDrawSetOutline(Panel, 0);
- TextDrawFont(Panel, 0);
- LoginBox = TextDrawCreate(580.000000, 153.166625, "usebox"); // LOGIN box
- TextDrawLetterSize(LoginBox, 0.000000, 4.800000);
- TextDrawTextSize(LoginBox, 434.000000, 0.000000);
- TextDrawAlignment(LoginBox, 1);
- TextDrawColor(LoginBox, 0);
- TextDrawUseBox(LoginBox, true);
- TextDrawBoxColor(LoginBox, 255);
- TextDrawSetShadow(LoginBox, 0);
- TextDrawSetOutline(LoginBox, 0);
- TextDrawFont(LoginBox, 0);
- TextDrawSetSelectable(LoginBox, true);
- LoginButton = TextDrawCreate(463.500000, 162.166671, "ZALOGUJ"); // Zaloguj Przycisk
- TextDrawLetterSize(LoginButton, 0.652499, 2.410834);
- TextDrawAlignment(LoginButton, 1);
- TextDrawColor(LoginButton, -1);
- TextDrawSetShadow(LoginButton, 0);
- TextDrawSetOutline(LoginButton, 1);
- TextDrawBackgroundColor(LoginButton, 51);
- TextDrawFont(LoginButton, 3);
- TextDrawSetProportional(LoginButton, 1);
- TextDrawSetSelectable(LoginButton, true);
- RegisterBox = TextDrawCreate(580.000000, 239.499954, "usebox"); // REGISTER box
- TextDrawLetterSize(RegisterBox, 0.000000, 4.738888);
- TextDrawTextSize(RegisterBox, 434.000000, 0.000000);
- TextDrawAlignment(RegisterBox, 1);
- TextDrawColor(RegisterBox, 0);
- TextDrawUseBox(RegisterBox, true);
- TextDrawBoxColor(RegisterBox, 255);
- TextDrawSetShadow(RegisterBox, 0);
- TextDrawSetOutline(RegisterBox, 0);
- TextDrawFont(RegisterBox, 0);
- TextDrawSetSelectable(RegisterBox, true);
- RegisterButton = TextDrawCreate(443.000000, 247.916641, "ZAREJESTRUJ"); // Zarejestruj przycisk
- TextDrawLetterSize(RegisterButton, 0.585999, 2.626669);
- TextDrawAlignment(RegisterButton, 1);
- TextDrawColor(RegisterButton, -1);
- TextDrawSetShadow(RegisterButton, 0);
- TextDrawSetOutline(RegisterButton, 1);
- TextDrawBackgroundColor(RegisterButton, 51);
- TextDrawFont(RegisterButton, 3);
- TextDrawSetProportional(RegisterButton, 1);
- TextDrawSetSelectable(RegisterButton, true);
- ExitBox = TextDrawCreate(580.000000, 370.750061, "usebox"); // FAQ box
- TextDrawLetterSize(ExitBox, 0.000000, -5.631481);
- TextDrawTextSize(ExitBox, 434.000000, 0.000000);
- TextDrawAlignment(ExitBox, 1);
- TextDrawColor(ExitBox, 0);
- TextDrawUseBox(ExitBox, true);
- TextDrawBoxColor(ExitBox, 255);
- TextDrawSetShadow(ExitBox, 0);
- TextDrawSetOutline(ExitBox, 0);
- TextDrawFont(ExitBox, 0);
- TextDrawSetSelectable(ExitBox, true);
- ExitButton = TextDrawCreate(485.500000, 332.499908, "FAQ"); // Faq przycisk
- TextDrawLetterSize(ExitButton, 0.785000, 2.410833);
- TextDrawAlignment(ExitButton, 1);
- TextDrawColor(ExitButton, -1);
- TextDrawSetShadow(ExitButton, 0);
- TextDrawSetOutline(ExitButton, 1);
- TextDrawBackgroundColor(ExitButton, 51);
- TextDrawFont(ExitButton, 3);
- TextDrawSetProportional(ExitButton, 1);
- TextDrawSetSelectable(ExitButton, true);
- print("[GM] Uruchamiam i sprawdzam...");
- if(!dfile_FileExists(FOLDERZAPISU))
- {
- print("[GM] Folder z kontami nie zostal odnaleziony! Wylaczam serwer");
- SendRconCommand("exit");
- }
- else
- {
- print("[GM] Folder został odnaleziony, serwer zostal uruchomiony!");
- }
- return 1;
- }
- public OnGameModeExit()
- {
- TextDrawDestroy(Panel);
- TextDrawDestroy(Nazwa);
- TextDrawDestroy(LoginBox);
- TextDrawDestroy(LoginButton);
- TextDrawDestroy(RegisterBox);
- TextDrawDestroy(RegisterButton);
- TextDrawDestroy(ExitBox);
- TextDrawDestroy(ExitButton);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new string[500];
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, sizeof(pName));
- format(string, sizeof(string), "%s (ID: %i) Reputacja: 0",pName, playerid);
- Gracz3DText[playerid] = Create3DTextLabel(string, 0x807D7DFF, 0.0,0.0,0.0, NAMETAGSRANGE, 0);
- Attach3DTextLabelToPlayer(Gracz3DText[playerid],playerid, 0.0,0.0,0.0);
- // Panel Logowania
- TextDrawShowForPlayer(playerid, Nazwa);
- TextDrawShowForPlayer(playerid, Panel);
- TextDrawShowForPlayer(playerid, LoginBox);
- TextDrawShowForPlayer(playerid, LoginButton);
- TextDrawShowForPlayer(playerid, RegisterBox);
- TextDrawShowForPlayer(playerid, RegisterButton);
- TextDrawShowForPlayer(playerid, ExitBox);
- TextDrawShowForPlayer(playerid, ExitButton);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- Delete3DTextLabel(Gracz3DText[playerid]);
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- TextDrawHideForPlayer(playerid, Panel);
- TextDrawHideForPlayer(playerid, Nazwa);
- TextDrawHideForPlayer(playerid, LoginButton);
- TextDrawHideForPlayer(playerid, LoginBox);
- TextDrawHideForPlayer(playerid, RegisterButton);
- TextDrawHideForPlayer(playerid, RegisterBox);
- TextDrawHideForPlayer(playerid, ExitButton);
- TextDrawHideForPlayer(playerid, ExitBox);
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- new pName[MAX_PLAYER_NAME];
- new Wiadomosc[500];
- GetPlayerName(playerid, pName, sizeof(pName));
- format(Wiadomosc, sizeof(Wiadomosc), "%s mowi: %s",pName, text);
- SendClientMessageInRange(playerid, Wiadomosc, 0x676767FF, MESSAGERANGE);
- SetPlayerChatBubble(playerid, text, 0xFF0000FF, 10,10000);
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(newkeys == KEY_FIRE)
- {
- TextDrawShowForPlayer(playerid, LoginButton);
- TextDrawShowForPlayer(playerid, LoginBox);
- TextDrawShowForPlayer(playerid, RegisterButton);
- TextDrawShowForPlayer(playerid, RegisterBox);
- TextDrawShowForPlayer(playerid, ExitButton);
- TextDrawShowForPlayer(playerid, ExitBox);
- SelectTextDraw(playerid, 0xFF4040AA);
- }
- return 1;
- }
- public OnPlayerClickTextDraw(playerid, Text:clickedid)
- {
- if(_:clickedid != INVALID_TEXT_DRAW) //
- {
- if(clickedid == LoginBox)
- {
- ShowPlayerDialog(playerid, 123, DIALOG_STYLE_MSGBOX, "TEST", "Textdraw działa poprawnie!", "OK", "OK");
- }
- else if(clickedid == LoginButton)
- {
- ShowPlayerDialog(playerid, 1234, DIALOG_STYLE_MSGBOX, "TEST", "Textdraw działa poprawnie!", "OK", "OK");
- }
- else if(clickedid == RegisterBox)
- {
- SendClientMessage(playerid, 0x000000FF, "Działa poprawnie");
- }
- else if(clickedid == RegisterButton)
- {
- SendClientMessage(playerid, 0x000000FF, "Działa poprawnie");
- }
- else if(clickedid == ExitBox)
- {
- SendClientMessage(playerid, 0x000000FF, "Działa poprawnie");
- }
- else if(clickedid == ExitButton)
- {
- SendClientMessage(playerid, 0x000000FF, "Działa poprawnie");
- }
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- return 1;
- }
- stock SendClientMessageInRange(playerid, string[], color, Float:range)
- {
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- for(new i; i <= GetPlayerPoolSize(); i++)
- if(IsPlayerConnected(i))
- if(IsPlayerInRangeOfPoint(i, range, X, Y, Z))
- SendClientMessage(i, color, string);
- return 1;
- }
- stock Register(playerid,haslo[])
- {
- new string[500];
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, sizeof(pName));
- format(string, sizeof(string), "/Konta/%s.ini",pName);
- dfile_Create(string);
- dfile_MultiSet(string, "Haslo",haslo);
- dfile_MultiSet(string, "Kasa", 250);
- dfile_MultiSet(string, "Ranga", 1); // Spis rang jest na samej górze gm!!
- dfile_MultiSet(string, "Wiek", 0);
- dfile_MultiSet(string, "Plec", 0);
- SendClientMessage(playerid, 000000FF, "Konto zostalo pomyslnie zalozone !");
- return 1;
- }
- stock WczytajGracza(playerid)
- {
- new string[500];
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, sizeof(pName));
- format(string, sizeof(string), "/Konta/%s.ini",pName);
- //
- ResetPlayerMoney(playerid);
- GivePlayerMoney(playerid, dfile_IsSet(string, "Kasa"));
- Gracz[playerid][Ranga] = dfile_IsSet(string, "Ranga");
- Gracz[playerid][Wiek] = dfile_IsSet(string, "Wiek");
- Gracz[playerid][Plec] = dfile_IsSett(string, "Plec");
- return 1;
- }
- stock ZapiszGracza(playerid)
- {
- new string[500];
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, sizeof(pName));
- format(string, sizeof(string), "/Konta/%s.ini",pName);
- dfile_IsSet(string, "Kasa", GetPlayerMoney(playerid));
- dfile_IsSet(string, "Ranga", Gracz[playerid][Wiek]);
- dfile_IsSet(string, "Wiek", Gracz[playerid][Wiek]);
- dfile_IsSet(string, "Plec", Gracz[playerid][Plec]);
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp(cmdtext, "/help", true))
- {
- return 1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement