Helpme system - for beginners
What is this?
This is a simple & short tutorial which shows you how to create a helpme system.
What is helpme?
This is a command used in a lot of servers, basically you can make a question which will go to the admins and they
can help you with that.
What do you need to download to make this command?
You need to download a few includes which you can find it down there
ZCMD: http://www.solidfiles.com/d/d20f/
foreach: https://github.com/karimcambridge/SAMP-foreach
sscanf: https://github.com/maddinat0r/sscanf/releases
Okay let's start.
Step I:
You need to add a few includes at the top of your script
Code:
#include <a_samp>
#include <zcmd>
#include <foreach>
#include <sscanf>
Code:
enum pInfo
{
pAdmin
}
new PlayerInfo[MAX_PLAYERS][pInfo];
You need to define a few colors.
Code:
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_GREY 0xAFAFAFAA
Now you need to create the command.
Code:
CMD:helpme(playerid, params[])
{
return 1;
}
Code:
CMD:helpme(playerid, params[])
{
new text[60], new string[128], new string2[128];
}
If you went this far, we will continue to Step IV
Step IV
Now we need to create a syntax message.
Code:
CMD:helpme(playerid, params[])
{
new text[60], string[128], string2[128];
if(sscanf(params,"s[60]",text)) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /helpme [text]");
return 1;
}
Let's continue to the Step V
Step V
We need to send the text to the admins now, we need to create "SendAdminMessage"
Code:
forward SendAdminMessage(color, string[]);
public SendAdminMessage(color, string[])
{
foreach(Player, i)
{
if(PlayerInfo[i][pAdmin] >= 1) // The string will go to the player only if he's a level 1 or higher admin.
{
SendClientMessage(i, color, string);
}
}
}
Step VI
After you have created the "SendAdminMessage", you need to send the text that the player typed to the admins now.
Code:
CMD:helpme(playerid, params[])
{
new text[60], string[128], string2[128];
if(sscanf(params,"s[60]",text)) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /helpme [text]");
format(string, sizeof(string), "{ffa600}HELPME: {AFAFAF}%s has asked the question (%s)", GetName(playerid), text); //This is the message that the admins will see
SendAdminMessage(COLOR_ORANGE, string);
return 1;
}
Code:
stock GetName( playerid )
{
new szName[24];
GetPlayerName( playerid, szName, 24); // This will get the player's name and will send it to the admins
return szName;
}
Now the text is sent to the administrators, but we need to send the message to the player too.
Code:
CMD:helpme(playerid, params[])
{
new text[60], string[128], string2[128];
if(sscanf(params,"s[60]",text)) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /helpme [text]");
format(string, sizeof(string), "{ffa600}HELPME: {AFAFAF}%s has asked the question (%s)", GetPlayerNameEx(playerid), text);
SendAdminMessage(COLOR_ORANGE, string);
format(string2, sizeof(string), "Your question, {8b0000}%s {AFAFAF}has been sent to the administrators, please wait for a response", text); //This is what the text will display to the player
SendClientMessage(playerid, COLOR_GREY, string2); //This will send the text to the player
return 1;
}
Pastebin (full script): https://pastebin.com/b7TFbch6
If you find any mistakes don't hesistate to tell me!