Garry's Mod

Garry's Mod

156 vurderinger
[E2] WeaponCore
   
Pris
Føj til foretrukne
Gjort til foretrukken
Fjern som foretrukken
Content Type: Addon
Addon Type: Tool
Addon Tags: Build
Filstørrelse:
Offentliggjort:
Opdateret:
12.309 KB
30. maj 2015 kl. 12:45
13. aug. 2023 kl. 9:44
6 ændringsbemærkninger ( vis )

Abonner for at downloade
[E2] WeaponCore

I 2 samlinger af Sir Papate
Marmottes.net
65 genstande
Expression 2 Core
5 genstande
Beskrivelse
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.
Populære diskussioner Vis alle (4)
5
16. feb. kl. 11:38
FASTGJORT: Documentation
Sir Papate
4
18. okt. 2019 kl. 9:04
FASTGJORT: Bug reports
Sir Papate
1
26. juni 2015 kl. 10:20
[E2 Code] Soap Guns
Sir Papate
9 kommentarer
Sanders 3. mar. 2024 kl. 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?
pfych 24. maj 2017 kl. 1:12 
Turns out I had to enable them in options....
Codingale 23. maj 2017 kl. 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
pfych 23. maj 2017 kl. 1:15 
I am having trouble getting any commands to work, E2 says they dont exist? tips?

GreyGhost 27. jan. 2016 kl. 19:44 
Thank you!!!!!
Link117 18. nov. 2015 kl. 13:04 
what does it do i am a bite confuse :squirtheh:
Jedimaster127 31. okt. 2015 kl. 15:34 
What does it do?
Rubicon 12. okt. 2015 kl. 0:37 
YES!
X 1. aug. 2015 kl. 23:20 
what does it do?