Author Topic: [I]Anti-2shot  (Read 11508 times)

0 Members and 1 Guest are viewing this topic.

Offline Slice

  • SA-MP Retirees
  • *
  • *
  • Posts: 811
    • Awards
[I]Anti-2shot
« on: October 30, 2010, 05:53:16 PM »
No more 2shot with this! Needs y_bit.inc from YSI.

Code: [Select]
#include <a_samp>
#include <YSI/y_bit.inc>

#define FREEZE_TIME (650)

#define iPlayer  playerid

#pragma tabsize 0

new
BitArray:g_abIsSawnoffClipUsed< MAX_PLAYERS >,
         g_iSawnoffAmmo[ MAX_PLAYERS ],
         g_cFiredShots[ MAX_PLAYERS char ],
         g_cPreviousWeapon[ MAX_PLAYERS char ]
;

public OnPlayerSpawn( iPlayer )
{
g_iSawnoffAmmo[ iPlayer ] = -1;
g_cFiredShots{ iPlayer } = 0;
g_cPreviousWeapon{ iPlayer } = 0;

Bit_Vet( g_abIsSawnoffClipUsed, iPlayer );
}

public OnPlayerUpdate( iPlayer )
{
static
s_iState,
s_iSpecialAction
;

s_iState = GetPlayerState( iPlayer );
s_iSpecialAction = GetPlayerSpecialAction( iPlayer );

if ( s_iState == PLAYER_STATE_ONFOOT && ( s_iSpecialAction == SPECIAL_ACTION_NONE || s_iSpecialAction == SPECIAL_ACTION_DUCK ) )
{
static
s_iWeapon,
s_iAmmo
;

s_iWeapon = GetPlayerWeapon( iPlayer );
s_iAmmo = GetPlayerAmmo( iPlayer );

if ( g_cPreviousWeapon{ iPlayer } != s_iWeapon )
{
if ( g_cPreviousWeapon{ iPlayer } == WEAPON_SAWEDOFF )
{
if ( Bit_Get( g_abIsSawnoffClipUsed, iPlayer ) )
{
static
s_iWeaponState
;

s_iWeaponState = GetPlayerWeaponState( iPlayer );

if ( ( s_iWeaponState == WEAPONSTATE_MORE_BULLETS
     || s_iWeaponState == WEAPONSTATE_LAST_BULLET )
&& g_cFiredShots{ iPlayer } != 4 )
{
new
Float:fVX,
Float:fVY,
Float:fVZ
;

GetPlayerVelocity( iPlayer, fVX, fVY, fVZ );

if ( floatabs( fVZ ) < 0.15 )
{
ClearAnimations( iPlayer, 1 );

ApplyAnimation( playerid, "PED", "XPRESSscratch", 0.0, 1, 0, 0, 0, FREEZE_TIME, 1 );
}
}
}

g_cFiredShots{ iPlayer } = 0;
}


g_cPreviousWeapon{ iPlayer } = s_iWeapon;
}

if ( s_iWeapon == WEAPON_SAWEDOFF )
{
if ( g_iSawnoffAmmo[ iPlayer ] == -1 )
g_iSawnoffAmmo[ iPlayer ] = GetPlayerAmmo( iPlayer );
else
{
if ( GetPlayerWeaponState( iPlayer ) == WEAPONSTATE_RELOADING )
{
if ( Bit_Get( g_abIsSawnoffClipUsed, iPlayer ) )
Bit_Vet( g_abIsSawnoffClipUsed, iPlayer );
}
else
{
if ( g_iSawnoffAmmo[ iPlayer ] != s_iAmmo )
{
if ( s_iAmmo < g_iSawnoffAmmo[ iPlayer ] )
{
Bit_Let( g_abIsSawnoffClipUsed, iPlayer );

g_cFiredShots{ iPlayer } += g_iSawnoffAmmo[ iPlayer ] - s_iAmmo;
}
else
{
g_cFiredShots{ iPlayer } = 0;

Bit_Vet( g_abIsSawnoffClipUsed, iPlayer );
}

g_iSawnoffAmmo[ iPlayer ] = s_iAmmo;
}
}
}
}
else if ( g_iSawnoffAmmo[ iPlayer ] != -1 || Bit_Get( g_abIsSawnoffClipUsed, iPlayer ) )
{
g_iSawnoffAmmo[ iPlayer ] = -1;

Bit_Vet( g_abIsSawnoffClipUsed, iPlayer );

g_cFiredShots{ iPlayer } = 0;
}
}
else if ( g_iSawnoffAmmo[ iPlayer ] != -1 || Bit_Get( g_abIsSawnoffClipUsed, iPlayer ) )
{
g_iSawnoffAmmo[ iPlayer ] = -1;

Bit_Vet( g_abIsSawnoffClipUsed, iPlayer );

g_cFiredShots{ iPlayer } = 0;
}

return 1;
}

Edit: Update.
« Last Edit: November 13, 2010, 10:17:15 AM by NiGHTM4RE »

Offline iMJets

  • SA-MP Donator
  • *
  • Posts: 2165
  • .::[UB]::. Clan Founder
    • [UnBreakables] Clan Forums
    • Awards
  • SA-MP: Jets[UB]
Re: Anti-2shot
« Reply #1 on: October 30, 2010, 06:13:49 PM »
i suggested this along time ago and it was said to be not possible i knew it was lol

Offline Flashy

  • Kiddy Fish
  • **
  • Posts: 98
  • You mad?
    • Awards
Re: Anti-2shot
« Reply #2 on: October 30, 2010, 06:41:47 PM »
+10²³²³

The question is now: Does this work?
Reaction from Mr. Poge after multiple times banned and finally unbanned:
Quote from: Mr. Poge
AlvarrrrrrrrrrrrrrrrrrrrrrrrRRRRRRRRR!!! Thank YOOOOOOOOOOOUuuuuuuuuuuuu <3333 <3
<333 !!!!      i'm so happyyyyyyyyyy Thaksssss!!! alvarrrrrr )))) :$ :$: :$ :$
Ty Ty Ty Ty Ty Ty Ty Ty i dont know waht to say but i'm so happy man Ty Ty Thank you thank You!! <3 :$
songs good but i dont think that can be maked ...

Offline Reny

  • SA-MP Retirees
  • *
  • *
  • Posts: 2161
  • I don't like personal texts.
    • Awards
  • SA-MP: Reny[UB]
Re: Anti-2shot
« Reply #3 on: October 30, 2010, 06:43:40 PM »
+10²³²³

The question is now: Does this work?
If Slice scripted it,there's no doubt about it :)
Good job.
" Flames, they licked the walls,
Tenderly they turned to dust all that i adore.. "
  

Offline Quickplay

  • SA-MP Retirees
  • *
  • *
  • Posts: 2212
  • Crazy Mind
    • Awards
  • SA-MP: Quickplay
Re: Anti-2shot
« Reply #4 on: October 30, 2010, 08:11:29 PM »
fuckin fuckin good :D :D
often happens that idiots use dual shot even after u said them to don't do that...and they don't care when there's no admin on to ban them. this would be great

Offline SRC

  • SA-MP Donator
  • *
  • Posts: 559
  • Copac Founder !
    • Awards
Re: Anti-2shot
« Reply #5 on: October 30, 2010, 08:14:34 PM »
That is very good for server and bad for abuser :P gj  ;)

Offline Fuse

  • SA-MP Donator
  • *
  • Posts: 1048
    • Awards
Re: Anti-2shot
« Reply #6 on: October 30, 2010, 10:39:40 PM »
Nice work slice, you think in smart ways that i would never be able do :)

Cool script

Offline j.king

  • VC-MP Retirees
  • SA-MP Retirees
  • *
  • *
  • *
  • Posts: 1459
    • Awards
Re: Anti-2shot
« Reply #7 on: October 30, 2010, 11:21:47 PM »
slaice gw


Offline iMJets

  • SA-MP Donator
  • *
  • Posts: 2165
  • .::[UB]::. Clan Founder
    • [UnBreakables] Clan Forums
    • Awards
  • SA-MP: Jets[UB]
Re: Anti-2shot
« Reply #8 on: October 31, 2010, 07:53:06 PM »
that was fast nice to see it implemented

Offline Gryphus_One

  • Banned
  • *
  • Posts: 1079
  • Personal Text
    • My Youtube account ;)
    • Awards
Re: Anti-2shot
« Reply #9 on: October 31, 2010, 07:56:42 PM »
that was fast nice to see it implemented

Is it already implemented?? :o
I'm gonna try it...

EDIT: no it's not implemented.
.
« Last Edit: October 31, 2010, 07:58:19 PM by [kicked]Gryphus_One »

Offline iMJets

  • SA-MP Donator
  • *
  • Posts: 2165
  • .::[UB]::. Clan Founder
    • [UnBreakables] Clan Forums
    • Awards
  • SA-MP: Jets[UB]
Re: Anti-2shot
« Reply #10 on: October 31, 2010, 08:03:53 PM »
yes it is gryphus it freezes u if u 2 shot and u can take damage

Offline Simon

  • SA-MP Retirees
  • *
  • *
  • *
  • Posts: 1236
  • Retired
    • Awards
  • SA-MP: [CP]Simon
Re: Anti-2shot
« Reply #11 on: November 01, 2010, 01:51:28 AM »
Nice work, some small (should be fixable) annoyances though.

If you fire 2 bullets out of your sawn off then change weapons 10 seconds later (or any amount of time) you will still freeze. If you fire 2-shots then use your other weapon (while not taking advantage of the 2-shot rapid fire) then you will still also freeze, both are related to the same thing.

I think the issue could be resolved by moving the freeze trigger to when they shoot again, then adding a time check i.e. only freeze when they switch from and to sawnoff within x milliseconds. Yes, it probably wouldn't prevent 2-shot for laggers (shot fired sent before trigger and freeze animation*) but it'd still kill the advantages a player tried to gain from using the bug.

I'm not sure if this is with your updated version. I'm not sure if dugi put your older or newer version on the main server for testing.

(*You could try a return 0 to desync the 2-shot fired for other players. I'm not sure if that will cause some sort of desynced aftermath though.)
« Last Edit: November 01, 2010, 05:10:46 AM by Hazard »

Offline iMJets

  • SA-MP Donator
  • *
  • Posts: 2165
  • .::[UB]::. Clan Founder
    • [UnBreakables] Clan Forums
    • Awards
  • SA-MP: Jets[UB]
Re: Anti-2shot
« Reply #12 on: November 01, 2010, 03:56:34 AM »
i found a bug but i didnt know how to do it again i think slice figured it out though i wont say it here but very nice work overall

Offline BikeDriver

  • Fisher
  • ******
  • Posts: 1765
  • I can do anything
    • Awards
Re: Anti-2shot
« Reply #13 on: November 01, 2010, 06:14:56 AM »
i found a bug but i didnt know how to do it again i think slice figured it out though i wont say it here but very nice work overall

i like it too if the best LW RF fight000000r likes it :)
BikeDriv:))))

Haha blwelrwelrt, I registered here earlier :P

Offline n1K

  • SA-MP Server Admin
  • *
  • *
  • Posts: 818
  • COCKY PRICK!!!
    • Awards
Re: Anti-2shot
« Reply #14 on: November 01, 2010, 08:34:22 AM »
Erhm Hazard, as you said it freezes you if you 2 shot and then change your weapon. I guess that aint a bug and is still 2 shot.
I have seen people shooting 2 sawns and then switching for uzis. This is not allowed on lw as i have seen admins warning others for it.
Correct me if i am wrong