05.07.2012, 08:53
(
Last edited by Dubya; 05/07/2012 at 01:23 PM.
)
Alright, I just now decided to make this, because I found out that, the Luke guy's report system WAS FAKE!
So.. Now to the Tutorial...
Alright. Make sure you have this at the top of your script:
Now. I will include references for zcmd and DubColors at the bottom.
Now we have to start the basic of the command.
Now, we start the Command.
First, we have to add our New's, all we need for this is this:
The command should now look something like this:
Now. We have to check if it is blank or not.
The command now looks like:
The !isnull initiate's that we ARE using it.
Now We start the report. If you want it to show proof that you are reporting, go ahead and add this:
And tab it to perfection. But, also make sure you added the correct {'s.
The command will now look something like this:
Let's Continue!
Now we have to make it send to the Admins. It is set to send to Rcon Admin's. GO ahead and edit it if you have enum's and other sence for In-Game Admins.
So, now we have to add this:
It sets the letter "i" as EVERY player. But... We aren't even closed to finished yet! We must now add another {.
Now, we will add the variable to send to in-game rcon admins.
Now, we have added another {. The command now looks like:
Now I won't show you what it looks like until we have finished it.
Now we format it to send to the Admins.
Now we close 3 brackets ( }'s ).
Now we make it show the usage, we have to add a "else".
Now we add a return, meaning the command will return, and not show up as not a command.
Then, finally, the closing bracket! ( } ).
The command is now complete, and looks like this:
You may have noticed that to show your own name, I had "PlayerName(playerid)", well I made a stock for that. It is this:
And now to those reference's that I promised. Well..
ZCMD: https://sampforum.blast.hk/showthread.php?tid=91354
DubColors: https://sampforum.blast.hk/showthread.php?tid=353068
I hope I helped you. Oh and, with the for(new i=0; i<MAX_PLAYERS; i++), you can replace it with foreach(Player, i), if you use foreach.
Hope I helped you with my Tutorial. This is my first tutorial, but I can script. And let me tell you, this is NOT an Edit. I just recently made this. Don't let anyone tell you other wise.
So.. Now to the Tutorial...
Alright. Make sure you have this at the top of your script:
pawn Code:
#include <a_samp>
#include <zcmd>
#include <DubColors>
Now we have to start the basic of the command.
pawn Code:
/*
There are multiple way's to use zcmd. I like using this way the most.*/
CMD:report(playerid, params[])
{
}
// BUT you can also use this:
COMMAND:report(playerid, params[])
{
}
First, we have to add our New's, all we need for this is this:
pawn Code:
new string[128];
pawn Code:
CMD:report(playerid, params[])
{
new string[128];
}
pawn Code:
if(!isnull(params))
pawn Code:
CMD:report(playerid, params[])
{
new string[128];
if(!isnull(params))
}
Now We start the report. If you want it to show proof that you are reporting, go ahead and add this:
pawn Code:
SendClientMessage(playerid, COLOR_YELLOW, "Your report was sent to the Admin Teams:");
format(string, sizeof(string), "%s", params);
SendClientMessage(playerid, COLOR_YELLOW, string);
The command will now look something like this:
pawn Code:
CMD:report(playerid, params[])
{
new string[128];
if(!isnull(params))
{
SendClientMessage(playerid, COLOR_YELLOW, "Your report was sent to the Admin Teams:");
format(string, sizeof(string), "%s", params);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
Now we have to make it send to the Admins. It is set to send to Rcon Admin's. GO ahead and edit it if you have enum's and other sence for In-Game Admins.
So, now we have to add this:
pawn Code:
for(new i=0; i<MAX_PLAYERS; i++)
Now, we will add the variable to send to in-game rcon admins.
pawn Code:
if(IsPlayerAdmin(playerid))
{
pawn Code:
CMD:report(playerid, params[])
{
new string[128];
if(!isnull(params))
{
SendClientMessage(playerid, COLOR_YELLOW, "Your report was sent to the Admin Teams:");
format(string, sizeof(string), "%s", params);
SendClientMessage(playerid, COLOR_YELLOW, string);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerAdmin(playerid))
{
Now we format it to send to the Admins.
pawn Code:
format(string, sizeof(string), "Report from %s[%d]: %s", PlayerName(playerid), playerid, params);
SendClientMessage(i, COLOR_ORANGE, string);
}
Now we make it show the usage, we have to add a "else".
pawn Code:
else
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Report [Text]");
}
pawn Code:
return 1;
The command is now complete, and looks like this:
pawn Code:
CMD:report(playerid, params[])
{
new string[128];
if(!isnull(params))
{
SendClientMessage(playerid, COLOR_YELLOW, "Your report was sent to the Admin Teams:");
format(string, sizeof(string), "%s", params); // Proof to the reporter, that the command worked.
SendClientMessage(playerid, COLOR_YELLOW, string);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerAdmin(playerid))
{
format(string, sizeof(string), "Report from %s[%d]: %s", PlayerName(playerid), playerid, params);
SendClientMessage(i, COLOR_ORANGE, string); // Send's the format to the online Rcon'ly Logged in Admins.
}
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Report [Text]"); // Show's the player the Usage.
}
return 1;
}
pawn Code:
stock PlayerName(playerid)
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
return Name;
}
ZCMD: https://sampforum.blast.hk/showthread.php?tid=91354
DubColors: https://sampforum.blast.hk/showthread.php?tid=353068
I hope I helped you. Oh and, with the for(new i=0; i<MAX_PLAYERS; i++), you can replace it with foreach(Player, i), if you use foreach.
Hope I helped you with my Tutorial. This is my first tutorial, but I can script. And let me tell you, this is NOT an Edit. I just recently made this. Don't let anyone tell you other wise.