[Tutorial] KickGun Creation Tutorial.
#1

This tutorial mainly aims at roleplay game modes as that's that I initially created it for, my game mode. Please understand that I don't doubt anyone's intelligence through out the course of this tutorial but I simply want to make it easy and understandable for any individuals that are considering using it.

Firstly you will need to have zcmd as one of your includes. This tutorial will work in 5 parts to better help the purpose of the tutorial.

Part 1
To begin with, press CTRL+F and search for "new " minus the speech marks, after either the first search you come across or the last, add
Код:
new KG[MAX_PLAYERS];
new ReplaceKG[MAX_PLAYERS];
But make sure its somewhere near the top.

Part 2
Now to follow on, search for your Public Variables, now if you dont have those tagged in your game mode simply follow this: CTRL+F search "Cuffed[playerid] = 0;" This considering the fact that your game mode is a roleplay based and contains the cuff function. From there forth add,
Код:
KG[playerid] = 0; ReplaceKG[playerid] = 0;

Part 3
Now after adding that, use CTRL+F once more and this time search for "stock" after you find the first one or even the second, beneath it add:
Код:
stock KickGun(playerid)
{
	if(!KG[playerid]) return 0;
	if(KG[playerid]) return 1;
	return 1;
}

Part 4
Now rather simply you can search for anyone of your CMDs and add beneath it,
Код:
CMD:kickgun(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "Your not an Admin.");
    if(!KG[playerid])
    {
        KG[playerid] = 1;
        if(PlayerInfo[playerid][pWeapon][2] == 24)
        {
            ReplaceKG[playerid] = 1;
            GetPlayerWeaponData(playerid, 2, OldGun[playerid], OldAmmo[playerid]);
        }
        GunsBeingRemoved[playerid] = 1;
        RemovePlayerWeapon(playerid, 24);
        GunsBeingRemoved[playerid] = 1;
        GivePlayerWeapon(playerid, 24, 500);
        GunsBeingRemoved[playerid] = 1;
    }
    else
    {
        KG[playerid] = 0;
        RemovePlayerWeapon(playerid, 24);
        if(ReplaceKG[playerid])
        {

            ReplaceKG[playerid] = 0;
            GunsBeingRemoved[playerid] = 1;
            GiverPlayerWeapon(playerid, OldGun[playerid], OldAmmo[playerid]);
            GunsBeingRemoved[playerid] = 1;
            OldGun[playerid] = 0;
            OldAmmo[playerid] = 0;
        }
    }
    return 1;
}
}

Part 5
Finally, use CTRL+F once more and this time search for "public OnPlayerShootPlayer(Shooter,Target,Float:HealthLos t,Float:ArmourLost)". However, if you cant find that specific part search for simply "public OnPlayerShootPlayer" which would take you straight to it if it's in your script. Then, where ever you want, as long as its not inside another function, add the following:
Код:
if(PlayerInfo[playerid][pAdmin] < 1)
	{
	    if(KG[Shooter])
	    {
	        if(GetPlayerWeapon(Shooter) == 24)
	        {
	            if(!KickGun(Target))
	            {
		            if(!IsPlayerNearPlayer(Shooter, Target, 35)) return SendClientMessage(Shooter, COLOR_GREY, "You are too far away from that player.");
				    GameTextForPlayer(Target, "~r~KICKED", 3500, 3);
                 new string[128];
		format(string, sizeof(string), "%s Has been kicked by the VAT Kick Gun !", GetPlayerNameEx(Target));
					Kick(Target);
				}

		    }
	    }
	}
Now, for the final part, make sure that everything matches up. This was made specifically for my game mode thus it may not match yours, so to begin with, confirm that both "Target" and "Shooter" equal what ever comes first and second after you search "public OnPlayerShootPlayer".

Last but not least, you may have some issues with the initial set up of the kick gun, if that is the case, don't hesitate to add me on skype(xk_surez) and I will be happy to help you incorporate it into your own game mode.

Hope you enjoy and use this, but please don't change the kick message.
Reply
#2

This will not work, and I'll give you a few hints as to why:

"PlayerInfo"
"GunsBeingRemoved"
Reply
#3

Quote:
Originally Posted by shitbird
Посмотреть сообщение
This will not work, and I'll give you a few hints as to why:

"PlayerInfo"
"GunsBeingRemoved"
I tested it after I posted this and it seemed to work alright but like I said it was created to fit my game mode, however ill change parts either today or tomorrow for it to work on the majority of game modes.
Reply
#4

Appreciated since its your first tutorial but frankly it wouldn't help anyone because your explanation is not good and you never gave a introduction properly. Moreover your code is not working.

EDIT
Quote:
Originally Posted by XVlaDX
Посмотреть сообщение
I tested it after I posted this and it seemed to work alright but like I said it was created to fit my game mode, however ill change parts either today or tomorrow for it to work on the majority of game modes.
It worked because your script has defined the PlayerInfo and other variables but you missed out here in the tutorial and hence the code in the tutorial will not work.
Reply
#5

Quote:
Originally Posted by Yashas
Посмотреть сообщение
Appreciated since its your first tutorial but frankly it wouldn't help anyone because your explanation is not good and you never gave a introduction properly. Moreover your code is not working.

EDIT

It worked because your script has defined the PlayerInfo and other variables but you missed out here in the tutorial and hence the code in the tutorial will not work.
I now understand what I've done wrong, thanks for the feed back. I will aim to improve the tutorial later today.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)