[QUOTE=Willox;48392782]It was abusable so instead of being blocked from access via Lua it was removed :downs:.[/QUOTE]
D'oh, I almost wanna go edit the dynamic link libraries so I can get it back >_<
[QUOTE=#Sleepy;48392734]I wanna check if a car is owned by a player on DarkRP or not[/QUOTE]
[URL="http://wiki.darkrp.com/index.php/Functions/Entity/Shared/isKeysOwned"]http://wiki.darkrp.com/index.php/Functions/Entity/Shared/isKeysOwned[/URL]
How can I draw an image that I load from a URL? In 3d2d.
How could I set it so when people join my sandbox server they join with god mode enabled? So if they want to pvp they ungod mode? Thanks
[QUOTE=StrangerDang;48394453]How could I set it so when people join my sandbox server they join with god mode enabled? So if they want to pvp they ungod mode? Thanks[/QUOTE]
[URL="http://wiki.garrysmod.com/page/Player/GodEnable"]PLAYER:GodEnable()[/URL] to enable godmode.
[URL="http://wiki.garrysmod.com/page/Player/GodDisable"]PLAYER:GodDisable()[/URL] to disable godmode.
You can use [URL="http://wiki.garrysmod.com/page/Player/HasGodMode"]PLAYER:HasGodMode()[/URL] if you want.
[QUOTE=FireArrow133;48394496][URL="http://wiki.garrysmod.com/page/Player/GodEnable"]PLAYER:GodEnable()[/URL] to enable godmode.
[URL="http://wiki.garrysmod.com/page/Player/GodDisable"]PLAYER:GodDisable()[/URL] to disable godmode.
You can use [URL="http://wiki.garrysmod.com/page/Player/HasGodMode"]PLAYER:HasGodMode()[/URL] if you want.[/QUOTE]
Yes I understand this, I have something like this.
[CODE]
------------------------------ Build Mode ------------------------------
function ulx.build( calling_ply, target_plys, should_revoke )
if not target_plys[ 1 ]:IsValid() then
if not should_revoke then
Msg( "You are the console, you are already god.\n" )
else
Msg( "Your position of god is irrevocable; if you don't like it, leave the matrix.\n" )
end
return
end
local affected_plys = {}
for i=1, #target_plys do
local v = target_plys[ i ]
if ulx.getExclusive( v, calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
else
if not should_revoke then
v:GodEnable()
v.ULXHasGod = true
else
v:GodDisable()
v.ULXHasGod = nil
end
table.insert( affected_plys, v )
end
end
if not should_revoke then
ulx.fancyLogAdmin( calling_ply, "#A enabled build mode upon #T", affected_plys )
else
ulx.fancyLogAdmin( calling_ply, "#A disabled build mode from #T", affected_plys )
end
end
hook.Add( "PlayerInitialSpawn", "ulx.build", ulx.build ) -----------------------------------------------------------------------Added this----------------------------------------------
local build = ulx.command( CATEGORY_NAME, "ulx build", ulx.build, "!build" )
build:addParam{ type=ULib.cmds.PlayersArg, ULib.cmds.optional }
build:addParam{ type=ULib.cmds.BoolArg, invisible=true }
build:defaultAccess( ULib.ACCESS_ADMIN )
build:help( "Enables build mode." )
build:setOpposite( "ulx buildoff", {_, _, true}, "!buildoff" )
[/CODE]
You can see what I tried adding to make it work, but it looks like it hasn't. Once I get the godmode enabled when they join I will reword it to !pvp
Any suggestions to get this to work? Thanks
Thanks for your help.
You're invoking a function without the necessary variables. You can just do
[code]
hook.Add("PlayerInitialSpawn", "GodmodeEnableOnSpawn", function(ply)
ply:GodEnable()
end)[/code]
If you want to make it use the command, I can work something out.
[QUOTE=FireArrow133;48394841]You're invoking a function without the necessary variables. You can just do
[code]
hook.Add("PlayerInitialSpawn", "GodmodeEnableOnSpawn", function(ply)
ply:GodEnable()
end)[/code]
If you want to make it use the command, I can work something out.[/QUOTE]
Thanks, I don't really understand hooks, If you have a place for documentation on it that would really cool. Still having trouble loading godmode on spawn? Where should this hook.add be?
[QUOTE=StrangerDang;48394871]Thanks, I don't really understand hooks, If you have a place for documentation on it that would really cool. Still having trouble loading godmode on spawn? Where should this hook.add be?[/QUOTE]
Per usual, the Garry's Mod Wiki has great resources for developing addons for Garry's Mod. [URL="http://wiki.garrysmod.com/page/Hook_Library_Usage"]Here's a page describing how hooks work and how to use them.
[/URL]
EDIT: You should call hook.Add outside of the ulx.block function as it won't run unless !build is actually called
EDIT2: Whoops, managed to break link, fixed.
[QUOTE=FireArrow133;48394881]Per usual, the Garry's Mod Wiki has great resources for developing addons for Garry's Mod. Here's a page describing how hooks work and how to use them.
EDIT: You should call hook.Add outside of the ulx.block function as it won't run unless !build is actually called[/QUOTE]
Thanks, you are being extremely helpful, I know its hard to work with people like me. :D.
But I am still having trouble here. Heres my hook.Add function
[CODE]
hook.Add("PlayerInitialSpawn", "GodmodeEnableOnSpawn", function(ply)
ply:GodEnable()
ply:ULXHasGod = true
end )
[/CODE]
I have this placed right under my ulx.build function and the build:addparams
Any idea why this still isn't working?
Edit: Here is the whole thing.
[CODE]------------------------------ Build Mode ------------------------------
function ulx.build( calling_ply, target_plys, should_revoke )
if not target_plys[ 1 ]:IsValid() then
if not should_revoke then
Msg( "You are the console, you are already god.\n" )
else
Msg( "Your position of god is irrevocable; if you don't like it, leave the matrix.\n" )
end
return
end
local affected_plys = {}
for i=1, #target_plys do
local v = target_plys[ i ]
if ulx.getExclusive( v, calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
else
if not should_revoke then
v:GodEnable()
v.ULXHasGod = true
else
v:GodDisable()
v.ULXHasGod = nil
end
table.insert( affected_plys, v )
end
end
if not should_revoke then
ulx.fancyLogAdmin( calling_ply, "#A enabled build mode upon #T", affected_plys )
else
ulx.fancyLogAdmin( calling_ply, "#A disabled build mode from #T", affected_plys )
end
end
local build = ulx.command( CATEGORY_NAME, "ulx build", ulx.build, "!build" )
build:addParam{ type=ULib.cmds.PlayersArg, ULib.cmds.optional }
build:addParam{ type=ULib.cmds.BoolArg, invisible=true }
build:defaultAccess( ULib.ACCESS_ADMIN )
build:help( "Enables build mode." )
build:setOpposite( "ulx buildoff", {_, _, true}, "!buildoff" )
hook.Add("PlayerInitialSpawn", "GodmodeEnableOnSpawn", function(ply)
ply:GodEnable()
ply.ULXHasGod = true
end )[/CODE]
[QUOTE=StrangerDang;48394956]Thanks, you are being extremely helpful, I know its hard to work with people like me. :D.
But I am still having trouble here. Heres my hook.Add function
[CODE]
hook.Add("PlayerInitialSpawn", "GodmodeEnableOnSpawn", function(ply)
ply:GodEnable()
ply:ULXHasGod = true
end )
[/CODE]
I have this placed right under my ulx.build function and the build:addparams
Any idea why this still isn't working?[/QUOTE]
I have no problem clarifying issues for people. I have to ask people to clarify stuff they need, so I guess I can return the favor.
You're attempting to call ULXHasGod as a function instead of a variable. It should be "ply.ULXHasGod = true".
[QUOTE=FireArrow133;48394965]I have no problem clarifying issues for people. I have to ask people to clarify stuff they need, so I guess I can return the favor.
You're attempting to call ULXHasGod as a function instead of a variable. It should be "ply.ULXHasGod = true".[/QUOTE]
Oh shoot, that was a misstype, My edit above shows what I am using. Still not working though.
Here is my process to test.
I edit my file , restart gmod, make single player, fly up in the air drop down and take dmg, I do !build fly up take and take no fall dmg.
So if the hook.Add looks correct and I think I have it in the right place. Not sure what's going wrong here.
Shoot, this is stunning me.
Try replacing your hook with this
[code]hook.Add("PlayerInitialSpawn", "GodmodeEnableOnSpawn", function(ply)
ulx.build( nil, {ply}, false )
end )[/code]
[QUOTE=FireArrow133;48395025]Shoot, this is stunning me.
Try replacing your hook with this
[code]hook.Add("PlayerInitialSpawn", "GodmodeEnableOnSpawn", function(ply)
ulx.build( nil, {ply}, false )
end )[/code][/QUOTE]
I don't know man, I tried all these solutions and none of them are working. I even edited the command name to check if my edits were making it through and they are. For some reason this hook.add is being a pain. Thanks for your help but I don't know what to do next.
Edit: Btw this file is located at garrysmod\addons\ulx\lua\ulx\modules\sh\Stranger's_Modules.lua
[B][U]Edit2: Okay, so I determined the problem to be with PlayerInitialSpawn, If I do it as PlayerSpawn it works the first time I connect but it also works every time I die which is not what I want. So now that we determined the problem do you have any solutions?
[/U][/B]
Edit3: From Gmod Wiki: [QUOTE]Please note that this hook is called before the player has fully loaded. For example, trying to use the Entity:GetModel function will return the default model ("player/default.mdl") (It calls when the player is still seeing the 'Sending Client Info' screen)[/QUOTE]
I know it would be ugly but should I just put:
[CODE]
hook.Add( "PlayerSpawn", "GodmodeEnabledOnSpawn", function(ply)
if ply:Frags() == 0 and ply:Deaths() == 0 then
ply:GodEnable()
ply.ULXHasGod = true
end
end)
[/CODE]
Thanks again.
Okay, well I finished it up if anyone is interested or has any ideas for improvements. It will set a player to godmode when they join and can type !pvp to disable godmode and !build to enable god mode there after.
This module works pretty well with apples anti no clip killing addon that will block damage from someone who has godmode. Can be found here: [url]http://forums.ulyssesmod.net/index.php/topic,8112.html[/url]
[CODE]------------------------------ PvP Mode ------------------------------
function ulx.pvp( calling_ply, target_plys, should_revoke )
if not target_plys[ 1 ]:IsValid() then
if should_revoke then
Msg( "You are the console, you are already god.\n" )
else
Msg( "Your position of god is irrevocable; if you don't like it, leave the matrix.\n" )
end
return
end
local affected_plys = {}
for i=1, #target_plys do
local v = target_plys[ i ]
if ulx.getExclusive( v, calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
else
if should_revoke then
v:GodEnable()
v.ULXHasGod = true
else
v:GodDisable()
v.ULXHasGod = nil
end
table.insert( affected_plys, v )
end
end
if not should_revoke then
ulx.fancyLogAdmin( calling_ply, "#A enabled PvP mode upon #T", affected_plys )
else
ulx.fancyLogAdmin( calling_ply, "#A enabled build mode upon #T", affected_plys )
end
end
local pvp = ulx.command( CATEGORY_NAME, "ulx pvp", ulx.pvp, "!pvp" )
pvp:addParam{ type=ULib.cmds.PlayersArg, ULib.cmds.optional }
pvp:addParam{ type=ULib.cmds.BoolArg, invisible=true }
pvp:defaultAccess( ULib.ACCESS_ALL )
pvp:help( "Enables pvp mode." )
pvp:setOpposite( "ulx build", {_, _, true}, "!build" )
hook.Add( "PlayerSpawn", "GodmodeEnabledOnSpawn", function(ply)
if ply:Frags() == 0 and ply:Deaths() == 0 then
ply:GodEnable()
ply.ULXHasGod = true
end
end)[/CODE]
When player has no weapons, GetOwner of the first weapon you pickup detects you as NULL Entity on deploy. Is this normal?
[editline]7th August 2015[/editline]
Happens only if SWEP.Primary.ClipSize is set to -1
I still don't think that's normal
Okay, this is desperate, I've already made a thread for it but I really need help
[url]http://facepunch.com/showthread.php?t=1479933[/url]
[quote]
-Because cloudflare doesn't want to let me pass their captcha when I have long code, I'll just leave a link to the code here-
[url]http://pastebin.com/tdRQH7sj[/url]
Every once in a while, I happen to get this error:
[code]NextBot [42][player_shotgunner]error: cannot resume dead coroutine[/code]
What's wrong? What do I do to fix it?
[/quote]
Okay, so a few suggestions I tried out:
-Remove coroutine.yield in ChaseEnemy
-Remove the "return end"s in RunBehaviour
But, neither work. All I get is the above mentioned error and then my game crashes. Please help, this is urgent....
Does anyone know how I can do this without doing each bar:Spawn() individually?
Currently doesn't allow me to use since SetPos doesn't work with tables
[code]
local GoldBarsLarge = {
--First Row
{Vector(-4280, 4796, 316), Angle(0, 0, 0)},
{Vector(-4281, 4791, 316), Angle(0, 0, 0)},
{Vector(-4281, 4786, 316), Angle(0, 0, 0)},
{Vector(-4281, 4780, 316), Angle(0, 0, 0)},
{Vector(-4281, 4775, 316), Angle(0, 0, 0)},
--Second row
{Vector(-4281, 4778, 321), Angle(0, 0, 0)},
{Vector(-4280, 4783, 321), Angle(0, 0, 0)},
{Vector(-4281, 4789, 321), Angle(0, 0, 0)},
{Vector(-4281, 4794, 321), Angle(0, 0, 0)},
--Third row
{Vector(-4282, 4791, 325), Angle(0, 0, 0)},
{Vector(-4282, 4786, 325), Angle(0, 0, 0)},
{Vector(-4281, 4781, 325), Angle(0, 0, 0)},
--Fourth row
{Vector(-4282, 4783, 329), Angle(0, 0, 0)},
{Vector(-4282, 4788, 329), Angle(0, 0, 0)},
--Top row
{Vector(-4283, 4786, 334), Angle(0, 0, 0)},
}
for k, v in pairs(GoldBarsLarge) do
local bar = ents.Create("prop_dynamic")
bar:SetModel("models/gml/gold_bar_large.mdl")
bar:SetPos(GoldBarsLarge[1])
bar:SetAngles(GoldBarsLarge[2])
bar:Spawn()
end
[/code]
For awhile now I've had this issue where a very small group of people crash as soon as they spawn into my server when player counts are high (60+), but only if they don't join another server or start a single player game first. I'm really at a loss as to what it could be, any ideas?
[QUOTE=kpjVideo;48403739]Does anyone know how I can do this without doing each bar:Spawn() individually?
Currently doesn't allow me to use since SetPos doesn't work with tables[/QUOTE]
It does, you're just using the keyvalues of the entire table instead of the current value.
[code]
for k, v in pairs(GoldBarsLarge) do
local bar = ents.Create("prop_dynamic")
bar:SetModel("models/gml/gold_bar_large.mdl")
bar:SetPos(v[1])
bar:SetAngles(v[2])
bar:Spawn()
end
[/code]
This should work.
What's the difference between using ents.CreateClientsideProp() and using ClientModel() or ClientRagdoll()?
Is it possible to have a trail with user-defined text, like the lol trail?
I suppose it isn't, since it would need a .vmt?
--
Oh, and I added CS:S weapons to my server, but the maps didn't seem to spawn them, yet it works in SP.
Should the files be in /addons (like the workshop page suggests, but doesn't spawn them), or add the weapon lua files to /lua/weapons?
Hey, I wanna send some info from a gmod game to my webserver...
I wanna do this securely, and preferably without using modules...
Any ideas?
[QUOTE=jaooe;48407816]Hey, I wanna send some info from a gmod game to my webserver...
I wanna do this securely, and preferably without using modules...
Any ideas?[/QUOTE]
Bruh...
[url]http://wiki.garrysmod.com/page/Category:http[/url]
[QUOTE=kpjVideo;48403739]Does anyone know how I can do this without doing each bar:Spawn() individually?
Currently doesn't allow me to use since SetPos doesn't work with tables
[code]
local GoldBarsLarge = {
--First Row
{Vector(-4280, 4796, 316), Angle(0, 0, 0)},
{Vector(-4281, 4791, 316), Angle(0, 0, 0)},
{Vector(-4281, 4786, 316), Angle(0, 0, 0)},
{Vector(-4281, 4780, 316), Angle(0, 0, 0)},
{Vector(-4281, 4775, 316), Angle(0, 0, 0)},
--Second row
{Vector(-4281, 4778, 321), Angle(0, 0, 0)},
{Vector(-4280, 4783, 321), Angle(0, 0, 0)},
{Vector(-4281, 4789, 321), Angle(0, 0, 0)},
{Vector(-4281, 4794, 321), Angle(0, 0, 0)},
--Third row
{Vector(-4282, 4791, 325), Angle(0, 0, 0)},
{Vector(-4282, 4786, 325), Angle(0, 0, 0)},
{Vector(-4281, 4781, 325), Angle(0, 0, 0)},
--Fourth row
{Vector(-4282, 4783, 329), Angle(0, 0, 0)},
{Vector(-4282, 4788, 329), Angle(0, 0, 0)},
--Top row
{Vector(-4283, 4786, 334), Angle(0, 0, 0)},
}
for k, v in pairs(GoldBarsLarge) do
local bar = ents.Create("prop_dynamic")
bar:SetModel("models/gml/gold_bar_large.mdl")
bar:SetPos(GoldBarsLarge[1])
bar:SetAngles(GoldBarsLarge[2])
bar:Spawn()
end
[/code][/QUOTE]
Well you've got another table inside of the table you're referencing. In your SetPos call,
[code]
GoldBarsLarge[1][/code] is equal to a table. What I believe you should do is [code]GoldBarsLarge[k][1][/code]
Then do the same for SetAngles, obviously replacing '1' with '2'. That should work.
I've been brainstorming some ideas and was thinking the best way of smoothing out transitions (such as colour fading & moving panels around)
Is this the best practise to doing so? Since this would be called in a draw hook I feel as though its inefficient
[lua]
local StartValue, EndValue = 0, 255
local Delay = 5
local StartTime = CurTime()
local EndTime = StartTime + Delay
Lerp(StartTime / EndTime, StartValue, EndValue)
[/lua]
val = math.Approach( val, target, delta * speed )
or
val = Lerp( math.min( 1, ( CurTime( ) - start ) / ( endtime - start ) ), startval, endval )
Both of these end up with a linear transition, so you'd have to look into easing if you don't want that.
So, I'm using Garry's ironsight code for a SWEP I'm making. But, there is one thing I want to add.
I want to make it so that, if a different NW bool is set, then it will go into a "sprint position". Now, because I suck with GetViewModelPosition, I'll need a bit of help changing the code a bit to move to a different position depending on the bool, heh...
For anyone who doesn't know Garry's ironsight code, this is what I'm using:
[code]local IRONSIGHT_TIME = 0.15
-- Time to enter in the ironsight mod
function SWEP:GetViewModelPosition(pos, ang)
if ( not self.IronSightsPos ) then return pos, ang end
local bIron = self.Weapon:GetNWBool( "Ironsights" )
if (bIron != self.bLastIron) then
self.bLastIron = bIron
self.fIronTime = CurTime()
if (bIron) then
self.SwayScale = 0.3
self.BobScale = 0.1
else
self.SwayScale = 1.0
self.BobScale = 1.0
end
end
local fIronTime = self.fIronTime or 0
if ( not bIron and fIronTime < CurTime() - IRONSIGHT_TIME ) then
return pos, ang
end
local Mul = 1.0
if ( fIronTime > CurTime() - IRONSIGHT_TIME ) then
Mul = math.Clamp( ( CurTime() - fIronTime ) / IRONSIGHT_TIME, 0, 1 )
if not bIron then Mul = 1 - Mul end
end
local Offset = self.IronSightsPos
if ( self.IronSightsAng ) then
ang = ang * 1
ang:RotateAroundAxis( ang:Right(), self.IronSightsAng.x * Mul )
ang:RotateAroundAxis( ang:Up(), self.IronSightsAng.y * Mul )
ang:RotateAroundAxis( ang:Forward(), self.IronSightsAng.z * Mul )
end
local Right = ang:Right()
local Up = ang:Up()
local Forward = ang:Forward()
pos = pos + Offset.x * Right * Mul
pos = pos + Offset.y * Forward * Mul
pos = pos + Offset.z * Up * Mul
return pos, ang
end[/code]
Thanks in advance!
Is it possible to render one mesh/imesh that uses multiple textures on different parts of it (without splitting it up into separate meshes of course)?
Any way to keep the lighting on a prop from screwing up/turning black when part of it is out of the map?
Sorry, you need to Log In to post a reply to this thread.