06.04.2014, 11:42
(
Last edited by Abagail; 06/04/2014 at 11:43 AM.
Reason: Edited PAWN tags for readability.
)
RCON - What you can do with it(Part One)
Hello there. This tutorial will show you how you can use RCON, and some things you can do with it. The requirements for this tutorial are: Basic PAWN Scripting Knowledge, PAWNO package/compiler, And of-course a_samp!The first thing I'll be showing you is how you can check if a player is logged into RCON or not. So to check this we'll use,
pawn Code:
native IsPlayerAdmin(playerid);
pawn Code:
if(!IsPlayerAdmin(playerid)) // Code...
pawn Code:
if(IsPlayerAdmin(playerid)) // Code....
pawn Code:
native Kick(playerid);
native Ban(playerid);
native BanEx(playerid, const reason[]);
Ban bans a given player. The ban is recorded in the samp.ban file in your main server directory. To unban them you'd need to either do it manually or via rcon with [/rcon unban (ip)].
BanEx bans a given player, and records the reason given to the ban file. How-ever, no message is sent with the reason they were banned to the banned player.
NOTE: Ban and BanEx do not record the player's name! They only record their IP!
Moving on to Sending a RCON command via the script.
pawn Code:
native SendRconCommand(command[]);
SendRconCommand("password changeme1");
If you want to send a command the user picks you could do this:
pawn Code:
new string[128];
format(string, sizeof(string), "%s", usercmd);
SendRconCommand(string);
That's all for now. I'll be making a guide on the rest of the RCON functions/natives later on. This will be considered as "Part I" or "Part One". I hope I made everything clear, so you can learn from it. If I made any mistakes, or your confused about something just PM me or reply stating the issue/confusion. Thanks for reading,
- Abagail