Get gmod lua syntax highlighter, it will light up correct syntax:![]()
Get gmod lua syntax highlighter, it will light up correct syntax:![]()
That only works for GMod functions/variables, his problem was he mistyped his own variable "Colors" (not the GMod object Color) with an incorrect case, which a syntax highlighter wouldn't pick up.
Sorry, my mistake.
ok so as far as errors go, their fixed but as for displaying thats another thing. Oh also Jinx I already have the highlighter
I'm trying to set the client's camera position however it doesn't seem to be working.
function PlayerSpawn( ply ) orig = ply:EyePos() ply:EyePos(orig + Vector(0,100,0)) end hook.Add("PlayerSpawn","PlayerSpawn",PlayerSpawn)
It doesn't do anything.
Bump
I cant seem to get this worked out, I'm playing around with the settings but it's confusing me.
What I'm wanting is the camera to be about 100 units or so away from the player facing the side of the player (Z Axis) Ill later then make it so the play can only walk on the X axis.
local Colors = { border = Color( 255, 255, 255, 255), background = Color( 255, 255, 255, 200 ), shade = Color( 255, 255, 255, 255 ), fill = Color( 0, 0, 0, 255 )-- , <- This comma does not belong. };
Use this.
Thank you :) Also, this has worked for me:
local view = {} view.origin = pos-(angles:Right()*-300) view.angles = angles + Angle(0,90,0) view.fov = fov return view
How would I go about locking the camera from moving? Basically rendering the mouse useless.
I'm not quite sure what you mean. Like disabling the ability to look around with the mouse?
Yes, the gamemode that I'm doing is based around the side view of a player, ill also need to somehow make A and D do what W and S do as the camera is beside the player (angled to face the player). I don't want people moving the camera as you can bug it out the world.
I am also working on a game mode where the camera is on auto with no player interaction, the way I've been locking the view is to set the player's eye angles every calcview run like this
ply:SetEyeAngles(view.angle)
I do this at the end of calcview and if the player moves the mouse it shakes the screen but it goes back to where it's supposed to look.
There is probably a better way to do this, and hopefully someone else can shed some light on the subject.
This is a piece of code taken from Ascension, with maybe slight differences:
function GM:CreateMove(cmd) if LocalPlayer():Alive() then gui.EnableScreenClicker(true) local mx,my = gui.MousePos() local pos = LocalPlayer():GetShootPos():ToScreen() pos = Vector(pos.x,pos.y,0) local ang = (Vector(mx,my,0)-pos):Angle() ang.p = ang.y ang:RotateAroundAxis(Vector(0,0,1),180) local move = cmd:GetSideMove() cmd:SetForwardMove(0) cmd:SetSideMove(0) if mx < pos.x then ang.y = 0 cmd:SetForwardMove(-move) else ang.y = 180 cmd:SetForwardMove(move) end cmd:SetViewAngles(ang) end end
It will take care of all the movement and camera related issues.
It doesn't break anything though, lua just ignores it just like it ignores semi colons.
Hello
local NoDrop = {"weapon_real_cs_scout", "weapon_real_cs_flash"} -- Drop blacklist local function DropWeapon(ply) local ent = ply:GetActiveWeapon() if not ValidEntity(ent) then return "" end
Im trying to add this scout sniper and the flashbang to NoDrop but it doesnt work, any idea whats wrong ?
has anyone done an sort of prop placing system? kinda like in RTS Games where when you select a building if there are no objects colliding with it and the terrain is flat it changes its colour to green/red i am triying to do someting similar but im kinda stuck showing it about a few metters away from the player Sight and well..Spawning/Creating the prop itself on the end point
I don't quite understand where you are stuck, but the way I would make something like this is set up some kind of a grid system for the map and then either setting how many squares a building takes up or using the collision bounds of that prop and then checking if these squares around the prop are already occupied or not. I could draw it in paint if you need me to clarify.
Is it possible to make a rope between a prop and a swep that is hold by a player?
My code:
function SWEP:PrimaryAttack() local ent = self:CreateTaser() local phys = ent:GetPhysicsObject() if not phys:IsValid() then return end phys:SetVelocity(self.Owner:GetAimVector() * 3000) -- Rope start local ent1, ent2 = ent, self local wPos1, wPos2 = ent1:GetPos(), ent2:GetPos() local length = (wPos1 - wPos2):Length() local constraint, rope = constraint.Rope(ent1, ent2, 0, 0, Vector(0,0,0), Vector(0,0,0), length, 1000, 0, 3, "cable/cable", false) -- Rope end end
However when I'm using "self.Owner" instead of "self" it's working, but the rope is parented to the player and not his weapon.
Ok first i am triying to do someting similar to This
Minute 0-07,0-10
As you can see the Buildings follows the player mouse and switches its colour if its placeable or not
Now what i want is that instead of doing an RTS View handle it trough the FPS View basicly put the "Building" a few metters away so far i have a trace and well i guess the end point of the trace is where i should "Spawn" or create the building entity Now i have to do the same trace Every frame and set the building/entity position to the Trace end location too? or theres a simplier way to do it?
Has anyone ever experienced this before?
The playermodel is turned 90 degrees for some reason, their gun and torso face 90 degrees away.
![]()
didn't you answer your own question?
Edited:
anyone have any idea why this happens or how to fix it? every vehicle I spawn does this :(
They were diffirent. The post in gmod11 thread was ClientsideModel facing to the corner. This one is with actual playermodels that players have.
This happens when they simply walk arround.
Bump
I had your same problem, it's because the player is standing there, the decal gets drawn onto the player not the floor, I couldn't think of a way of doing it so I just made it so there's 1 second timer before the decal is drawn, so if the player is moving it does leave a trail behind them. If they stand still for a while the problem persists though.
If anyone knows a proper way to do this I would also appreciate it.
Yes, putting the prop at your trace every frame, I think that's simple enough.
Edited:
Try resetting the pose parameters.
Wouldn't that be kind of weird. It's just a Player.SetModel. I don't know anyone who does that.
If I should do it then which function would I use?
function GM:Move(ply, movedata) movedata:SetForwardSpeed(0) movedata:SetSideSpeed(0) movedata:SetVelocity(novel) if SERVER then ply:SetGroundEntity(NULL) end local ball = ply:GetBall() if IsValid(ball) then movedata:SetOrigin(ball:GetPos()) end return true end local Player = FindMetaTable("Player") function Player:SetBall(ent) self:SetOwner(ent) end function Player:GetBall() return self:GetOwner() end
[gamemodes\nintendorr\gamemode\shared.lua:18] attempt to index local 'self' (a nil
value)(Hook: PlayerSpawn) Any help with this? please?
I don't see a PlayerSpawn hook in there.
How would I add a PlayerSpawn in there?
[gamemodes\nintendorr\gamemode\shared.lua:18] attempt to index local 'self' (a nilfunction GM:Move(ply, movedata) movedata:SetForwardSpeed(0) movedata:SetSideSpeed(0) movedata:SetVelocity(novel) if SERVER then ply:SetGroundEntity(NULL) end local ball = ply:GetBall() if IsValid(ball) then movedata:SetOrigin(ball:GetPos()) end return true end local Player = FindMetaTable("Player") function Player:SetBall(ent) self:SetOwner(ent) end function Player:GetBall() return self:GetOwner() end
value)(Hook: PlayerSpawn) self is not working, anything else I could use?
that isn't where the error is coming from man
Go to nintendorr\\gamemode\\shared.lua and the post the contents of the file
Oh hell, I'll post here.
Basically I'm trying to draw a rotating box using quads. The entity has a similar model, with collisions disabled, and its rotation is dictated serverside, where the quad drawing is (obviously) done client-side.
It all works fine, except that the top and bottom don't rotate. It appears that :GetAngles():Top() doesn't really change, like the Forward() and Right(). The result is this.
Anyone got any ideas on how I can make the top and bottom rotate with the rest of the box? I think I need to use RotateAroundAxis, but I don't know how to use that thing worth a damn. I've tried adding the Forward() or Right() to Up(), but that just makes it slanted, which isn't what I want.
Thanks in advance.
It sounds like RotateAroundAxis is what you want. It's a kinda weird function (or at least the outcome), from what I've seen of it, have you tried Forward/Right/Up with negative values as well?
I'm fairly new to LUA, and me and Pyth are making a Marble Blast gamemode; but of course we have no idea what we're doing.
Basically, we want the player on spawn to change model to:
and then be able to roll around with WASD, and jump. (Similar to melon racer)Code:models/XQM/Rails/gumball_1.mdl
How would we go about doing this? We're completely stumped.
Yeah, I figured I need to use RAA, but I just have no idea what to do. I was hoping someone here could point me in the right direction. I'll fuck around with it, and ask around. Hopefully I'll be able to get it.