Settings:
Create a script, open it; include your includes, then set your 2-rcon password by define it:
There's something what you should do, creating a variable to check if he is logged as 2-rcon:
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:
If you want to create commands for this 2-RCON, then you should check if player it's logged as 2-RCON, like:
Now, your 2-rcon it's ready to use, for example, a simple command:
You created your 2-rcon, if you want to disable default rcon enter in server.cfg and write:
Now, compile; if you did everything like how I explained in this tutorial you shouldn't have any errors.
Create a script, open it; include your includes, then set your 2-rcon password by define it:
Code:
#define rconpassword "changemetoyourpassword"
Code:
new Logged[MAX_PLAYERS];
- Scripting:
Now, we can start scripting; we have to log in specified player as 2-RCON, by a command:
Code:
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
Code:
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
Code:
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
Code:
rcon 0
Post a Comment