[Tutorial] How to create your RCON system (2-RCON)?
#1


Learn right now about how to create 2-rcon!
- Settings:
  • Create a script, open it; include your includes, then set your 2-rcon password by define it:
    pawn Код:
    #define rconpassword "changemetoyourpassword"
  • There's something what you should do, creating a variable to check if he is logged as 2-rcon:
    pawn Код:
    new Logged[MAX_PLAYERS];
  • After that, you should compile, and you should have only an error: symbol is never used; it will dissapear at final.
- Scripting:
  • Now, we can start scripting; we have to log in specified player as 2-RCON, by a command:
    pawn Код:
    CMD:tworcon(playerid, params[]) // Command made with ZCMD (thanks, Zeex)
    { // open bracket
        if(isnull(params)) return SendClientMessage(playerid, -1, "USAGE: /tworcon [password]"); // if he doesn't write any params, he will receive this message.
        if(strcmp(params, rconpassword) == 0) // check if his params it's 2rcon password.
        { // open
            SendClientMessage(playerid, -1, "{FF0000}You're logged in as 2-RCON"); // sends message to him
        Logged[playerid] = 1; // set variable to 1, so he's logged.
        } // close
        else // if his params isn't 2rcon password.
        { // open
            SendClientMessage(playerid, -1, "{FF0000}WRONG PASSWORD");
        } // close
        return 1; // return
    } // close bracket
  • If you want to create commands for this 2-RCON, then you should check if player it's logged as 2-RCON, like:
    pawn Код:
    stock IsPlayerRCON(playerid) // makin' a stock
    { // open
        if(Logged[playerid] == 1) return true; // if he's logged in 2-rcon, he can use command, function.
        else return false; // else, if he's not 2-rcon will return 0, so won't let him to use specified command
    } // close
  • Now, your 2-rcon it's ready to use, for example, a simple command:
    pawn Код:
    CMD:test(playerid, params[]) // Command
    { // open
        if(IsPlayerRCON(playerid)) // check if he's logged in as 2-rcon
        { // open
            SendClientMessage(playerid, -1, "{FF0000}CONGRATS. YOU'RE LOGGED IN 2-RCON!"); // sends message.
        } // close
        return 1; // return
    } // close
  • You created your 2-rcon, if you want to disable default rcon enter in server.cfg and write:
    pawn Код:
    rcon 0
  • Now, compile; if you did everything like how I explained in this tutorial you shouldn't have any errors.
- Credits:
  • HY - Scripting & creating this tutorial;
  • Zeex - For great & fast command proccesor.
  • SA-MP - Self explanatory, without sa-mp we couldn't create & share our filterscripts, tutorials.
NOTE: Nothing to do about tutorial, but, for lazy people here's download link.
Reply
#2

I don't see any point of making this.
This must have been done in This callback:
https://sampwiki.blast.hk/wiki/OnRconLoginAttempt
Reply
#3

There's already an RCON system, why make another? You can just use OnRconCommand to create additional commands.
And you didn't define "isnull".
Reply
#4

Yeah, there really isn't much point in this at all, as there's already an RCON system.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)