Hello FacePunch community !
Before starting, I wich that I'm not in the wrong section to post my question, and sorry if I'm wrong.
For my own server, I want code all addons and I've started by creating a SWEP.
Today, after doing the first lines, I've tryed to test my SWEP but there were a problem :
My PrimaryAttack() button ( left mouse button ) seems unworking.
I've done few lines to tryed to resolve my problems but nothing to do.
[CODE]
-- This function is client-sided AND server-sided so I put it in shared ( I'm wrong ? )
function SWEP:PrimaryAttack()
if (!self:CanPrimaryAttack()) then return end -- To know if we can attack
print("PRIMARY ATTACK WORKS WELL") -- For test if the primary attack works well
end
function SWEP:SecondaryAttack()
if (!self:CanSecondaryAttack()) then return end -- To know if we can attack
print("SECONDARY ATTACK WORKS WELL") -- For test if the secondary attack works well
end
[/CODE]
So, in-game, when I click ( and spam ) the PrimaryAttack() button, nothing appear. After, I've tryed to click on my SecondaryAttack() button ( so, the right mouse button ) the sentence
[CODE]SECONDARY ATTACK WORKS WELL[/CODE] appear 2 times in my console ( 2 times for one click WTF ? )
So, I just want to know why my PrimaryAttack() button doesn't work and how I can make it working...
Thanks a lot guys for your help,
Cheers,
Gaby
[highlight](User was banned for this post ("Wrong section" - Kiwi))[/highlight]
EDIT :
Hello :)
I don't know why and how but this error have been fixed. I've just restart my desktop and it have been fixed....
Thanks for all,
Gaby
Hi there
For Garrys mod related programming you're best off reposting this in [URL="https://facepunch.com/forumdisplay.php?f=65"]this section (linked)[/URL]
The code you posted makes sense (to me); I think you need to provide more of your script to figure out what the issue is.
Though I know next to nothing about GMod programming, the issue of the secondary ability firing twice [I]COULD BE [/I]because the button triggering it both: 1) On Press, and 2) On Release?
Sorry, you need to Log In to post a reply to this thread.