[QUOTE=r0uge;47477800]Gonna ask this again since I never got a reply but I would like to report the issue somewhere -
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/sound/PlayURL]sound.PlayURL[/url] doesn't work quite as it should.
Who can I report the issue to?[/QUOTE]
this thread [URL="http://facepunch.com/showthread.php?t=1450721"]Next update[/URL] is where people discuss issues and changes, try reporting it here, also there are links to things in the op.
[QUOTE=Lixquid;47481484]It seems really unlikely this is what you're asking for, but are you just asking how to get the angles of where a player's looking? ([img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetAngles]Entity:GetAngles[/url])
If not, you can get the angles of a vector with :Angle. ([img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Vector/Angle]Vector:Angle[/url])
Again, if this doesn't help, please explain further what you're trying to do, it's still a bit unclear.[/QUOTE]
Player:GetAngles() seems to be returning 0,0,0. I'll try Vector:Angle().
[QUOTE=James xX;47481600]Player:GetAngles() seems to be returning 0,0,0. I'll try Vector:Angle().[/QUOTE]
Oops, my bad. You need [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/EyeAngles]Entity:EyeAngles[/url].
[IMG]http://i.imgur.com/uy4V9eX.png[/IMG]
[lua]
MountedAlarm:SetPos( ent:GetPos() )
MountedAlarm:SetAngles( ent:GetAngles():RotateAroundAxis(ent:GetAngles():Right(),90 )
[/lua]
would give out an error saying SetAngles expects an angle and got nil. How do I rotate this correctly?
If you all were designing a rank/usergroup system and had to define hierarchy (like normal < VIP < admin, etc), how would you define those ranks? For example, currently, I have 0 for owner, 1 for super, 2 for admin, 3 for user. That way I can check if rank <= X and see if they have access. Rank in the database is just stored as a TINYINT and that's it.
Does anyone have any other ideas?
(It's more of a design concept question than a "how do I do this?".)
[sp]I swear to god, if someone says ULX...[/sp]
I would set the immunity manually like Evolve does, then check whether a player's group has an immunity above the target player's group.
[QUOTE=RedNinja;47482123][IMG]http://i.imgur.com/uy4V9eX.png[/IMG]
[lua]
MountedAlarm:SetPos( ent:GetPos() )
MountedAlarm:SetAngles( ent:GetAngles():RotateAroundAxis(ent:GetAngles():Right(),90 )
[/lua]
would give out an error saying SetAngles expects an angle and got nil. How do I rotate this correctly?[/QUOTE]
For a start, what's ent? Is it guaranteed to exist?
Second, copy and paste the code, don't type it, because that'll syntax error before it run-time errors.
We can't debug code if it's not the same code that threw the error.
[QUOTE=Mors Quaedam;47482146]I would set the immunity manually like Evolve does, then check whether a player's group has an immunity above the target player's group.[/QUOTE]
I guess that's essentially what I have now, just inverted because who knows why. I don't really need varying levels of immunity per player.
[QUOTE=RedNinja;47482123][IMG]http://i.imgur.com/uy4V9eX.png[/IMG]
[lua]
MountedAlarm:SetPos( ent:GetPos() )
MountedAlarm:SetAngles( ent:GetAngles():RotateAroundAxis(ent:GetAngles():Right(),90 )
[/lua]
would give out an error saying SetAngles expects an angle and got nil. How do I rotate this correctly?[/QUOTE]
RotateAroundAxis does not return anything.
[lua]
MountedAlarm:SetPos( ent:GetPos() )
local ang = ent:GetAngles();
ang:RotateAroundAxis(ent:GetAngles():Right(),90);
MountedAlarm:SetAngles(ang)
[/lua]
Also your snippet is missing a closing parenthesis.
[QUOTE=RedNinja;47482123][IMG]http://i.imgur.com/uy4V9eX.png[/IMG]
[lua]
MountedAlarm:SetPos( ent:GetPos() )
MountedAlarm:SetAngles( ent:GetAngles():RotateAroundAxis(ent:GetAngles():Right(),90 )
[/lua]
would give out an error saying SetAngles expects an angle and got nil. How do I rotate this correctly?[/QUOTE]
RotateAroundAxis doesn't return an object, it modifies the meta object calling the function.
Correct usage is:
local ang = ent:GetAngles()
ang:RotateAroundAxis( ent:GetRight(), 90 )
ent:SetAngles( ang )
I have a 3D2D text that draws a word on an entity. I'm having a problem with the visibility of the actual text though. I'm trying to make the text small, I've seen this done before many times but I must not be doing something right. I want the text to be small, like really small. However, if I do any font size under about ~5, the font just becomes unreadable. I've tried messing with weight, antialias, etc and I can't get anything to work. Any help would be awesome at this point.
Here is what I'm working with.
[CODE]surface.CreateFont("custom_font", {
font = "Trebuchet18",
size = 2,
weight = 400,
antialias = true,
outline = false,
})
function ENT:Draw()
self:DrawModel()
cam.Start3D2D(self:LocalToWorld( Vector(-17,38.5,40) ), self:LocalToWorldAngles( Angle(90,0,0) ), 1)
draw.RoundedBox(0, 5, 13, 15, 52, Color(0,0,0,200))
draw.SimpleText("This is my text", "custom_font", 0, 0, Color(255,255,255,255), TEXT_ALIGN_CENTER)
cam.End3D2D()
end[/CODE]
First time messing with both entities and 3D2D, so I'm probably doing a few things wrong. Any criticism is appreciated. Here's an image.
[IMG]http://i.imgur.com/79IPJSX.jpg[/IMG]
Make the actual font larger, and lower the scale of your 3D2D
Does anyone know how the clientside rotation on prophunt works? I want to disable it for my own system but I have no idea where to look.
[QUOTE=Fantym420;47481543]this thread [URL="http://facepunch.com/showthread.php?t=1450721"]Next update[/URL] is where people discuss issues and changes, try reporting it here, also there are links to things in the op.[/QUOTE]
It's not a Lua issue...
[QUOTE=r0uge;47483410]It's not a Lua issue...[/QUOTE]
Garry's Mod also has C++, if you didn't know. And, please explain the problem, because I can assure you there's nothing wrong with sound.PlayURL itself.
I'm working on a gamemode and I'm using the default GMod playermodels. I would like to change the playermodel color, but looks like it can only be done using the command cl_playercolor, which is a Sandbox-exclusive command.
I'm looking in the editor_player.init file from the Sandbox gamemode but I can't figure out how to emulate that functionality using LUA.
Do you people know a way to change playermodel colors outside Sandbox? Any ":SetModelColor()" kind of thing that I didn't found?
I'm using the Combine Elite Soldier playermodel, for reference (I know that one's colors are editable in sandbox).
Okay, [URL="http://wiki.garrysmod.com/page/Player/SetPlayerColor"]problem solved[/URL].
Trying to add functionality for combine cameras in HL2RP to take pictures of criminals;
Is there a way to use render.Capture from a specified vector and angle? I know you can do x and y offsets in the capture structure but there's nothing about angles, obviously.
So recently Ive been asking a lot of people who I know are good with lua how to make clients change error playermodels to a model of my choice.
Zero The Fallen responded with this
[lua]
----Minmodels *FIX THIS* brokes
addVar("minmodels", 0, "Enable/Disable minmodels.", {t = "Boolean"})
addVar("minmodels_model", "models/player/kleiner.mdl", "Model for minmodels.", {t = "Generic"})
---Precache
local mpc = function()
local ppt = {}
return function(model)
if (!ppt[model]) then
print("precaching", model)
ppt[model] = true
util.PrecacheModel(model)
end
end
end
mpc = mpc()
---GetModel (For Gamemode overriding.)
function Player:GetMinModel()
return getVar("minmodels_model")
end
---Minmodel main.
local function minmodels()
if (!getVarBool("minmodels")) then
return
end
for _, p in pairs(player.GetAll()) do
local model = p:GetMinModel()
if (p:GetModel() != model) then
mpc(model)
p:SetModel(model)
end
end
end
hook.add("Think", "minmodels", minmodels)
//notes for faggots trying to read this. a bunch of functions (such as addvar and mpc getvar) are fromy a diff file. just use
//GetConVarString or whatever else. if you know lua, you should understand what Im doing.
// issue is the models dont animate. Once you set them, they no longer update, as if they've left your PVS. /shrug
[/lua]
The problem is that after the first basically frame. The animations wont run at all so the people do not know what to shoot at really
Any suggestions? or possible issues with the code
[QUOTE=AnonTakesOver;47480546]what are the benefits of writing c++ modules?[/QUOTE]
It's mostly used for doing things that aren't possible in Lua, to bypass restrictions Garry has put in place, or to add/fix things under the hood. Before the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/CheckPassword]GM/CheckPassword[/url] hook, there was a module made to get the same effect, [URL="http://facepunch.com/showthread.php?t=695636"]gmsv_gatekeeper[/URL].
What's the best way to network spread between clients?
Hey guys, I don't really have a problem, but just wondering your opinion about something.
What would be the most efficient way of drawing a laser beam from someones gun, and obviously broadcasting it to everyone in-game.
Should i just broadcast it to everyone, and then with the ply variable, get the players attachment? (ply:GetViewModel():LookupAttachment("muzzle"))
[QUOTE=tzahush;47488657]Hey guys, I don't really have a problem, but just wondering your opinion about something.
What would be the most efficient way of drawing a laser beam from someones gun, and obviously broadcasting it to everyone in-game.
Should i just broadcast it to everyone, and then with the ply variable, get the players attachment? (ply:GetViewModel():LookupAttachment("muzzle"))[/QUOTE]
Broadcast it to everyone, and use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/render/DrawBeam]render.DrawBeam[/url]
[QUOTE=tzahush;47488657]Hey guys, I don't really have a problem, but just wondering your opinion about something.
What would be the most efficient way of drawing a laser beam from someones gun, and obviously broadcasting it to everyone in-game.
Should i just broadcast it to everyone, and then with the ply variable, get the players attachment? (ply:GetViewModel():LookupAttachment("muzzle"))[/QUOTE]
Using Lua effects is the easiest way of doing this.
[QUOTE=wauterboi;47487588]What's the best way to network spread between clients?[/QUOTE]
You could have a serverside var and a separate clientside set of variables, like I do in my base. As long as its the same code with different variable names and not FPS dependent, it should be great.
How do I pack entities in my gamemode? I've tried addons/addonname/entities/entities/entname/shared.lua and addons/addonname/gamemodes/gmname/entities/entities/entname/shared.lua to no avail
entname.lua in gamemode/entities/entities/
no shared file and entname doesn't have its own folder.
[QUOTE=AnonTakesOver;47490649]entname.lua in gamemode/entities/entities/
no shared file and entname doesn't have its own folder.[/QUOTE]
Any info on whether that is the preferred/recommended way at all? I've always used a folder with the entity name, and separate init/cl_init/shared files.
[QUOTE=wh1t3rabbit;47491253]Any info on whether that is the preferred/recommended way at all? I've always used a folder with the entity name, and separate init/cl_init/shared files.[/QUOTE]
You can do either afaik. The shared file wont be automatically loaded, only init.lua and cl_init.lua. You have to load shared from those.
Basically, if your entity is simple/small and can fit nicely into one file then use the file. If it's a big/complicated one use the folder method to keep your code better organised.
How can I get if someone is in a certain steam group?
[QUOTE=LUModder;47492060]How can I get if someone is in a certain steam group?[/QUOTE]
I use furryfinder for this, much simpler than pure lua implementations.
[url]http://facepunch.com/showthread.php?t=996309[/url]
If you want a lua-only implementation, someone has made it on here before.. you'll have to search for it though.
Sorry, you need to Log In to post a reply to this thread.