AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Make weapon fire (https://forums.alliedmods.net/showthread.php?t=237667)

Buckshot 03-28-2014 06:37

Make weapon fire
 
How do i make a knife stab, slash, or a primary or secondary weapon shoot with pawn? I've searched, but i've only found ways to BLOCK the attacks, and not make the weapons fire.

Black Rose 03-28-2014 15:34

Re: Make weapon fire
 
It won't take into account the delay between attacks, you you'll have to simulate that if you want continuous fire. Without that small delay I'm not getting any sounds, don't know why.
That's as far as I'm willing to go without the XY-problem being cleared.
Code:
#include <amxmodx> #include <hamsandwich> #define m_pPlayer      41 // CBasePlayerItem, Linux +4 new gWeaponEntIndex[33]; public plugin_init() {     register_plugin("Test Plugin 1", "", "[ --{-@ ]");         register_clcmd("say /attack", "clcmdAttack");         RegisterHam(Ham_Item_Deploy, "weapon_m4a1", "fwdItemDeploy"); } public fwdItemDeploy(index)     gWeaponEntIndex[get_pdata_cbase(index, m_pPlayer, 4)] = index; public clcmdAttack(id)     set_task(0.1, "delayAttack", id); public delayAttack(id)     ExecuteHam(Ham_Weapon_PrimaryAttack, gWeaponEntIndex[id]);


All times are GMT -4. The time now is 05:55.

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