[b]!!!!SOLVED!!!![/b]
Okay, so I'm trying to learn a bit of LUA here by taking a toybox SWEP and changing it into an addon. (Not for public release because that's just silly)
SWEP in question: [url]http://toybox.garrysmod.com/ingame/?view=536&tab=details[/url]
And binding it with this veiwmodel from this SWEP: [url]http://www.garrysmod.org/downloads/?a=view&id=69622[/url]
My issue is... Well...
[img]http://filesmelt.com/dl/wattt2.png[/img]
Pretty self explanatory. Fucking penis rifle. I want the hold type to be "shotgun" but it seems that isn't working and keeps reverting back to a pistol hold type.
No LUA errors.
Here is the (severely butchered) code; I know it looks like a wreck but I have no idea what I'm doing here. Which is why I come here for help.
-LUA SNIP-
Yeah it's terrible. I do understand a FEW things that's going on in the code which is how I got that far, and everything operates JUST fine except for the weird ass world model positioning. I don't want a penis rifle.
[editline]3rd December 2010[/editline]
Solved. Thanks for your help everyone.
Texture problem isn't codes problem, it's missing the materials.
Well, never mind about that, a friend and I just fixed the texture problem.
I'll edit the OP with the current problem...
[editline]3rd December 2010[/editline]
OP edited.
The holdtype needs to be shared, and you get crotch gun because the weapon doesn't have the proper attachment.
Dag nabbit, that's what I feared. I guess I'll just have to set a placeholder for the world model then... Because I don't know where to start on putting the proper attachment.
Thank you.
[code]
SWEP.Offset = {
Pos = {
Up = 0,
Right = 0,
Forward = 0,
},
Ang = {
Up = 0,
Right = 0,
Forward = 0,
}
}
function SWEP:DrawWorldModel( )
local hand, offset
if not ValidEntity( self.Owner ) then
self:DrawModel( )
return
end
if not self.Hand then
self.Hand = self.Owner:LookupAttachment( "anim_attachment_rh" )
end
hand = self.Owner:GetAttachment( self.Hand )
if not hand then
self:DrawModel( )
return
end
offset = hand.Ang:Right( ) * self.Offset.Pos.Right + hand.Ang:Forward( ) * self.Offset.Pos.Forward + hand.Ang:Up( ) * self.Offset.Pos.Up
hand.Ang:RotateAroundAxis( hand.Ang:Right( ), self.Offset.Ang.Right )
hand.Ang:RotateAroundAxis( hand.Ang:Forward( ), self.Offset.Ang.Forward )
hand.Ang:RotateAroundAxis( hand.Ang:Up( ), self.Offset.Ang.Up )
self:SetRenderOrigin( hand.Pos + offset )
self:SetRenderAngles( hand.Ang )
self:DrawModel( )
end
[/code]
Should probably put this in a tutorial on the wiki since this is probably the third or fourth time I've used a code snippet like this.
[QUOTE=SuperDuperScoot;26460670]blahblahblah[/QUOTE]
Dude... THE FUCK ARE YOU DOING WITH MY SWEP?
I could understand if you asked permission. BUT YOU DIDN'T!
I spent five fucking days perfecting this swep and you JUST FUCKING COPIED MY CODE!
You have cut credits commentary to get extra safety, huh?
I don't have my steam profile set on FP. If you don't trust that I made this SWEP, see author page through the toybox, add me through steam and we'll have a chat.
Calm down, She didn't know.
[QUOTE=krassell;26464539]Dude... THE FUCK ARE YOU DOING WITH MY SWEP?
I could understand if you asked permission. BUT YOU DIDN'T!
I spent five fucking days perfecting this swep and you JUST FUCKING COPIED MY CODE!
You have cut credits commentary to get extra safety, huh?
I don't have my steam profile set on FP. If you don't trust that I made this SWEP, see author page through the toybox, add me through steam and we'll have a chat.[/QUOTE]
So what? if he wants to start learning lua by converting a toybox swep into addon format, then whats the big deal -.-, I learned lua coding not by reading the pil, or the tutorial series on the wiki, but by looking at admin files and extracting code such as enabling god mode, setting players on fire, etc. I never released anything I made from extracted code, and he says he won't either, so why is there a need for credits?
[QUOTE=krassell;26464539]Dude... THE FUCK ARE YOU DOING WITH MY SWEP?
I could understand if you asked permission. BUT YOU DIDN'T!
I spent five fucking days perfecting this swep and you JUST FUCKING COPIED MY CODE!
You have cut credits commentary to get extra safety, huh?
I don't have my steam profile set on FP. If you don't trust that I made this SWEP, see author page through the toybox, add me through steam and we'll have a chat.[/QUOTE]
I think you didn't read the entire post. The OP said they were doing this for their own private use and does not intend to release it.
[QUOTE=SuperDuperScoot;26460670]Penis Swep[/QUOTE]
[url]http://wiki.garrysmod.com/?title=Weapon.SetWeaponHoldType[/url]
The list of HoldTypes are at the bottom.
You'd have to use CS_Base for counter-strike weapons.
[QUOTE=Cubar;26466307][url]http://wiki.garrysmod.com/?title=Weapon.SetWeaponHoldType[/url]
The list of HoldTypes are at the bottom.
You'd have to use CS_Base for counter-strike weapons.[/QUOTE]
Nope, the way it actually works is the weapon model is bone merged with the player. The world model OP's trying to use doesn't have any bones that can merge with the player's model. You need to either use models that can merge with it ( which if it was a CSS weapon, would be the CSS player models [ not the ones in gmod ] ), or manually position it like in the code I posted.
[QUOTE=Kogitsune;26466874]Nope, the way it actually works is the weapon model is bone merged with the player. The world model OP's trying to use doesn't have any bones that can merge with the player's model. You need to either use models that can merge with it ( which if it was a CSS weapon, would be the CSS player models [ not the ones in gmod ] ), or manually position it like in the code I posted.[/QUOTE]
Nope i did it with an M4A1 and it places it there by default.
[QUOTE=krassell;26464539]Dude... THE FUCK ARE YOU DOING WITH MY SWEP?
I could understand if you asked permission. BUT YOU DIDN'T!
I spent five fucking days perfecting this swep and you JUST FUCKING COPIED MY CODE!
You have cut credits commentary to get extra safety, huh?
I don't have my steam profile set on FP. If you don't trust that I made this SWEP, see author page through the toybox, add me through steam and we'll have a chat.[/QUOTE]
...
Uhh...
Okay...
Uhm, well first off, being polite as I can here... I'm sorry. I should've asked first anyways. I have a bad habbit of taking stuff and editing it without permission even though I never release it... (moreso talking E2 here)
I WAS thinking about asking a server owner/friend I know to put it on his server and just that one, (spacebuild) but I thought that would be a bad idea until I got it fixed & unless I asked you personally.
But basically this was just a learning experience for me.
Take it as a compliment; that I picked your swep out of all others because I admired your work and I wanted to be able to use the gun without having to go through the toybox all the time because it takes so long to load for me sometimes. I also found the rifle while browsing "gauss" (or something else relating I forgot) on Gmod.org to see if there was an addon version of your swep. So I thought "hey, I could probably mash those two together and create something cool looking! It'd be a nice learning experience and would be a nice Space Build swep... Then again, I should ask the creator(s) before ever making it public."
... Here, have a heart.
P.S.
That code snippet worked like a charm.
I appreciate it!
P.P.S.
I removed that big block of stuff at the top of the code because it was messing with me. I didn't intend to remove it for "security" or anything.
[QUOTE=Kogitsune;26465691]I think you didn't read the entire post. The OP said they were doing this for their own private use and does not intend to release it.[/QUOTE]
Since what times you are allowed to use another's people code without permission? Also she did just posted the whole code, that's already not private use. Anyone can copy swep with cut author message. You know, actually there's small
[lua]
--[[
Hl1 Gauss SWEP by:
Xen0morph aka krassell
___ ___ _________
\ \ / / / _____ \
\ \ / / | / /\ |
\ V / ________ ___ ___ | | / | |
| | \ __ / \ __ \ | | / | |
/ A \ | ____\ | | | / | | / | |
/ / \ \ | |_____ | | | | | \/____/ |
/__/ \__\ /______/ /_\ /_\ \_________/
]]
[/lua]
before actual code. You know, released modified code + credit theft(she did reffer to original, of course, but ask yourself how exactly many people are going to see who's original author when they will copy code or something). That's why I am really damn angry now.
Also, I don't like people discussing over parts of my code. I mean entire code. Get your critic on gauss toybox comments page.
2OP: You can use my code in edicational purposes, but you cannot use any kind of code snippets or copy+paste stuff from my code. You are not allowed to modify that code or use it as base for your own. I know, this looks like EULA, but damn, that's my code and I decide what people do with it. And I don't like some random LUA newbies using my code.
If you want to learn lua - try messing with somewhat simpler sweps. Make aimbot(It allowed me to learn very basics of lua clientside stuff actually), but for gods sake don't release it. If you wanna use my code to educate yourself - you're crazy. I don't even remember what half of functions do and do I really need them.
[QUOTE=SuperDuperScoot;26467988]...
Uhh...
Okay...
Uhm, well first off, being polite as I can here... I'm sorry. I should've asked first anyways. I have a bad habbit of taking stuff and editing it without permission even though I never release it... (moreso talking E2 here)
I WAS thinking about asking a server owner/friend I know to put it on his server and just that one, (spacebuild) but I thought that would be a bad idea until I got it fixed & unless I asked you personally.
But basically this was just a learning experience for me.
Take it as a compliment; that I picked your swep out of all others because I admired your work and I wanted to be able to use the gun without having to go through the toybox all the time because it takes so long to load for me sometimes. I also found the rifle while browsing "gauss" (or something else relating I forgot) on Gmod.org to see if there was an addon version of your swep. So I thought "hey, I could probably mash those two together and create something cool looking! It'd be a nice learning experience and would be a nice Space Build swep... Then again, I should ask the creator(s) before ever making it public."
... Here, have a heart.
P.S.
That code snippet worked like a charm.
I appreciate it!
P.P.S.
I removed that big block of stuff at the top of the code because it was messing with me. I didn't intend to remove it for "security" or anything.[/QUOTE]
Thanks for the compliment. :D
I get your point now. Excuse me for being outrageous - I _HATE_ when people touch my work w/o permission.
So you wanna learn from my code. Okay.
Contact me on steam if you need help decrypting my code/permission.
I'm half tempted to just snip the entire thing out of my post, delete the addon and forget the time I tried fixing this.
I only feel like a douchebag now.
[editline]3rd December 2010[/editline]
Nvm, it's all sorted out, everythings good. Thread closed, mod can delete/lock this now.
Hey Krassell breh, idk if you realize it but if SuperDuperScoot can get the code then anyone can get the code.
Hell if i wanted to i'd run down there, grab that code, steal that texture, put a big cock drawing on everything, and just jizz on it like a dog who humps every leg that wears tight navy blue jeans.
Just keep your trap shut, OP said it is for private use.
Had to put the above there so SuperDuperScoot wont be brought down by a selfish person who regrets what they say later.
Sorry, you need to Log In to post a reply to this thread.