[Tutorial] RCON[What you can do with it] - Part I
#1

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);
So the returns are basically 0 and 1. Like usual in PAWN, 0 returns in a sense "no". This means they are not logged into RCON. So to check if they are NOT logged into RCON I can do it like this:

pawn Code:
if(!IsPlayerAdmin(playerid)) // Code...
Then, if I want to check if they ARE logged into RCON then I'd just do:

pawn Code:
if(IsPlayerAdmin(playerid)) // Code....
The next thing I'll be sharing is the Kick, and Ban functions.(BanEx too!)

pawn Code:
native Kick(playerid);
native Ban(playerid);
native BanEx(playerid, const reason[]);
Kick kicks a given player. No reason is specified by default. How-ever, if you want to send a message to them you'd need to use a timer so they aren't kicked before the message is actually sent.

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[]);
You do NOT need to put [/rcon] or anything in "command". An example of using this would be:

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);
NOTE: The command "login" will not work due to SendRconCommand not having any playerid param.

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
Reply
#2

You don't need a timer, you just need to send the message before you kick him. Otherwise it's a good start and I'm sure that beginners will find this useful.
Reply
#3

Quote:
Originally Posted by AlonzoTorres
View Post
You don't need a timer, you just need to send the message before you kick him.
https://sampwiki.blast.hk/wiki/Kick

Quote:
Important Note: As of SA-MP 0.3x, any action taken directly before Kick() (such as sending a message with SendClientMessage) will not reach the player. A timer must be used to delay the kick.

Reply
#4

Quote:
Originally Posted by Konstantinos
View Post
Oh, I was sure that it was the other way around. Must have learnt that in 0.3e and then did not notice it in the update.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)