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

0 Members and 5 Guests are viewing this topic.

Offline Slice

  • SA-MP Retirees
  • *
  • *
  • Posts: 811
    • Awards
Re: Anti-2shot
« Reply #15 on: November 01, 2010, 08:49:21 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
Yeah. The rule is shoot all sawn-off bullets before switching to another weapon.

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.)
How about if the player doesn't switch back the weapon in 2-3 seconds, ignore the player's not reloading. Returning 0 would be tricky; I'd have to make the script return 0 to several player updates in order to desync the shot.

Offline Disco

  • SA-MP Donator
  • *
  • Posts: 1478
  • .
    • Awards
Re: Anti-2shot
« Reply #16 on: November 01, 2010, 09:06:51 AM »
it sometimes happens in fights that u do a single 2 shot without wanting it and then it gets a weird fight ..
that script sux ...

Offline Slice

  • SA-MP Retirees
  • *
  • *
  • Posts: 811
    • Awards
Re: Anti-2shot
« Reply #17 on: November 01, 2010, 09:10:17 AM »
it sometimes happens in fights that u do a single 2 shot without wanting it and then it gets a weird fight ..
that script sux ...
there's a post right above yours with a suggested solution to that. maybe you should start actually reading the topic before posting crap as usual.

Offline Simon

  • SA-MP Retirees
  • *
  • *
  • *
  • Posts: 1236
  • Retired
    • Awards
  • SA-MP: [CP]Simon
Re: Anti-2shot
« Reply #18 on: November 01, 2010, 09:17:09 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
Yeah. The rule is shoot all sawn-off bullets before switching to another weapon.

I've always been under the impression that the 2-shot rule was added it was there to stop people unnaturally increasing their rate of fire, to create an effect like an infinite sawn-off.

I guess the rule has morphed over time and admins have just told players to shoot all shots so there's no confusion, however if there's a systematic way of detecting 2-shot (as there is) then I do not see why you HAVE to shoot all four bullets.

What if you want to simply conserve ammo (yeah I know, rich players think of bullets as peanuts. New players however may want to conserve the spawn sawnoffs) or as Disco said, you accidentally shot a couple of bullets (e.g. you tapped shoot, but then realised in the same moment that you wanted to use uzi's, or get the guy with M4 as he's running away)?

edit:

Please don't say stupid things like "script sux". It's degrading and annoying when people say that sort of stuff when constructive criticisms could be given instead
« Last Edit: November 01, 2010, 09:24:50 AM by Hazard »

Offline Slice

  • SA-MP Retirees
  • *
  • *
  • Posts: 811
    • Awards
Re: Anti-2shot
« Reply #19 on: November 01, 2010, 09:20:51 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
Yeah. The rule is shoot all sawn-off bullets before switching to another weapon.

I've always been under the impression that the 2-shot rule was added it was there to stop people unnaturally increasing their rate of fire, to create an effect like an infinite sawn-off.

I guess the rule has morphed over time and admins have just told players to shoot all shots so there's no confusion, however if there's a systematic way of detecting 2-shot (as there is) then I do not see why you HAVE to shoot all four bullets.

What if you want to simply conserve ammo (I know, I know... you rich players think of bullets as peanuts) or as Disco said, you accidentally shot a couple of bullets (e.g. you tapped shoot, but then realised in the same moment that you wanted to use uzi's, or get the guy with M4 as he's running away)?
What I meant with the 2-3 second delay is it would basically determine if the sawnoff would have been reloaded when you switch it back. That way, people switching back to sawn-offs quickly will get punished for evading the sawnoff reload - others won't.

Offline Simon

  • SA-MP Retirees
  • *
  • *
  • *
  • Posts: 1236
  • Retired
    • Awards
  • SA-MP: [CP]Simon
Re: Anti-2shot
« Reply #20 on: November 01, 2010, 09:23:58 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
Yeah. The rule is shoot all sawn-off bullets before switching to another weapon.

I've always been under the impression that the 2-shot rule was added it was there to stop people unnaturally increasing their rate of fire, to create an effect like an infinite sawn-off.

I guess the rule has morphed over time and admins have just told players to shoot all shots so there's no confusion, however if there's a systematic way of detecting 2-shot (as there is) then I do not see why you HAVE to shoot all four bullets.

What if you want to simply conserve ammo (I know, I know... you rich players think of bullets as peanuts) or as Disco said, you accidentally shot a couple of bullets (e.g. you tapped shoot, but then realised in the same moment that you wanted to use uzi's, or get the guy with M4 as he's running away)?
What I meant with the 2-3 second delay is it would basically determine if the sawnoff would have been reloaded when you switch it back. That way, people switching back to sawn-offs quickly will get punished for evading the sawnoff reload - others won't.

It sounds perfect.
« Last Edit: November 01, 2010, 09:27:12 AM by Hazard »

Offline Slice

  • SA-MP Retirees
  • *
  • *
  • Posts: 811
    • Awards
Re: Anti-2shot
« Reply #21 on: November 02, 2010, 07:44:06 AM »
Could someone try this:
Remember, it needs y_bit.inc from YSI.

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

#define FREEZE_TIME       (650) // The time a player will get froze after evading reload and switching back.
#define PUNISH_THRESOLD  (2500) // If the player doesn't switch back the weapon in <PUNISH_THRESOLD> ms, ignore it.
#define iPlayer  playerid

#pragma tabsize 0

new
BitArray:g_abIsSawnoffClipUsed< MAX_PLAYERS >,
BitArray:g_abThisBitchDidntReload< MAX_PLAYERS >,
g_iReloadEvadeTime[ 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 );
Bit_Vet( g_abThisBitchDidntReload, 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 )
{
Bit_Let( g_abThisBitchDidntReload, iPlayer );

g_iReloadEvadeTime[ iPlayer ] = GetTickCount( );
}
}

g_cFiredShots{ iPlayer } = 0;
}
else if ( s_iWeapon == WEAPON_SAWEDOFF )
{
if ( Bit_Get( g_abThisBitchDidntReload, iPlayer ) )
{
if ( GetTickCount( ) - g_iReloadEvadeTime[ iPlayer ] < PUNISH_THRESOLD )
{
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 );
}
}

Bit_Vet( g_abThisBitchDidntReload, iPlayer );
}
}

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;
}

Offline Fuse

  • SA-MP Donator
  • *
  • Posts: 1048
    • Awards
Re: Anti-2shot
« Reply #22 on: November 02, 2010, 12:07:23 PM »
Tried it.

When you 2shot and change to uzi nothing special happens.
But when you switch back to sawnoffs faster than about 2.5 seconds you get freezed.
If you change back to sawnoffs later than those 2.5 seconds you don't get freezed.

Offline Slice

  • SA-MP Retirees
  • *
  • *
  • Posts: 811
    • Awards
Re: Anti-2shot
« Reply #23 on: November 02, 2010, 02:03:07 PM »
I guess it's working then, cheers.

Offline [JOKER]Ya$N

Re: Anti-2shot
« Reply #24 on: November 06, 2010, 04:09:11 PM »
Nice Script slice but i do not like freezing for example Check MTA anti 2shot

-------------------------------------------------------------------------------------------------------------------------------------------------

Stunt video || Click
---------------------------------

CPU: Intel® Coreâ„¢ i7-4790K Processor  | MOBO: MSI Z97 Gaming 5 | GPU: Gigabyte GeForce GTX 970 G1 4GB | RAM: Kingston HyperX Fury 8GB DDR3-1600MHz | HDD: Seagate 1TB | CPU FAN: Cooler Master Hyper 212 EVO | PSU: Cooler Master G750M | CASE: Thermaltake Chaser A31
Mouse: Razer DeathAdder 6400DPI | Mouse Pad: Razer Goliathus Control Edition | Speakers: Logitech X-530 Surround Sound 5.1 | Controller: XBOX 360 Black

Offline Slice

  • SA-MP Retirees
  • *
  • *
  • Posts: 811
    • Awards
Re: Anti-2shot
« Reply #25 on: November 06, 2010, 04:41:47 PM »
Nice Script slice but i do not like freezing for example Check MTA anti 2shot
I'm guessing the "anti-2shot" is their removal of quick reload. You can't do that with scripting in SA-MP..


PUNISH_THRESOLD should be lowered to 2000.

Offline iMJets

  • SA-MP Donator
  • *
  • Posts: 2165
  • .::[UB]::. Clan Founder
    • [UnBreakables] Clan Forums
    • Awards
  • SA-MP: Jets[UB]
Re: Anti-2shot
« Reply #26 on: November 07, 2010, 02:28:59 AM »
im liking this a lot but sometimes i noticed if u 3 shot it does same thing (if u lag for a sec) but thats normal i would guess keep up the good work.

Offline [JOKER]Miczi

  • SA-MP Retirees
  • *
  • Posts: 1365
  • Proud LW player since SA-MP 0,1b
    • Awards
Re: Anti-2shot
« Reply #27 on: November 08, 2010, 09:31:48 PM »
I never looked on scripting this way xD


Code: [Select]
#include <a_samp>
 BitArray:g_abIsSawnoffClipUsed< MAX_PLAYERS >,
   BitArray:g_ab[b]ThisBitchDidntReload[/b]< MAX_PLAYERS >,
}


Back on topic: As Hazard I always thougt that 2 shot (double shot or two shot btw?) is about shooting infinite ammount of sawn bullets, I never seen a problem in 2shot-uzi-2shot-uzi. The script doesn't harm me in any way, same with others regulars, but what about newbies? When I was learning how to switch properly for a long time I made mistakes and shot only 2 bullets... They may be confused.


Offline Gryphus_One

  • Banned
  • *
  • Posts: 1079
  • Personal Text
    • My Youtube account ;)
    • Awards
Re: Anti-2shot
« Reply #28 on: November 08, 2010, 09:58:20 PM »
but what about newbies? When I was learning how to switch properly for a long time I made mistakes and shot only 2 bullets... They may be confused.

Hey this is an interesting point of view. Why don't you make the script to detect if you have shot more than 4 cartridges in a short time? This would also be useful against noreload cheaters.
.
« Last Edit: November 08, 2010, 10:08:32 PM by [kicked]Gryphus_One »

Offline [R]phil_mitchel

  • Kiddy Fish
  • **
  • Posts: 66
  • hi my name is phil mitchel
    • Awards
Re: Anti-2shot
« Reply #29 on: November 12, 2010, 12:05:17 PM »
er, are u sure this is working cos about 6 diff idiots wer 2 shotting me yesterday n they didnt freeaze?