#my swep isnt appreaing in my spawn menu!

1 messages · Page 1 of 1 (latest)

upper dagger
#

ive followed all the steps my friend said to me but i cant get it to show ingame!

#

heres my lua. please tell me if theres anything wrong with it

night swift
#

wy do Yoe define primaryattack Toow times?

upper dagger
#

im just typing on a template

#

because i am that one patrick gif

upper dagger
upper dagger
violet pivot
#

Do you have the correct folder structure?

upper dagger
violet pivot
#

where do you have the weapons folder?

#

in your addon

upper dagger
#

gtg

violet pivot
#

it must be like this garrysmod\addons\youraddonname\lua\weapons

viral wasp
#

also the problem is that you forgot to put the function keyword when defining the SWEP:Reload() function

#

when you have a lua problem like this you should also check your console or problems menu for errors

#

because most of the time an error will appear there telling you where the issue in your code is

upper dagger
#

this is correct right?

viral wasp
upper dagger
#

lets see if it works now :3

upper dagger
viral wasp
#

you might need to

upper dagger
viral wasp
#

does the problems menu say anything

upper dagger
#

oh

#

it does

#

whatevfer this means

viral wasp
upper dagger
#

didnt save the lua lol

viral wasp
#

o lol

upper dagger
#

like this right?

viral wasp
#

does it work

upper dagger
#

ok so its working but if you ignore the big ass of my pm, you may knotice the BLYATTTTTT sign

#

i can fix it easy

#

ok now it fixed but not rlly

#

camera between loona thighs!11!11!

#

which isnt good

#

i should be there, not the thighs

#

also the hands should be as if its holding the camera item

#

not the pistol

#

also it seems to have a very high fire rate

#

also lowkey whenever i try to take a picture of my family they get mowed down by bullets 🙁

viral wasp
#

lol

viral wasp
upper dagger
#

idk

upper dagger
#

not a gun

#

that acts the same as the camera item

rose cove
upper dagger
#

lowkey

#

am i being stupid again

upper dagger
#

uhgh 🙁

upper dagger
viral wasp
#

?

upper dagger
upper dagger
upper dagger
viral wasp
upper dagger
#

like this?

#

my camera gun whatever it it at this stage is rlly quiet like fahhhh as if the sound isnt loading still

viral wasp
#

so is it not playing or is it really quiet

upper dagger
#

its not playing

viral wasp
#

is there anything in console when it tries to play

upper dagger
#

il check again

upper dagger
#

no lua errors

#

genuinely idk what im doing wrong vro

viral wasp
upper dagger
#

oh mh god

viral wasp
#

and see if that plays it

upper dagger
#

I SPELT IT WRONG

viral wasp
#

oh

upper dagger
#

nah im so stupid bro sorry

viral wasp
upper dagger
#

if that was the problem ima go crazy

#

it was

#

thx for making me realise

#

could you look in the lua and look at what controlls the trype of projectile and the fire rate?

#

i just want 1 click = 1 picture not 1 clock = 10 round burst of 9mm

viral wasp
#

you control what happens when you left click with the PrimaryAttack function

#

it fires bullets because of the FireBullets function being used in there

upper dagger
#

what do i need to change?

viral wasp
upper dagger
#

sorry for being rlly annoinggg

#

you have been alot of help so far

rose cove
upper dagger
#

i got chatgpt to help me out lowkey

#

it can take pictures now

#

but lowkey uhh the camera model is between the pms legs

#

an also it looks like the pm is holding a pistol, not a camera

#

lowkey all these ppl saying 1 thing and the dissapearing making me bug out

#

its inside him

violet pivot
#

😭 bro

#

what the fuck is that furry model

#

🥀

upper dagger
upper dagger
#

lowk ur blind

violet pivot
#

looks like you got the weapon swep working tho

upper dagger
violet pivot
upper dagger
violet pivot
upper dagger
#

yea

violet pivot
#

Check the rest of your code if you dont change that somewhere

#

like on picture taken

#

or smthing like that

upper dagger
#

wanna look at my lua?

violet pivot
#

eh sure

#

why not

upper dagger
#

part of it is moded by chatgpt

#

thats how i got it to actually take a picture

violet pivot
#

when you do that here basically : function SWEP:Initialize()
self:SetHoldType("camera")
end

violet pivot
#

But i think the main issue is with the model

upper dagger
#

its not apearing in my game anymore

violet pivot
#

thats weird but the main issue is with the model because if you use: models/maxofs2d/camera.mdl

#

it looks as it should

#

by that i mean it appears in his hands

upper dagger
upper dagger
#

viewmodel etc

violet pivot
# upper dagger should it be v_camera.mdl instead?

Usually yeah for example the smg looks like this in the lua code: SWEP.ViewModel = Model( "models/weapons/c_smg1.mdl" )
SWEP.WorldModel = Model( "models/weapons/w_smg1.mdl" ) but the camera is a w_model just not named like so

upper dagger
#

do i need to rename all of these with a w_ at the beggining or do i need to do only the .mdl file

violet pivot
#

basically this is how it looks if you use it ingame like so:

violet pivot
upper dagger
violet pivot
upper dagger
#

compiler thing

violet pivot
#

because the mistake was made in the making of the model

#

there is no issue with the code

#

that would like cause this

upper dagger
#

ok so whats the issue

#

cuz lowkey im tweaking

#

i didd everything fine. it appears ingame as a phys prop

violet pivot
#

The issue is with where the model’s origin is located in Blender

#

most likely

violet pivot
#

but since you are trying to put it into players hand

#

like an swep

upper dagger
#

of everything

#

leme boot up blender

violet pivot
#

then the issue is in compiling

#

Might want to ask in modelling if that doesnt solve it / you cant find the issue

violet pivot
#

like where the camera is

#

Did you manage to fix the SetHoldType?

#

because with this code it seems to be working for me

upper dagger
#

the code u send me broke the lua

#

and it didnt apear ingame

upper dagger
violet pivot
#

try throwing the lua code into here: Steam\steamapps\common\GarrysMod\garrysmod\lua\weapons

upper dagger
#

gun.lua?

violet pivot
upper dagger
#

kk

violet pivot
#

so?

upper dagger
#

ur one works

violet pivot
upper dagger
#

ight

violet pivot
#

SWEP.ViewModel = "models/maxofs2d/camera.mdl"
SWEP.WorldModel = "models/maxofs2d/camera.mdl"

#

replace here

upper dagger
#

kk

violet pivot
#

okay the next issue could be this: function SWEP:DrawWorldModel()
local owner = self:GetOwner()

if IsValid(owner) then
    local bone = owner:LookupBone("ValveBiped.Bip01_R_Hand")
    if not bone then return end

    local pos, ang = owner:GetBonePosition(bone)

    -- BEGIN CAMERA-LIKE OFFSETS (tuned for handheld cameras)
    ang:RotateAroundAxis(ang:Right(), 90)     -- rotate to face forward
    ang:RotateAroundAxis(ang:Up(), 10)        -- small correction
    ang:RotateAroundAxis(ang:Forward(), 180)  -- upside-down fix

    pos = pos + ang:Forward() * 4
    pos = pos + ang:Right() * 1.5
    pos = pos + ang:Up() * -2
    -- END OFFSETS

    self:SetRenderOrigin(pos)
    self:SetRenderAngles(ang)
    self:DrawModel()
else
    self:DrawModel()
end

end

#

try removing that and see what it does

upper dagger
#

ight

violet pivot
#

okay then keep that and modify the values

#

in the code

#

until you get desired effect

#

i guess

upper dagger
#

ight

upper dagger
violet pivot
upper dagger
#

or do i have to edit lua - reopen game and wait foir it to load, test it and its not right- repeat

#

il aslk in dev general

violet pivot
#

you dont have to

#

just rejoin the game

upper dagger
violet pivot
upper dagger
#

i was just reopening it

violet pivot
#

you can just type retry into console