[Tutorial] Anti No-Reload
#8

Quote:
Originally Posted by Airman123
Посмотреть сообщение
gimme the full code, without any explanation. So, i can put that in my GM

I dont understand what you're saying.

Nice one tho :P
Here is what I've scirpted for my gamemode

pawn Код:
enum _weapon_data {
    wId,
    wSlot,
    wModel,
    Float:wDamage,
    bool:wShootable,
    wName[32],
    wClipSize,
    wRPM[3]
};

// weapons data
new wInfo[47][_weapon_data] = {
    {0, 0, 0, 0.0},
    {WEAPON_BRASSKNUCKLE, 0, 331, 1.0, false, "", 0, {0, 0, 0}},
    {WEAPON_GOLFCLUB, 1, 333, 1.2, false, "", 0, {0, 0, 0}},
    {WEAPON_NITESTICK, 1, 334, 1.2, false, "", 0, {0, 0, 0}},
    {WEAPON_KNIFE, 1, 335, 1.5, false, "", 0, {0, 0, 0}},
    {WEAPON_BAT, 1, 336, 1.2, false, "", 0, {0, 0, 0}},
    {WEAPON_SHOVEL, 1, 337, 1.2, false, "", 0, {0, 0, 0}},
    {WEAPON_POOLSTICK, 1, 338, 0.9, false, "", 0, {0, 0, 0}},
    {WEAPON_KATANA, 1, 339, 3.0, false, "", 0, {0, 0, 0}},
    {WEAPON_CHAINSAW, 1, 341, 5.0, false, "", 0, {0, 0, 0}},
    {WEAPON_DILDO, 10, 321, 0.1, false, "", 0, {0, 0, 0}},
    {WEAPON_DILDO2, 10, 322, 0.1, false, "", 0, {0, 0, 0}},
    {WEAPON_VIBRATOR, 10, 323, 0.1, false, "", 0, {0, 0, 0}},
    {WEAPON_VIBRATOR2, 10, 324, 0.1, false, "", 0, {0, 0, 0}},
    {WEAPON_FLOWER, 10, 325, 0.0, false, "", 0, {0, 0, 0}},
    {WEAPON_CANE, 10, 326, 0.1, false, "", 0, {0, 0, 0}},
    {WEAPON_GRENADE, 8, 342, 100.0, false, "", 0, {0, 0, 0}},
    {WEAPON_TEARGAS, 8, 343, 10.0, false, "", 0, {0, 0, 0}},
    {WEAPON_MOLTOV, 8, 344, 50.0, false, "", 0, {0, 0, 0}},
    {0, 0, 0, 0.0, false, "", 0, {0, 0, 0}},
    {0, 0, 0, 0.0, false, "", 0, {0, 0, 0}},
    {0, 0, 0, 0.0, false, "", 0, {0, 0, 0}},
    {WEAPON_COLT45, 2, 346, 10.0, true, "", 12, {165, 200, 300}},
    {WEAPON_SILENCED, 2, 347, 10.0, true, "", 17, {130, 150, 165}},
    {WEAPON_DEAGLE, 2, 348, 25.0, true, "", 7, {65, 75, 85}},
    {WEAPON_SHOTGUN, 3, 349, 50.0, true, "", 1, {55, 55, 55}},
    {WEAPON_SAWEDOFF, 3, 350, 50.0, true, "", 2, {200, 200, 400}},
    {WEAPON_SHOTGSPA, 3, 351, 50.0, true, "", 7, {150, 180, 180}},
    {WEAPON_UZI, 4, 352, 10.0, true, "", 50, {450, 450, 900}},
    {WEAPON_MP5, 4, 353, 10.0, true, "", 30, {650, 650, 650}},
    {WEAPON_AK47, 5, 355, 15.0, true, "", 30, {450, 450, 450}},
    {WEAPON_M4, 5, 356, 15.0, true, "", 50, {450, 450, 450}},
    {WEAPON_TEC9, 4, 372, 8.0, true, "", 50, {450, 450, 900}},
    {WEAPON_RIFLE, 6, 357, 5.0, true, "", 1, {55, 55, 55}},
    {WEAPON_SNIPER, 6, 358, 50.0, true, "", 1, {55, 55, 55}},
    {WEAPON_ROCKETLAUNCHER, 7, 359, 100.0, true, "", 1, {55, 55, 55}},
    {WEAPON_HEATSEEKER, 7, 360, 100.0, true, "", 1, {55, 55, 55}},
    {WEAPON_FLAMETHROWER, 7, 361, 50.0, true, "", 0, {180, 180, 180}},
    {WEAPON_MINIGUN, 7, 362, 10.0, true, "", 0, {1800, 1800, 1800}},
    {WEAPON_SATCHEL, 8. 363, 50.0, false, "", 0, {0, 0, 0}},
    {WEAPON_BOMB, 12, 364, 0.0, false, "", 0, {0, 0, 0}},
    {WEAPON_SPRAYCAN, 9, 365, 0.1, false, "", 0, {0, 0, 0}},
    {WEAPON_FIREEXTINGUISHER, 9, 366, 0.1, false, "", 0, {0, 0, 0}},
    {WEAPON_CAMERA, 9, 367, 0.0, false, "", 0, {0, 0, 0}},
    {0, 0, 0, 0.0, false, "", 0, {0, 0, 0}},
    {0, 0, 0, 0.0, false, "", 0, {0, 0, 0}},
    {WEAPON_PARACHUTE, 11, 371, 0.0, false, "", 0, {0, 0, 0}}
};

enum _player_skills {
    ORM:sOrmId,
    sId,
    sPlayerId,
    sColt,
    sSilenced,
    sDeagle,
    sShotgun,
    sSawnoff,
    sCombat,
    sUzi,
    sSMG,
    sAK47,
    sM4,
    sTec9,
    sRifle,
    sSniper
};

// skill definitions
new sInfo[MAX_PLAYERS][_player_skills];

enum _last_shot_info {
    lWeaponId,
    lCount,
    lTime
};

// last shot data
new pLastShot[MAX_PLAYERS][_last_shot_info];

public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    new rpm, time, skilLLevel = GetPlayerSkillLevel(playerid, weaponid);


    if (pLastShot[playerid][lWeaponId] != weaponid) {

        if (pLastShot[playerid][lTime]) {
            KillTimer(pLastShot[playerid][lTime]);
        }

        pLastShot[playerid][lWeaponId] = weaponid;
        pLastShot[playerid][lCount] = 0;

        if (skilLLevel < 300) {
            rpm = 0;
        } else if (skilLLevel < 600) {
            rpm = 1;
        } else if (skilLLevel < 900) {
            rpm = 2;
        }

        time = floatround((wInfo[weaponid][wRPM][rpm] / 60)) * wInfo[weaponid][wClipSize];

        pLastShot[playerid][lTime] = SetTimerEx("ClearLastShot", time * 1000, false, "d", playerid);
    } else {
        pLastShot[playerid][lCount]++;
    }

    if (pLastShot[playerid][lCount] > wInfo[weaponid][wClipSize]) {
        return 0;
    }

    return 1;
}

forward ClearLastShot(playerid);
public ClearLastShot(playerid)
{
    pLastShot[playerid][lCount] = 0;
}

forward GetPlayerSkillLevel(playerid, weaponid);
public GetPlayerSkillLevel(playerid, weaponid)
{
    new skill = 0;

    if (weaponid >= WEAPON_COLT45 && weaponid <= WEAPON_SNIPER) {
        switch (weaponid) {
            case WEAPON_COLT45: {
                skill = sInfo[playerid][sColt];
            }
            case WEAPON_SILENCED: {
                skill = sInfo[playerid][sSilenced];
            }
            case WEAPON_DEAGLE: {
                skill = sInfo[playerid][sShotgun];
            }
            case WEAPON_SHOTGUN: {
                skill = sInfo[playerid][sShotgun];
            }
            case WEAPON_SAWEDOFF: {
                skill = sInfo[playerid][sSawnoff];
            }
            case WEAPON_SHOTGSPA: {
                skill = sInfo[playerid][sCombat];
            }
            case WEAPON_UZI: {
                skill = sInfo[playerid][sUzi];
            }
            case WEAPON_MP5: {
                skill = sInfo[playerid][sSMG];
            }
            case WEAPON_AK47: {
                skill = sInfo[playerid][sAK47];
            }
            case WEAPON_M4: {
                skill = sInfo[playerid][sM4];
            }
            case WEAPON_TEC9: {
                skill = sInfo[playerid][sTec9];
            }
            case WEAPON_RIFLE: {
                skill = sInfo[playerid][sRifle];
            }
            case WEAPON_SNIPER: {
                skill = sInfo[playerid][sSniper];
            }
        }
    }

    return skill;
}
Reply


Messages In This Thread
Anti No-Reload - by CoaPsyFactor - 04.06.2015, 15:37
Re: Anti No-Reload - by Vince - 04.06.2015, 15:52
Re: Anti No-Reload - by CoaPsyFactor - 04.06.2015, 16:37
Re: Anti No-Reload - by DaniceMcHarley - 04.06.2015, 17:17
Re: Anti No-Reload - by CoaPsyFactor - 04.06.2015, 22:54
Re: Anti No-Reload - by jamesbond007 - 05.06.2015, 02:36
Re: Anti No-Reload - by Airman123 - 05.06.2015, 05:11
Re: Anti No-Reload - by CoaPsyFactor - 05.06.2015, 07:17

Forum Jump:


Users browsing this thread: 3 Guest(s)