Raised This Month: $ Target: $400
 0% 

Do spray from any weapon (CS)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 12-28-2013 , 06:55   Do spray from any weapon (CS)
Reply With Quote #1

Hello.
I want to do spray from any weapon.

If weapon == automatic (AK47, AWP, etc.), then I can do:
PHP Code:
client_cmd(id"+attack"
And player shot out all magazine (do spray). It's okay.

But, how I can do same for Pistols? How I can make player shot very fast as far as it possible from Pistol?
Phant is offline
Send a message via ICQ to Phant
Bos93
Veteran Member
Join Date: Jul 2010
Old 12-28-2013 , 07:00   Re: Do spray from any weapon (CS)
Reply With Quote #2

client_cmd(id, "+attack") -> ExecuteHam( Ham_Weapon_PrimaryAttack , pEntity );

https://forums.alliedmods.net/showthread.php?t=138972
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-28-2013 , 07:05   Re: Do spray from any weapon (CS)
Reply With Quote #3

PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >

#pragma semicolon 1

#define PLUGIN "Automatic Usp"
#define VERSION "0.0.1"

#define cm(%0)    ( sizeof(%0) - 1 )

const XO_CBASEPLAYERWEAPON 4;
const 
m_iShotFired 64;

public 
plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );

    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_usp""OnCUSP_PrimaryAttack_P"true);
}

public 
OnCUSP_PrimaryAttack_PiUSP )
{
    
set_pdata_int(iUSPm_iShotFired0XO_CBASEPLAYERWEAPON);

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 12-28-2013 , 07:08   Re: Do spray from any weapon (CS)
Reply With Quote #4

Thanks. And now I need to hook moment, when player can shot from current weapon.
For execute this command (Ham_Weapon_PrimaryAttack) in this moment.

UPD:
Oh, ConnorMcLeod, thanks you. I will test it.

Last edited by Phant; 12-28-2013 at 07:10.
Phant is offline
Send a message via ICQ to Phant
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-28-2013 , 07:13   Re: Do spray from any weapon (CS)
Reply With Quote #5

You can use arkshine's plugin that is handling all pistols, but take care he forgot to set the correct linux offset difference.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 12-28-2013 , 07:55   Re: Do spray from any weapon (CS)
Reply With Quote #6

Quote:
Originally Posted by ConnorMcLeod View Post
You can use arkshine's plugin that is handling all pistols, but take care he forgot to set the correct linux offset difference.
I just register all pistols on this function. Work perfect.

Another question:
In function "OnCUSP_PrimaryAttack_P" can I check ammo (in magazine) of current weapon?
I want check If ammo == 0, then I send "-attack", for reloading, and after reloading, send +attack for continue spraying (new magazine).
Or better do it in CurWeapon?
Phant is offline
Send a message via ICQ to Phant
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-28-2013 , 09:19   Re: Do spray from any weapon (CS)
Reply With Quote #7

I don't know, try it.
Also, client_cmd is usually a poor way for that kind of stuff, would be better to force IN_ATTACK button in CmdStart , or in PostThink.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 12-28-2013 , 09:30   Re: Do spray from any weapon (CS)
Reply With Quote #8

Quote:
Originally Posted by ConnorMcLeod View Post
I don't know, try it.
Also, client_cmd is usually a poor way for that kind of stuff, would be better to force IN_ATTACK button in CmdStart , or in PostThink.
The problem is that I don't know how to get ammo number in this function.
I think need to use get_pdata_int() or something like that, but question in offsets...

UPD, DONE:
PHP Code:
    new amm get_pdata_int(iPISTOL51);    
    if(
amm == 10)
    {
        
set_pdata_int(iPISTOL5120);
    } 

Last edited by Phant; 12-28-2013 at 09:36.
Phant is offline
Send a message via ICQ to Phant
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:07.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode