31.07.2013, 13:31
Hello guys 
This is my first tutorial! So...Today I will teach you guys, how to make a simple Rcon commands. If you don't know how to login in Rcon, let me tell you
Just type ingame /rcon login [password] (Your password is in server.cfg => rcon_password).
Let's start!
First of all, we will include some includes:
Here are the links for sscanf2 and zcmd if you don't already have it.
Now we will define some colors!
We will also use this stock, to get player's name faster!
Now we will make some commands! 
NOTE: I will make a command first and then I will explain each line!
Let's start with /kick [palyerid] [reason]
Let me explain 
This tells the system to create a new variables "targetid => player which we want to kick", "reason => to write a reason with MAX. 50 characters" and "string => we will use this to send a message to all players that we kicked someone".
This will check, if the player is logged in rcon, if he isn't, it will send him a message "[ERROR]: You aren't an Rcon Admin!"
This will check, if the player we want to kick is connected, if he isn't, it will send this message to a player "[ERROR]: This player is not Connected!"
This will check, if the player write /kick [playerid] [reason], if he doesn't, he will get this message "[USAGE]: /kick [Playerid] [Reason]"
This will create a string, that an administrator has kicked a player..
This will send a message to all online players that an administrator has kicked a player..
This will kick a player.
This was a /kick command
Now, let's make an /explode [playerid] command!
Let me explain 
This tells the system to create a new variables "targetid => player which we want to explode", "Float
, Float:y, Float:z => we will use this to get the player's position" and "string => we will use this to send a message to all players that we exploded someone".
This will check, if the player is logged in rcon, if he isn't, it will send him a message "[ERROR]: You aren't an Rcon Admin!"
This will check, if the player write /explode [playerid], if he doesn't, he will get this message "[USAGE]: /explode [Playerid]"
This will check, if the player we want to kick is connected, if he isn't, it will send this message to a player "[ERROR]: This player is not Connected!"
This will get the player's position.
This will create an explosion on the player's position.
This will create a string, that an administrator has exploded a player..
This will send a message to all online players that an administrator has exploded a player..
This was an /explode command
Now, let's make the last command for this tutorial
/announce [text]
Let me explain again 
This tells the system to create a new variable "text => this will be the text, we want to write
This will check, if the player is logged in rcon, if he isn't, it will send him a message "[ERROR]: You aren't an Rcon Admin!"
This will check, if the player write /announce [text], if he doesn't, he will get this message "[USAGE]: /announce [Text]"
This will create a game text for all online players with the text, you typed in 
That is all for today
I hope you guys like this tutorial
Sorry for my bad english!

This is my first tutorial! So...Today I will teach you guys, how to make a simple Rcon commands. If you don't know how to login in Rcon, let me tell you

Let's start!

First of all, we will include some includes:
pawn Code:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
Now we will define some colors!

pawn Code:
#define COLOR_RED 0xFF0000C8
#define COLOR_WHITE 0xFFFFFFC8
#define COLOR_YELLOW 0xDFF709C8
#define COLOR_GREEN 0x09F709C8
#define COLOR_BLUE 0x0000FFC8
pawn Code:
stock GetName(playerid)
{
new
name[24];
GetPlayerName(playerid, name, sizeof(name));
return name;
}

NOTE: I will make a command first and then I will explain each line!
Let's start with /kick [palyerid] [reason]
pawn Code:
CMD:kick(playerid, params[]);
{
new targetid;
new reason[50];
new string[200];
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You aren't an Rcon Admin!");
if(!IsPlayerConnected(targetid))return SendClientMessage(playerid, COLOR_RED, "[ERROR]: This player is not Connected!");
if(sscanf(params, "us[50]", targetid, reason))return SendClientMessage(playerid, COLOR_WHITE, "[USAGE]: /kick [Playerid] [Reason]");
format(string, sizeof(string), "[ADMIN]: Administrator %s(ID:%d) has kicked %s(ID:%d)! [Reason: %s]", GetName(playerid), playerid, GetName(targetid), targetid, reason);
SendClientMessageToAll(COLOR_YELLOW, string);
Kick(targetid);
return 1;
}

pawn Code:
new targetid;
new reason[50];
new string[200];
pawn Code:
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You aren't an Rcon Admin!");
pawn Code:
if(!IsPlayerConnected(targetid))return SendClientMessage(playerid, COLOR_RED, "[ERROR]: This player is not Connected!");
pawn Code:
if(sscanf(params, "us[50]", targetid, reason))return SendClientMessage(playerid, COLOR_WHITE, "[USAGE]: /kick [Playerid] [Reason]");
pawn Code:
format(string, sizeof(string), "[ADMIN]: Administrator %s(ID:%d) has kicked %s(ID:%d)! [Reason: %s]", GetName(playerid), playerid, GetName(targetid), targetid, reason);
pawn Code:
SendClientMessageToAll(COLOR_YELLOW, string);
pawn Code:
Kick(targetid);
This was a /kick command

Now, let's make an /explode [playerid] command!

pawn Code:
CMD:explode(playerid, params[])
{
new string[200], targetid, Float:x, Float:y, Float:z;
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You aren't an Rcon Admin!");
if(sscanf(params, "u", targetid))return SendClientMessage(playerid, COLOR_WHITE, "[USAGE]: /explode [Playerid]");
if(!IsPlayerConnected(targetid))return SendClientMessage(playerid, COLOR_RED, "[ERROR]: This player is not connected!");
GetPlayerPos(targetid, x, y, z);
CreateExplosion(x, y, z, 12, 10.0);
format(string,sizeof(string), "[ADMIN]: Administrator %s(ID:%d) has Exploded %s(ID:%d)!", GetName(playerid), playerid GetName(targetid), targetid);
SendClientMessage(playerid, COLOR_PURPLE, string);
return 1;
}

pawn Code:
new string[200], targetid, Float:x, Float:y, Float:z;

pawn Code:
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You aren't an Rcon Admin!");
pawn Code:
if(sscanf(params, "u", targetid))return SendClientMessage(playerid, COLOR_WHITE, "[USAGE]: /explode [Playerid]");
pawn Code:
if(!IsPlayerConnected(targetid))return SendClientMessage(playerid, COLOR_RED, "[ERROR]: This player is not connected!");
pawn Code:
GetPlayerPos(targetid, x, y, z);
pawn Code:
CreateExplosion(x, y, z, 12, 10.0);
pawn Code:
format(string,sizeof(string), "[ADMIN]: Administrator %s(ID:%d) has Exploded %s(ID:%d)!", GetName(playerid), playerid GetName(targetid), targetid);
pawn Code:
SendClientMessageToAll(playerid, COLOR_YELLOW, string);
This was an /explode command

Now, let's make the last command for this tutorial

pawn Code:
CMD:announce(playerid, params[])
{
new text[60];
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You aren't an Rcon Admin!");
if(sscanf(params,"s[60]",text))return SendClientMessage(playerid, COLOR_GREY, "[USAGE]: /announce [Text]");
GameTextForAll(text, 3000, 5);
return 1;
}

pawn Code:
new text[60];
pawn Code:
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You aren't an Rcon Admin!");
pawn Code:
if(sscanf(params,"s[60]",text))return SendClientMessage(playerid, COLOR_GREY, "[USAGE]: /announce [Text]");
pawn Code:
GameTextForAll(text, 3000, 5);

That is all for today

Sorry for my bad english!