Garry's Mod
150 ψήφοι
[E2] WeaponCore
   
Βραβείο
Αγαπημένο
Αγαπημένο
Μη αγαπημένο
Content Type: Addon
Addon Type: Tool
Addon Tags: Build
Μέγεθος αρχείου
Αναρτήθηκε
Ενημερώθηκε
12.309 KB
30 Μαϊ 2015, 12:45
13 Αυγ 2023, 9:44
6 σημειώσεις αλλαγών ( προβολή )

Συνδρομή για λήψη
[E2] WeaponCore

ΣΕ 2 ΣΥΛΛΟΓΕΣ ΑΠΟ Sir Papate
Marmottes.net
65 αντικείμενα
Expression 2 Core
5 αντικείμενα
ΠΕΡΙΓΡΑΦΗ
For more information, go to the GitHub Page[github.com]

WeaponCore

WeaponCore is an extension for the Expression 2[github.com] chip that allows you to manipulate weapons and ammo. It also allows you to run code when a player switches weapons or equips a weapon.

Workshop Installation

The WeaponCore is available on the Steam Workshop! Go to the WeaponCore Workshop Page and press
Subscribe
. For can go to the Expression 2 Core Collection for more extensions.

Manual Installation

Clone this repository into your
steamapps\common\GarrysMod\garrysmod\addons
folder using this command if you are using git:

Documentation

Console Commands

sbox_E2_WeaponCore_allow_all_users

If set to 1, all users will be able to use the WeaponCore on there prop protection friends or themselves. If set to 0, only admins will be able to use the WeaponCore.

default: 0

Events

Declaration
Replacing
event weaponSwitch(Player:entity, OldWeapon:entity, NewWeapon:entity)
runOnWeaponSwitch, weaponSwitchClk
Triggered when a player switches weapons.
event weaponEquip(Player:entity, Weapon:entity, OnSpawn:number)
runOnWeaponEquip, weaponEquipClk
Triggered when a player equips a weapon.
event weaponDrop(Player:entity, Weapon:entity)
Triggered when a player drops a weapon.

Tick Functions

Function
Return
Description
runOnWeaponSwitch(Activate:number)
void
If set to 1, the chip will be executed when the player switches weapons.
weaponSwitchClk()
number
Returns 1 if the player has switched weapons.
lastWeaponSwitchPlayer()
entity
Returns the player that switched weapons.
lastWeaponSwitchOld()
entity
Returns the weapon the player switched from.
lastWeaponSwitchNext()
entity
Returns the weapon the player switched to.
runOnWeaponEquip(Activate:number)
void
Is set to 1, E2 will run when a player equips a weapon.
weaponEquipClk()
number
Returns 1 if the E2 is run because of a weapon equip.
lastWeaponEquip()
entity
Returns the last equipped weapon.

Player Functions

Player functions are restricted to admins only.

Function
Return
Description
entity:plyGive(WeaponClass:string)
void
Give the player a weapon.
entity:plyGiveWeapon(WeaponClass:string)
void
Give the player a weapon.
entity:plyGiveAmmo(AmmoType:string, Amount:number)
void
Gives ammo to a player.
entity:plySetAmmo(AmmoType:string, Amount:number)
void
Sets the amount of of the specified ammo for the player.
entity:plySelectWeapon(WeaponClass:string)
void
Sets the player active weapon.
entity:plyDropWeapon(WeaponClass:string)
void
Drops the player's weapon of a specific class.
entity:plyDropWeapon(Weapon:entity)
void
Forces the player to drop the specified weapon.
entity:plyStripWeapon(WeaponClass:string)
void
Removes the specified weapon class from a certain player.
entity:plyStripWeapon(Weapon:entity)
void
Removes the specified weapon from a certain player
entity:plyStripWeapons()
void
Removes all weapons from a certain player
entity:plyStripAmmo()
void
Removes all ammo from the player.
entity:plySetClip1(Amount:number)
void
Lets you change the number of bullets in the given weapons primary clip.
entity:plySetClip2(Amount:number)
void
Lets you change the number of bullets in the given weapons secondary clip.

Getters

Function
Return
Description
entity:getWeapon(WeaponClass:string)
entity
Returns the weapon entity whit the class.
entity:getWeapons()
array
Returns a table of the player's weapons.
entity:hasWeapon(WeaponClass:string)
number
Returns if the player has the specified weapon.
Δημοφιλείς συζητήσεις ΠΡΟΒΟΛΗ ΟΛΩΝ (4)
4
18 Οκτ 2019, 9:04
ΕΠΙΣΗΜΑΣΜΕΝΟ: Bug reports
Sir Papate
4
26 Απρ 2020, 17:09
ΕΠΙΣΗΜΑΣΜΕΝΟ: Documentation
Sir Papate
1
26 Ιουν 2015, 10:20
[E2 Code] Soap Guns
Sir Papate
9 σχόλια
Sanders 3 Μαρ, 9:06 
this doesnt work

@name
@inputs
@outputs
@persist
@trigger
@strict
interval(10)



E = owner()
TYPE = "Pulse Ammo"

E:plySetAmmo(TYPE,900)


i get the error sv: Expression 2 (generic): entities/gmod_wire_expression2/core/custom/weaponcore.lua:84: bad argument #2 to 'SetAmmo' (number expected, got function)


what am i doing wrong?
faɪkʰ 24 Μαϊ 2017, 1:12 
Turns out I had to enable them in options....
Codingale 23 Μαϊ 2017, 16:56 
You have a few functions that are restricted for no reason and do not return empty arrays.

for example, ply:getWeapons() shouldn't be restricted to admins.. nor should hasWeapon
faɪkʰ 23 Μαϊ 2017, 1:15 
I am having trouble getting any commands to work, E2 says they dont exist? tips?

GreyGhost 27 Ιαν 2016, 19:44 
Thank you!!!!!
Link117 18 Νοε 2015, 13:04 
what does it do i am a bite confuse :squirtheh:
Jedimaster127 31 Οκτ 2015, 15:34 
What does it do?
Rubicon 12 Οκτ 2015, 0:37 
YES!
X 1 Αυγ 2015, 23:20 
what does it do?