ok, so at the moment I am really pissed off, one moment, I think I have fixed my issue, then another problem arises. I basically need a way to get the current secondary and primary weapons. thats it, but I have tried loads of different ways, but I still cant figure it out. It doesnt look like there is code like CurrentPrimary.Get() or CurrentSecondary.Get(), which is basically what I need.
[QUOTE=Mattymoo14211;48581011]ok, so at the moment I am really pissed off, one moment, I think I have fixed my issue, then another problem arises. I basically need a way to get the current secondary and primary weapons. thats it, but I have tried loads of different ways, but I still cant figure it out. It doesnt look like there is code like CurrentPrimary.Get() or CurrentSecondary.Get(), which is basically what I need.[/QUOTE]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/GetActiveWeapon]Player:GetActiveWeapon[/url]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/GetWeapons]Player:GetWeapons[/url]
[QUOTE=Hoffa1337;48581019][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/GetActiveWeapon]Player:GetActiveWeapon[/url]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/GetWeapons]Player:GetWeapons[/url][/QUOTE]
I know there is Get Weapons but that returns the secondary and primary, but I would like them to be returned seperately, so I can use the code:
[code]
primary = WHATEVER WAY OF GETTING PRIMARY
secondary = WHATEVER WAY OF GETTING SECONDARY
ply:ConCommand("use", "..primary..")
ply:ConCommand("use", "..secondary..")
[/code]
[QUOTE=Mattymoo14211;48581035]I know there is Get Weapons but that returns the secondary and primary, but I would like them to be returned seperately, so I can use the code:
[code]
primary = WHATEVER WAY OF GETTING PRIMARY
secondary = WHATEVER WAY OF GETTING SECONDARY
ply:ConCommand("use", "..primary..")
ply:ConCommand("use", "..secondary..")
[/code][/QUOTE]
I think youre looking for concommand.Run
[QUOTE=CGHippo;48581044]I think youre looking for concommand.Run[/QUOTE]
yes, all I need is a way to get the weapon class of the current primary and secondary.
[QUOTE=Mattymoo14211;48581058]yes, all I need is a way to get the weapon class of the current primary and secondary.[/QUOTE]
There is no secondary weapon. What if the player has 3, 4 or 5 weapons on them? Which is considered the secondary? What are you trying to achieve?
I found this:
[code]
function PANEL:BuildCheckBoxes()
local pw, sw = weapons.Get( self.CurrentPrimary ), weapons.Get( self.CurrentSecondary )----HERE!
self.PAttachments:Clear()
for k, t in pairs( GAMEMODE.WeaponAttachments ) do
if pw then
if not pw.VElements or not pw.VElements[k] then
continue
end
end
[/code]
would that work?
[QUOTE=Mattymoo14211;48581086]I found this:
[code]
function PANEL:BuildCheckBoxes()
local pw, sw = weapons.Get( self.CurrentPrimary ), weapons.Get( self.CurrentSecondary )----HERE!
self.PAttachments:Clear()
for k, t in pairs( GAMEMODE.WeaponAttachments ) do
if pw then
if not pw.VElements or not pw.VElements[k] then
continue
end
end
[/code]
would that work?[/QUOTE]
No because self.CurrentPrimary and self.CurrentSecondary isn't defined anywhere. They are variables stored on the panel object in that particular piece of code but they are never declared in the code you posted. Let me ask you again, what is it that you are trying to achieve?
[QUOTE=Hoffa1337;48581084]There is no secondary weapon. What if the player has 3, 4 or 5 weapons on them? Which is considered the secondary? What are you trying to achieve?[/QUOTE]
Hoffa is correct. There's no secondary weapon. You can get the active weapon as he said with Player:GetActiveWeapon, or get all the weapons using Player:GetWeapons. The only way I can see you achieving this is creating your own system for handling a primary and secondary weapon.
[QUOTE=Hoffa1337;48581120]No because self.CurrentPrimary and self.CurrentSecondary isn't defined anywhere. They are variables stored on the panel object in that particular piece of code but they are never declared in the code you posted. Let me ask you again, what is it that you are trying to achieve?[/QUOTE]
I got rid of CHudWeaponSelection, because the sounds, looks everything about it is shit, so now I basically want it so it will automatically give clients their primary/secondary on either the press of button 1 or button 2, but I cant do it so it binds them to say, slot 1, because the sweps I am using, are usually a mix of slot 1 or 2, no matter whether its a primary or secondary weapon, hence why I want it to make it so it makes the player use the weapon and not use a certain slot. I hope that made sense :)
[editline]31st August 2015[/editline]
oh, btw, the player will always only have one secondary and one primary
[editline]31st August 2015[/editline]
it is the gamemode f2s stronghold, I am wondering whether there would be any way to check to see what weapon the player chose to spawn with
[editline]31st August 2015[/editline]
[QUOTE=Semajnad;48581165]Hoffa is correct. There's no secondary weapon. You can get the active weapon as he said with Player:GetActiveWeapon, or get all the weapons using Player:GetWeapons. The only way I can see you achieving this is creating your own system for handling a primary and secondary weapon.[/QUOTE]
Its either I do this, or I find/make a new weapon selection ui
[editline]31st August 2015[/editline]
I found the perfect thing! I can use fast switch, the only thing now is to be able to set it to every player having fast switch enabled
Sorry, you need to Log In to post a reply to this thread.