DFrame Weapon ??

Hello ,
I have a problem.
I created an DFrame for a weapon and unfortunately the DFrame opens several times, how can it opens once?

I thank you in advance.

Regards,
Proxene

What?

Code ?

IIRC, the function, along with PrimaryAttack, is called multiple times on the client. You’ll need to add a conditional statement to the top using


IsFirstTimePredicted()

.

[editline]25th August 2016[/editline]

Update;
The Wiki has a link to information about Primary/Secondary attack and this issue.
There is also an example of using IsFirstTimePredicted()

Okay, thank you very much but apparently the function is still called two times :confused:

Give us the whole code then.

It is being called serverside and clientside, if you were to call to OpenWalletMenu directly you would get errors serverside but since you are using a concommand you aren’t noticing that.

Change
[lua]if IsFirstTimePredicted() then[/lua]
to
[lua]if CLIENT and IsFirstTimePredicted() then[/lua]

[editline]26th August 2016[/editline]

It’s kind of silly to call the concommand when you already have access to the function and can just call it directly
[lua]function SWEP:SecondaryAttack()
if CLIENT and IsFirstTimePredicted() then
timer.Simple( 0.05, OpenWalletMenu )
end
end[/lua]

Thank you for your advise :smiley:
But the problem persists