22.07.2017, 22:38
(
Last edited by AmarPlayer; 23/07/2017 at 05:42 PM.
)
Welcome to my first tutorial!
In this tutorial, I am going to show you how to make the "/adminduty" command,
it is very easy, hope you will enjoy.
For this you are gonna need to define some colors, and you are gonna need the sscanf and Y_INI plugins. You can easily find that here on the forum.
It's going to look something like this:
https://prnt.sc/fyzflr
So let's begin.
For this you are going to need this Login/Register system, which includes an admin system that we are gonna use: https://sampforum.blast.hk/showthread.php?tid=273088
Now when you have that, let's begin.
First at the top of our script we add:
When that's done, we are going to start making the actual command.
We go to the bottom of the script, or wherever are your commands are, and type:
If he's not, it's going to send him the message saying that he doesn't have the right to use that command.
Now this part is all about formatting, I won't explain that to you, you have plenty of tutorials about that, I'm just going to add the code:
So basically this checks is player already on admin duty, if not, it's gonna send a message to everyone on the server saying that he is now on duty.
And it's also gonna set his skin to 294 and set his name color to green.
If you know at least a little bit about formatting you can edit this.
Let's move on.
Now, this is just reversed, if the player is on duty, it's gonna kill him, set his name color to white, set his skin to default, and tell everyone that he is no longer on duty.
In this tutorial, I am going to show you how to make the "/adminduty" command,
it is very easy, hope you will enjoy.
For this you are gonna need to define some colors, and you are gonna need the sscanf and Y_INI plugins. You can easily find that here on the forum.
It's going to look something like this:
https://prnt.sc/fyzflr
So let's begin.
For this you are going to need this Login/Register system, which includes an admin system that we are gonna use: https://sampforum.blast.hk/showthread.php?tid=273088
Now when you have that, let's begin.
First at the top of our script we add:
Code:
new AdminDuty[MAX_PLAYERS];
We go to the bottom of the script, or wherever are your commands are, and type:
Code:
YCMD:adminduty(playerid, params[], help) { if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid, RED, "You don't have the right to use this command.");
NOTE:You don't have to type YCMD:adminduty, you can type whatever you want the command to be,
like YCMD:aduty or whatever
That is going to check is the player that's typing the command an admin.like YCMD:aduty or whatever
If he's not, it's going to send him the message saying that he doesn't have the right to use that command.
Now this part is all about formatting, I won't explain that to you, you have plenty of tutorials about that, I'm just going to add the code:
Code:
new string[256], name1[MAX_PLAYER_NAME]; GetPlayerName(playerid, name1, sizeof(name1)); if(AdminDuty[playerid] == 0) { format(string, sizeof(string), "Admin {FF0000}%s {FFFFFF} is on the duty, for help type /help", name1); SCMTA(-1, string); AdminDuty[playerid] = 1; SetPlayerArmour(playerid, 100); SetPlayerColor(playerid, GREEN); SetPlayerSkin(playerid, 294); }
And it's also gonna set his skin to 294 and set his name color to green.
If you know at least a little bit about formatting you can edit this.
Let's move on.
Code:
else if(AdminDuty[playerid] == 1) { SetPlayerHealth(playerid, 0); SetPlayerColor(playerid, -1); SetPlayerSkin(playerid, 1); format(string, sizeof(string), "Admin {FF0000}%s {FFFFFF}is no longer on duty.", name1); SCMTA(-1, string); AdminDuty[playerid] = 0; } return 1; }
That was my first tutorial, it might be a bit confusing, but it's actually not.
If you have any problems, just send me a message! If I helped you +rep me. Thank you!
If you have any problems, just send me a message! If I helped you +rep me. Thank you!