Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* RCON Protection/Security By: EvanA */
- /* Use /togglercon to enable/disable the ability to login to RCON. */
- #include <a_samp>
- #include ZCMD
- #include foreach
- #define DIALOG_RCON 25
- // #define MAX_PLAYERS 500 // Change this to your Player Slot Amount.
- #define MAX_PLAYER_IP 32
- #define rconpass 02908929389378387 // This is your secondary RCON Login code. Change it to whatever you want :), TIP: Make it challenging to guess.
- new RconAttempts[MAX_PLAYERS] = 0;
- new RCONEnabled = 0;
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print("Evan's RCON Security Loaded.");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_RCON)
- {
- if(!response)
- {
- SendClientMessage(playerid, -1, "You must enter the secondary rcon pass-code to login.");
- Kick(playerid);
- }
- else {
- if(inputtext[30] == rconpass) {
- {
- SendClientMessage(playerid, -1, "You are now logged in as RCON Admin!");
- }
- if(strcmp(inputtext) != rconpass) { ShowPlayerDialog(playerid,DIALOG_RCON, DIALOG_STYLE_INPUT, "RCON", "Enter the secondary passcode below.", "Authorize", "Cancel"); }
- }
- }
- return 1;
- }
- return 0;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- new tempip[MAX_PLAYER_IP], playerid;
- foreach(Player, i) {
- GetPlayerIp(i, tempip, sizeof(tempip));
- if(strcmp(tempip, ip) == 0) {
- playerid = i;
- }
- }
- if(success && RCONEnabled == 0) {
- ShowPlayerDialog(playerid,DIALOG_RCON, DIALOG_STYLE_INPUT, "RCON", "Enter the secondary passcode below:", "Authorize", "Cancel");
- } else {
- if(RconAttempts[playerid] < 3) RconAttempts[playerid]++;
- else Kick(playerid);
- }
- return 1;
- }
- CMD:togglercon(playerid, params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- if(RCONEnabled == 0)
- {
- SendClientMessage(playerid, -1, "You have disabled logging into RCON. Use /togglercon to enable it again");
- RCONEnabled = 1;
- }
- else
- {
- SendClientMessage(playerid, -1, "You have enabled logging into RCON. Use /togglercon to enable it again");
- RCONEnabled = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment