[Tutorial] How to create /tutkick (Tutorial Kick) System.
#1

Hello. I took this idea from a french server i used to play. They have a /tutkick command, that kick the player, and force to read the tutorial. I decided to make something similar, but better. I made one, all using Dialogs.

This command make the player read a tutorial, that teach him some basics about Role-Play. Due to the limit of charathers you can time in dialogs, i made 20 dialogs. I know, much gramatic mistakes. Sorry about it, and tell me if you find any, so i can edit the tutorial.

So, first, we will need to define our includes. I am going to use zcmd and sscanf for the command. That's for the creators.

So.. Defining them on top of the script.

pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
You can find them in the includes board of sa-mp forums.(This one)

I will use some colors in the dialogs, so we will need to define them.
pawn Код:
#define COL_RED            "{F81414}"
#define COL_RWHITE         "{FFFFFF}"
Ok, now, comes the harder part. You will have to convert it to your saving/defining system.
As far as it will check if player has been tutkicked when he connects, you have to add it in saving system.
So, for the enum, we will define the TutKick and Adminlevel, to make it for admins only.
pawn Код:
enum pInfo
{
    TutKick,
    AdminLevel,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Now, the OnFilterScriptInit.
pawn Код:
public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Tutorial Kick System By Ricardo Rodrigues");
    print("--------------------------------------\n");
    return 1;
}
Ok. I am not here to explain how to use zcmd or sscanf, not even how to use dialogs. I will tell you the steps for the tutkick, you should know how to use the functions we are going to work with.

The commannd that will kick the player, set his TutKick to 1, and send message.
pawn Код:
CMD:tutkick(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 1)
    {
        new id;
        new string[64];
        if(!sscanf(params, "u", id))
        {
            SendClientMessage(id, 0xFFFFFFFF, "You have been kicked and forced to read the Role-Play Tutorial. Pay attention to your actions next time.");
            new KickedPlayer[MAX_PLAYER_NAME];
            GetPlayerName(id, KickedPlayer, sizeof(KickedPlayer));
            format(string, sizeof(string), "%s has been kicked and forced to read the Role-Play Tutorial.", KickedPlayer);
            SendClientMessageToAll(0xFFFFFFFF, string);
            PlayerInfo[id][TutKick] = 1;
            Kick(id);
            return 1;
        }
        else return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /tutkick [PlayerId]");
    }
    else return SendClientMessage(playerid, 0xFFFFFFFF, "You are not allowed to use this command.");
}
Ok, we are done with the command, the defines, and includes. Now, we will make it force the player to read the tutorial.
pawn Код:
public OnPlayerConnect(playerid)
{
    if(PlayerInfo[playerid][TutKick] == 1)
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "You are being forced to read the tutorial, due to admin orders. You can only play, after reading it. If you repeat any acts, mentioneds in it, you will get yourself banned.");
        ShowPlayerDialog(playerid, 150, DIALOG_STYLE_MSGBOX, "{F81414}Tutorial", "{FFFFFF}This tutorial will teach you how to role-play proply on this server.", "Next", "");
        return 1;
    }
    return 0;
}
As you can see, on the command, we set TutKick to 1, now, when player connect, if it is 1, the tutorial will display.
Ok.. Now we will do the dialogs. I will not explain it, you should know how to make dialogs.
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 150:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 151, DIALOG_STYLE_MSGBOX, "{F81414}Meta-Game Part 1", "{F81414}Meta-Game {FFFFFF}is the expression, used to define the act of mixe. If you mixe OOC informations, in IC propose, you are {F81414}Meta-Gaming.", "Next", "");
                return 1;
            }
        }
        case 151:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 152, DIALOG_STYLE_MSGBOX, "{F81414}Meta-Game Part 2", "{FFFFFF}An example of {F81414}Meta-Gaming, {FFFFFF}is calling someone by the name you see under his head, in the first meet. The name you see up to players head, is an OOC information. ", "Next", "");
                return 1;
            }
        }
        case 152:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 153, DIALOG_STYLE_MSGBOX, "{F81414}Meta-Game Part 3", "{FFFFFF}Using /pm system to tell someone, to help you, or to meet you somewhere, is also {F81414}Meta-Gaming, {FFFFFF}as you are using an OOC function, the /Pm, to IC proposes.", "Next", "");
                return 1;
            }
        }
        case 153:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 154, DIALOG_STYLE_MSGBOX, "{F81414}Power-Game Part 1", "{F81414}Power-Game {FFFFFF}is forcing someone to Role-Play your way, or doing something you can't do in Real Life. Some Examples will be given.", "Next", "");
                return 1;
            }
        }
        case 154:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 155, DIALOG_STYLE_MSGBOX, "{F81414}Power-Game Part 2", "{FFFFFF}If you do any action, that mess with someone, such as puching him, robbing, car-jacking, without giving him a chance to defend, is {F81414}Power-Game.", "Next", "");
                return 1;
            }
        }
        case 155:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 156, DIALOG_STYLE_MSGBOX, "{F81414}Power-Game Part 3", "{FFFFFF}To give him a chance, you should use the command /do. We will explain you how to use it later. Having a car crash, and keep driving, is alsp {F81414}Power-Game.", "Next", "");
                return 1;
            }
        }
        case 156:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 157, DIALOG_STYLE_MSGBOX, "{F81414}Death-Match Part 1", "{F81414}Death-Match {FFFFFF}is probably the most easier to explain. It's no more than shooting someone without a good IC reason.", "Next", "");
                return 1;
            }
        }
        case 157:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 158, DIALOG_STYLE_MSGBOX, "{F81414}In-Charather(IC)", "{F81414}In Charather{FFFFFF}, also known as {F81414}IC, {FFFFFF}is the word used to clasify your in game charather.", "Next", "");
                return 1;
            }
        }
        case 158:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 159, DIALOG_STYLE_MSGBOX, "{F81414}Out-Of-Charather(OOC)", "{F81414}Out-Of-Charather{FFFFFF}, also known as {F81414}IC{FFFFFF}, is the word used to clasify yourself as a Real Life person.", "Next", "");
                return 1;
            }
        }
        case 159:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 160, DIALOG_STYLE_MSGBOX, "{F81414}The /me and /do Commands. Part 1", "{F81414}/me {FFFFFF}and {F81414}/do {FFFFFF}are basic and hight needed commands in Role-Play. We will show you some examples.", "Next", "");
                return 1;
            }
        }
        case 160:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 161, DIALOG_STYLE_MSGBOX, "{F81414}The /me and /do Commands. Part 2", "{FFFFFF}To simply car-jack someone, you need good RolePlay Skills. You have to attemp oppening the door, like that: /me attemps to open car door.", "Next", "");
                return 1;
            }
        }
        case 161:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 162, DIALOG_STYLE_MSGBOX, "{F81414}The /me and /do Commands. Part 3", "{FFFFFF}After that, you have to use the /do command, to give him a chance to answer. Door might be locked or he can escape before you open it.", "Next", "");
                return 1;
            }
        }
        case 162:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 163, DIALOG_STYLE_MSGBOX, "{F81414}The /me and /do Commands. Part 4", "{FFFFFF}/do Sucefull/Fail. You can also use /do S/F/. Now, you have to wait player answer. He can answer many different things.", "Next", "");
                return 1;
            }
        }
        case 163:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 164, DIALOG_STYLE_MSGBOX, "{F81414}The /me and /do Commands. Part 5", "{FFFFFF}He can say /do S. that means the door is now open. He can also /do F, Door Locked. so door is locked and you can't open.", "Next", "");
                return 1;
            }
        }
        case 164:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 165, DIALOG_STYLE_MSGBOX, "{F81414}The /me and /do Commands. Part 6", "{FFFFFF}Of-course, now you can /me attemps to pull over DriverName. but you also need /do S/F. That if his answer is /do S.", "Next", "");
                return 1;
            }
        }
        case 165:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 166, DIALOG_STYLE_MSGBOX, "{F81414}The /me and /do Commands. Part 7", "{FFFFFF}If the answer is /do F, door locked. than you can give up, or /me brake the windows with left arm. /me attemps to open the door lock. /do S/F.", "Next", "");
                return 1;
            }
        }
        case 166:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 167, DIALOG_STYLE_MSGBOX, "{F81414}The /me and /do Commands. Part 8", "{FFFFFF}Well, the winndows braking doesn't depend on other player, so you don't need to attemp it. But, on removing lock, he can block your hand. So, he will probably /do F, i block you.", "Next", "");
                return 1;
            }
        }
        case 167:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 168, DIALOG_STYLE_MSGBOX, "{F81414}The /me and /do Commands. Part 9", "{FFFFFF}Well, being hard right? You really have to go in the bad way. /me attemps to punsh Driver in nose, and unlock the car. /do S/.", "Next", "");
                return 1;
            }
        }
        case 168:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 169, DIALOG_STYLE_MSGBOX, "{F81414}The /me and /do Commands. Part 9", "{FFFFFF}Good, let's make it easy now... The driver should /do S. so now, you can take him over the car, and rob it.", "Next", "");
                return 1;
            }
        }
        case 169:
        {
            if(response)
            {
                ShowPlayerDialog(playerid, 170, DIALOG_STYLE_MSGBOX, "{F81414}End of Tutorial", "{FFFFFF}You just ended the tutorial. Hope you've learn. If you will not have all the work of use all these commands on RP, Log out.", "Next", "");
                return 1;
            }
        }
        case 170:
        {
            if(response)
            {
                PlayerInfo[playerid][TutKick] = 0;
                SendClientMessage(playerid, 0xFFFFFFFF, "Pay attention to your Role-Play, or you will be forced to read it again.");
                return 1;
            }
        }
    }
    return 0;
}
And we are done with it. As you can see, in the last dialog, it will set TutKick back to 0, so player will not read it again when re-connecting.

Hope this is usefull. Copy pasting it will work, but only if you convert it to your saving/defining system.
I was going to release it as filterscript, but it can't work as one, because it have to save in playerfiles.
It couldn't be compatible with all scripts, so i made it a tutorial.

Any suggestions are welcome.
Reply


Messages In This Thread
How to create /tutkick (Tutorial Kick) System. - by ricardo178 - 06.02.2012, 22:05
Re: How to create /tutkick (Tutorial Kick) System. - by cs_waller - 06.02.2012, 22:06
Re: How to create /tutkick (Tutorial Kick) System. - by String - 28.05.2012, 13:03
Re: How to create /tutkick (Tutorial Kick) System. - by iFederal - 31.05.2012, 04:39
Re: How to create /tutkick (Tutorial Kick) System. - by Kukkurloom - 19.08.2012, 14:51
Re: How to create /tutkick (Tutorial Kick) System. - by antonio112 - 19.08.2012, 16:01

Forum Jump:


Users browsing this thread: 2 Guest(s)