Hello people. After two or three years of GLua coding, I finally decided to make a SWEP. But I need help handling animations. The view model animations work, but in 3rd person, the player has the weaponless animation running and the weapon is in his hand. Any ideas where to start?
Should this be client side or server side? Cause i have already tried SetWeaponHoldType, it says it doesn't exist on the client and it does nothing on the server..
Also lol at the sarcastic ratings. not everyone started making SWEPs, I started with whole gamemodes.
[QUOTE=KatNotDinner;40548096]Should this be client side or server side? Cause i have already tried SetWeaponHoldType, it says it doesn't exist on the client and it does nothing on the server..
Also lol at the sarcastic ratings. not everyone started making SWEPs, I started with whole gamemodes.[/QUOTE]
Gamemodes without SWEPs?
But functions are shared and must be called on both client and server to work both in multi- and singleplayer.
Curious, what gamemodes have you made exactly?
Well most of them are unfinshed. I made a soccer gamemode for example. Never ealeased it though cause a weird bug appeared (I can give you a picture if you want).
I asked many people about the bug, no one could give me an answer, nor i had explanation, since everyone confirmed that the code should work.
I've also had a side project for a year now, that I occasionally add stuff to. It's a gamemode base. When I get a new idea, I implent it.
I also made a deathrun gamemode for a guy, who said he'd buy it. I made, uh, a placeholder menu, just to show the guy everything worked. Never heard from the guy so I left the gamemode like that.
I have made some other gamemodes to learn using certain things, like Derma for example, or making my first HUD. The problem is I'm the kind of person who often leaves stuff half finished, trying to improve though.
@Robotboy yes, gamemodes without SWEPs. Since when sweps became something a gamemode must have anyway? I think SENTs are a lot more important (well both depend on the nature of the gamemode).
And can someone please explain to me what's so funny about not being able to make SWEPs after two years?
I never found SWEps interesting, that's why I never bothered making any (except on some occasions like that soccer gamemode).
I'm not seeking attention, that's why I never release my work. I do it all for the experience I gain. I don't even always take screenshots.
Can we stay on-topic now? Sorry if the post sounds like a biography.
A great place to start is by looking at the source code to things that are similar to what you want.
[url]http://www.garrysmod.org/downloads/?tag=SWEPs[/url]
or the workshop + a GMA extractor
self:SetWeaponHoldType("some type") - MUST be called both sides,
e.g.
[PHP]
function SWEP:Initialize()
self:SetWeaponHoldType("pistol")
end
[/PHP]
SWEP:Primary/SecondaryAttack() - server side function, u can't use SetWeaponHoldType in it/
sorry for me Eng :)
@Mitsudigi That's what I am doing actually, but it doesn't work.
@Koji6ac9H Shouldn't SWEP.HoldType do the same as SWEP:SetWeaponHoldType()? Do I need to "use" both?
[QUOTE=KatNotDinner;40559655]
@Koji6ac9H Shouldn't SWEP.HoldType do the same as SWEP:SetWeaponHoldType()? Do I need to "use" both?[/QUOTE]
No. SWEP.HoldType is not a system variable for SWEPs. Usually for a SWEP base you do SWEP.HoldType = "pistol" and then in SWEP:Initialize you put self:SetWeaponHoldType( self.HoldType ) so children weapons don't have to override the Initialize function.
You've probably made SWEP:Initialize(). If you do this, you have to be sure that you add self:SetHoldType(self.HoldType) in your new initialize hook. If you don't, you'll get the "normal" holdtype by default.
You can also change holdtypes by putting self:SetHoldType("TYPE") wherever you want, but it's usually best to just put it into SWEP:Intitialize().
Thanks a lot guys, everything worked. The wiki documentation confused me a little with the DoPlayerAtackAnimations sort of things. Can a mod please lock/delete this thread?
Sorry, you need to Log In to post a reply to this thread.