• Problems and Questions about "Entity:SetGravity"
    3 replies, posted
Wiki link to this piece of code: [url]http://wiki.garrysmod.com/page/Entity/SetGravity[/url] Problem. Whenever I use the code for "Entity:SetGravity" it says I need a ) after "gravityMultiplier" To be precise, here is the error in the console (It is both a server and client error) addons/spacemanswep/lua/weapons/weapon_spaceman.lua:25: ')' expected near 'gravityMultiplier' And here is my current code which has a ) after the gravityMultiplier function SWEP:PrimaryAttack() Entity:SetGravity( 0 gravityMultiplier) ) self:EmitSound( trigger ) end function SWEP:SecondaryAttack() Entity:SetGravity( 600 gravityMultiplier ) self:EmitSound( trigger ) end Question: Entity:SetGravity shows up on the wiki, but Player:SetGravity isn't. Could it work? THANKS! :D
[QUOTE=sellers53;50341511]Wiki link to this piece of code: [url]http://wiki.garrysmod.com/page/Entity/SetGravity[/url] Problem. Whenever I use the code for "Entity:SetGravity" it says I need a ) after "gravityMultiplier" To be precise, here is the error in the console (It is both a server and client error) addons/spacemanswep/lua/weapons/weapon_spaceman.lua:25: ')' expected near 'gravityMultiplier' And here is my current code which has a ) after the gravityMultiplier function SWEP:PrimaryAttack() Entity:SetGravity( 0 gravityMultiplier) ) self:EmitSound( trigger ) end function SWEP:SecondaryAttack() Entity:SetGravity( 600 gravityMultiplier ) self:EmitSound( trigger ) end Question: Entity:SetGravity shows up on the wiki, but Player:SetGravity isn't. Could it work? THANKS! :D[/QUOTE] Your reading the wiki wrong... It's saying that it takes the gravity multiplier in number form so it just takes a number not the text... Like 1 or 2 or default 600 (I think) [editline]17th May 2016[/editline] Also players Gravity is defined by a convar I believe so look into that
[QUOTE]Your reading the wiki wrong... It's saying that it takes the gravity multiplier in number form so it just takes a number not the text... Like 1 or 2 or default 600 (I think) Edited: Also players Gravity is defined by a convar I believe so look into that[/QUOTE] I knew I would feel like an idiot after posting this. Eh, that's most forums anyway. I'll keep it open in case somebody finds an answer to the question.
Closing a thread doesn't delete it, so you could close this thread if you want (sorry to bump it again when the answer's already been given)
Sorry, you need to Log In to post a reply to this thread.