26.06.2011, 16:29
Hi i need help i wanna make a second rcon protection so when i log in with /rcon login pass after a dialog pop up says log in agai with the second pass so my rcon is safe any ways .
just like LuxAdmin?
just like LuxAdmin?
Код:
#include <a_samp> #if defined FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Blank Filterscript by your name here"); print("--------------------------------------\n"); return 1; } public OnFilterScriptExit() { return 1; } #else main() { print("\n----------------------------------"); print(" Blank Gamemode by your name here"); print("----------------------------------\n"); } #endif #define MAX_RCON_ATTEMPS 5 // Max Rcon Attemps #define EnableTwoRcon true // Enable/Disable Two Rcon Passwords (2 Rcon passwords for more security!) //============================================================================== // -> Use Two Rcon Passwords (Only if 'EnableTwoRcon' is enabled(True) !) //============================================================================== #define TwoRconPass "changeme" //Define the Second RCON Password //============================================================================== #define DIALOG_TYPE_RCON2 7004 #define red 0xFF0000AA new AccInfo[MAX_PLAYERS]; enum PlayerData { MaxRcon #if EnableTwoRcon == true #endif }; public OnPlayerConnect(playerid) { #if EnableTwoRcon == true AccInfo[playerid][MaxRcon] = 0; #endif return 1; } public OnPlayerDisconnect(playerid, reason) { #if EnableTwoRcon == true AccInfo[playerid][MaxRcon] = 0; #endif return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { //============================================================================= //--------------- // Dialog - SERVER TWO RCON //--------------- //============================================================================== #if EnableTwoRcon == true if(dialogid == DIALOG_TYPE_RCON2) { if (response) { if (!strcmp(TwoRconPass, inputtext) && !(!strlen(inputtext))) { GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~g~Authorized ~w~Access!~n~~y~Welcome Administrator!",3000,3); } else { if(AccInfo[playerid][MaxRcon] == 3) { SendClientMessage(playerid, red, "|- You has been Automatically Kicked! Reason: Maximum number of 'TwoRcon' attempts has reached -|"); Kick(playerid); } AccInfo[playerid][MaxRcon]++; new tmp[140]; SendClientMessage(playerid, red, "|- Invalid Rcon Password! -|"); format(tmp,sizeof(tmp),"Invalid Password!. \n\nFor access the account, you must enter the CORRECT second password RCON.\n\nAttempts: %d/3", AccInfo[playerid][MaxRcon]); ShowPlayerDialog(playerid, DIALOG_TYPE_RCON2, DIALOG_STYLE_INPUT, "LuxAdmin - RCON!",tmp, "Enter", "Exit"); } } else { SendClientMessage(playerid, red, "|- ERROR: Kicked! -|"); return Kick(playerid); } return 1; } #endif return 1; }