[Tutorial] How to make a kickgun, for admins only
#5

Untested but better than OP

pawn Код:
#include <a_samp>
#include <zcmd>

#define KICK_GUN 38

new bool:HasKickGun[MAX_PLAYERS];

stock TogglePlayerKickGun(playerid, toggle)
{
    switch(toggle)
    {
        case 0:
        {
            new gun, ammo;
            new GunArray[13][2];
            for(new i=0; i<13; i++)
            {
                GetPlayerWeaponData(playerid, i, gun, ammo);
                GunArray[i][0] = gun;
                GunArray[i][1] = ammo;
            }
            ResetPlayerWeapons(playerid);
           
            for(new i=0; i<13; i++)
            {
                if(GunArray[i][0] != KICK_GUN)
                {
                    GivePlayerWeapon(playerid, GunArray[i][0], GunArray[i][0]);
                }
            }
            SendClientMessage(damagedid, 0xFFFFFFFF, ">> KickGun DISABLED");
            HasKickGun[playerid] = false;
        }
       
        case 1:
        {
            GivePlayerWeapon(playerid, KICK_GUN, 35525);
            SendClientMessage(damagedid, 0xFFFFFFFF, ">> KickGun ENABLED");
            HasKickGun[playerid] = true;
        }
    }
}

public OnPlayerConnect(playerid)
{
    HasKickGun[playerid] = false;
    return 1;
}

public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
    if(HasKickGun[playerid] && weaponid == KICK_GUN)
    {
        SendClientMessage(damagedid, 0xFFFFFFFF, ">> You were kicked by the kickgun");
        Kick(damagedid);
    }
    return 1;
}

CMD:KickGun(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        if(HasKickGun[playerid])
        {
            TogglePlayerKickGun(playerid, 0);
        }
        else
        {
            TogglePlayerKickGun(playerid, 1);
        }
    }
    else
    {
        SendClientMessage(damagedid, 0xFFFFFFFF, ">> No KickGun for you!");
    }
    return 1;
}
Reply


Messages In This Thread
How to make a kickgun, for admins only - by UnknownGamer - 22.07.2012, 07:07
Re: How to make a kickgun, for admins only - by Kindred - 22.07.2012, 07:29
Re: How to make a kickgun, for admins only - by newbienoob - 22.07.2012, 07:55
Re: How to make a kickgun, for admins only - by Djole1337 - 22.07.2012, 07:57
Re: How to make a kickgun, for admins only - by Rob_Maate - 22.07.2012, 16:21
Re: How to make a kickgun, for admins only - by Pinguinn - 22.07.2012, 16:52
Re: How to make a kickgun, for admins only - by XVlaDX - 06.05.2013, 17:12

Forum Jump:


Users browsing this thread: 8 Guest(s)