First of all, calm the fuck down.
Second, you have jobs with customChecks that call table.HasValue on "vipGroups" and "adminGroups" tables but these do not exist. Define them. For example,
[lua]local vipGroups = {"vip", "vip+"}[/lua]
[QUOTE=Bo98;47186016]First of all, calm the fuck down.
Second, you have jobs with customChecks that call table.HasValue on "vipGroups" and "adminGroups" tables but these do not exist. Define them. For example,
[lua]local vipGroups = {"vip", "vip+"}[/lua][/QUOTE]
they exist within config.lua, they're globals.
[editline]21st February 2015[/editline]
Jesus fucking christ, you were right.
I forgot to save config.lua when I made those tables
thank you I owe you a cock sucking.
[QUOTE=Author.;47185240]Üntested, but something like this should work;
[lua]local alpha = 255
local speed = 200
hook.Add("HUDPaint", "DrawItemsGlow", function()
local ply = LocalPlayer()
local ent = ply:GetEyeTrace().Entity
if(ply:GetEyeTrace()) and ent:GetClass() == "item" and ent:GetPos():Distance(ply:GetPos()) < 275 and (ply:Alive()) then
if (alpha > 255) then
alpha = math.Approach( alpha, 255, speed * FrameTime() )
end
surface.SetFont("ChatFont")
surface.SetTextColor(231, 76, 60, alpha)
surface.SetTextPos(ply:GetEyeTrace().HitPos:ToScreen().x-15,ply:GetEyeTrace().HitPos:ToScreen().y)
surface.DrawText("Item")
elseif color.a > 0 then
alpha = math.Approach( alpha, 0, speed * FrameTime() )
end
end)[/lua]
[editline]21st February 2015[/editline]
Replace color.a with alpha, cant edit the post :<[/QUOTE]
doesnt work sadly :X
[QUOTE=bobbleheadbob;47185777]You can pack content into a map using a program called "PackRat" I think. The content is saved directly to the map and doesn't have to be downloaded.[/QUOTE]
So its really that simple? I can build an entire map complete with terrorist button configurations and player model skins and props and textures and what not, and it will all just be downloaded when somebody decides to play the map? No "ERROR's" or anything?
[QUOTE=benchristians;47186141]So its really that simple? I can build an entire map complete with terrorist button configurations and player model skins and props and textures and what not, and it will all just be downloaded when somebody decides to play the map? No "ERROR's" or anything?[/QUOTE]
I think so. Only way to know is to try.
Look at the documentation for packrat and see what it supports.
I keep getting a table index is nil when all I want to do is fill a table with weapons and if they're unlocked or not. This is incredibly confusing for me
Here is the code
[code]
GM.WeaponLocks = {}
function GM:UpdateWeaponUnlockes()
for i, tab in pairs(GAMEMODE.Items) do
if not self.WeaponLocks[tab.SWEP] == self:IsWeaponUnlocked(tab.SWEP) then
self.WeaponLocks[tab.SWEP] = self:IsWeaponUnlocked(tab.SWEP)
end
end
net.Start("zs_weaponlocks")
net.WriteTable(self.WeaponLocks)
net.Broadcast()
end[/code]
[QUOTE=ForrestMarkX;47187065]I keep getting a table index is nil when all I want to do is fill a table with weapons and if they're unlocked or not. This is incredibly confusing for me
Here is the code
[code]
GM.WeaponLocks = {}
function GM:UpdateWeaponUnlockes()
for i, tab in pairs(GAMEMODE.Items) do
if not self.WeaponLocks[tab.SWEP] == self:IsWeaponUnlocked(tab.SWEP) then
self.WeaponLocks[tab.SWEP] = self:IsWeaponUnlocked(tab.SWEP)
end
end
net.Start("zs_weaponlocks")
net.WriteTable(self.WeaponLocks)
net.Broadcast()
end[/code][/QUOTE]
What line? What is your IsWeaponUnlocked code?
I made this a swep and it crashes the game if i try to shoot an npc. It just crashes.
[CODE]
IncludeCS( "ai_translations.lua" )
IncludeCS( "sh_anim.lua" )
-- Variables that are used on both client and server
SWEP.Author = ""
SWEP.Contact = ""
SWEP.Purpose = ""
SWEP.Instructions = ""
SWEP.ViewModelFOV = 62
SWEP.ViewModelFlip = false
SWEP.ViewModel = "models/weapons/v_pistol.mdl"
SWEP.WorldModel = "models/weapons/w_357.mdl"
SWEP.Category = "Test"
SWEP.Spawnable = true
SWEP.AdminOnly = false
SWEP.Primary.ClipSize = 8 -- Size of a clip
SWEP.Primary.DefaultClip = 32 -- Default number of bullets in a clip
SWEP.Primary.Automatic = false -- Automatic/Semi Auto
SWEP.Primary.Ammo = "Pistol"
SWEP.Secondary.ClipSize = 8 -- Size of a clip
SWEP.Secondary.DefaultClip = 32 -- Default number of bullets in a clip
SWEP.Secondary.Automatic = false -- Automatic/Semi Auto
SWEP.Secondary.Ammo = "Pistol"
--[[---------------------------------------------------------
Name: SWEP:Initialize( )
Desc: Called when the weapon is first loaded
-----------------------------------------------------------]]
function SWEP:Initialize()
self:SetHoldType( "pistol" )
end
--[[---------------------------------------------------------
Name: SWEP:Precache( )
Desc: Use this function to precache stuff
-----------------------------------------------------------]]
function SWEP:Precache()
end
--[[---------------------------------------------------------
Name: SWEP:PrimaryAttack( )
Desc: +attack1 has been pressed
-----------------------------------------------------------]]
function SWEP:PrimaryAttack()
-- Make sure we can shoot first
if ( !self:CanPrimaryAttack() ) then return end
self.Weapon:EmitSound("Weapon_AR2.Single")
-- Shoot 9 bullets, 150 damage, 0.75 aimcone
self:ShootBullet( 150, 1, 0.01 )
self:TakePrimaryAmmo( 1 )
self.Owner:ViewPunch( Angle( -1, 0, 0 ) )
--Only do shit from here
local tr = self.Owner:GetEyeTrace()
local dmg = DamageInfo()
dmg:GetAttacker (self.Owner)
dmg:SetDamage(50)
if IsValid(tr.Entity) or tr.Entity:IsNPC() then
tr.Entity:TakeDamageInfo(dmg) end
end
--[[---------------------------------------------------------
Name: SWEP:SecondaryAttack( )
Desc: +attack2 has been pressed
-----------------------------------------------------------]]
function SWEP:SecondaryAttack()
-- Make sure we can shoot first
if ( !self:CanSecondaryAttack() ) then return end
-- Play shoot sound
self.Weapon:EmitSound("Weapon_Shotgun.Single")
-- Shoot 9 bullets, 150 damage, 0.75 aimcone
self:ShootBullet( 150, 9, 0.2 )
-- Remove 1 bullet from our clip
self:TakeSecondaryAmmo( 1 )
-- Punch the player's view
self.Owner:ViewPunch( Angle( -10, 0, 0 ) )
end
--[[---------------------------------------------------------
Name: SWEP:Reload( )
Desc: Reload is being pressed
-----------------------------------------------------------]]
function SWEP:Reload()
self.Weapon:DefaultReload( ACT_VM_RELOAD );
end
[/CODE]
[QUOTE=Tenrys;47187368]What line? What is your IsWeaponUnlocked code?[/QUOTE]
This line self.WeaponLocks[tab.SWEP] = self:IsWeaponUnlocked(tab.SWEP)
Here is IsWeaponUnlocked
[code]function GM:IsWeaponUnlocked(classname)
local weaponwave = self.WeaponUnlocks[classname].Wave
local infliction = self:CalculateInfliction()
local IsObjective = self.ObjectiveMap
local wave = self:GetWave()
if weaponwave == nil then
return true
end
if IsObjective and wave >= 2 then
return true
elseif wave == 6 then
return true
elseif wave >= weaponwave then
return true
elseif infliction >= 0.8 and weaponwave <= 6 then
return true
elseif infliction >= 0.5 and weaponwave <= 4 then
return true
end
return false
end[/code]
Is there a way to reload a derma frame and all of its contents without forcing it closed and reopening it?
I feel that Removing the menu and calling it again is really shit.
(I have a themes system which has diff text color, but when the text color changes it doesn't until I reopen the frame.)
[QUOTE=ForrestMarkX;47187065]I keep getting a table index is nil when all I want to do is fill a table with weapons and if they're unlocked or not. This is incredibly confusing for me
Here is the code
[code]
GM.WeaponLocks = {}
function GM:UpdateWeaponUnlockes()
for i, tab in pairs(GAMEMODE.Items) do
if not self.WeaponLocks[tab.SWEP] == self:IsWeaponUnlocked(tab.SWEP) then
self.WeaponLocks[tab.SWEP] = self:IsWeaponUnlocked(tab.SWEP)
end
end
net.Start("zs_weaponlocks")
net.WriteTable(self.WeaponLocks)
net.Broadcast()
end[/code][/QUOTE]
Basically tab.SWEP is nil.
[QUOTE=arcaneex;47187686]Basically tab.SWEP is nil.[/QUOTE]
Ahh I see, should use self.Items then
Does anyone have any idea how to check if a weapon is inside a players inventory or loose on the ground? I can't find a function for it, and trying to call bools OnDropped is not working
[QUOTE=solid_jake;47188779]Does anyone have any idea how to check if a weapon is inside a players inventory or loose on the ground? I can't find a function for it, and trying to call bools OnDropped is not working[/QUOTE]
Check if self:GetOwner() is valid.
[QUOTE=bobbleheadbob;47188794]Check if self:GetOwner() is valid.[/QUOTE]
jesus, thank you so much
Hello.
I'm trying to figure out a way that I'll be able to check if a vector is in between four other vectors.
What I mean is that basically I want to create a square out of 4 vectors, and the Check if a player is currently found in that square.
I'm unsure how to make the check it self
If it's always a rectangle, then use this [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Vector/WithinAABox]Vector:WithinAABox[/url]
else, you'll have to get creative with vector math. It's basically just a bunch of "if x < y && x > z then" checks.
[QUOTE=Garr;47187443]I made this a swep and it crashes the game if i try to shoot an npc. It just crashes.
[/QUOTE]
I'd recommend commenting out all code in the functions, then trying it.. If it doesn't crash, change some code, respawn the weapon ( the new code takes effect on auto-refresh when you respawn the weapon ) and try again. Repeat until you uncomment a line that causes the crash.
[QUOTE=mib999;47187553]Is there a way to reload a derma frame and all of its contents without forcing it closed and reopening it?
I feel that Removing the menu and calling it again is really shit.
(I have a themes system which has diff text color, but when the text color changes it doesn't until I reopen the frame.)[/QUOTE]
Create a table inside your derma that can be accessed to update any existing elements. Example, for a scoreboard you'd create a few hooks in Panel:Init such as player_connect game-event, or player_disconnect game-event... You can simply check the list to see if the element exists, if it does remove ( on disconnect ), if not, add ( on connect )... On PlayerDeath ( would need to be networked ) have a net-receiver handle it.
There are so many different ways to manage vguis without needing to remove all rows and reload, or clear everything and reload, etc.... You CAN use hooks, you CAN use net-messages; just structure the content / panels so you know how to access them when the time comes..
[QUOTE=solid_jake;47188779]Does anyone have any idea how to check if a weapon is inside a players inventory or loose on the ground? I can't find a function for it, and trying to call bools OnDropped is not working[/QUOTE]
Player:HasWeapon [url]http://wiki.garrysmod.com/page/Player/HasWeapon[/url] and other functions hooks. You could also use my CanPlayerDropWeapon and PlayerDroppedWeapon hook to go along with the weapon initialize, or deploy / equip functions... [url]https://bitbucket.org/Acecool/acecooldev_base/src/master/gamemode/shared/hooks/playerdroppedweapon/?at=master[/url]
Hope that logic helps. META_PLAYER is FindMetaTable( "Player" );
[QUOTE=tzahush;47189059]Hello.
I'm trying to figure out a way that I'll be able to check if a vector is in between four other vectors.
What I mean is that basically I want to create a square out of 4 vectors, and the Check if a player is currently found in that square.
I'm unsure how to make the check it self[/QUOTE]
You can create a CUBE / RECT using 2 vectors... Opposite corners, one on bottom, one on top...
Visual Representation of cubes: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/render_lasers_rendering_cubes.lua.html[/url]
-edit- ninja'd on: You can use ents.FindInBox, or Find In AABB type function...
-snip- figured it out
[QUOTE=antid2;47189385][code]
$SteamAPIKey = "4D4039E34269552B66731255E949BA04";
[/code][/QUOTE]
This is supposed to be private. You should revoke it.
it's not a working key, i have a working key in the actual code though, just don't understand why i'm not able to display anything such as an avatar? or name.
You should enable strict error reporting for PHP if you're getting no output.
[QUOTE=Revenge282;47189078]If it's always a rectangle, then use this [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Vector/WithinAABox]Vector:WithinAABox[/url]
else, you'll have to get creative with vector math. It's basically just a bunch of "if x < y && x > z then" checks.[/QUOTE]
Should I use this to see if something is within the map boundaries, or is there a better way?
[lua]
local site = vgui.Create( "DHTML", frame )
site:SetSize( 795, 511 )
site:SetPos( 300, 32 )
local ctrls = vgui.Create( "DHTMLControls", frame )
ctrls:SetWide( 550 )
ctrls:SetPos( 300,0 )
ctrls:SetHTML( site )
ctrls.AddressBar:SetText( rules )
site:OpenURL( rules )
[/lua]
I can't go back, forward or refresh the page, any help?
DHTMLControls is broken because of [url]https://github.com/Facepunch/garrysmod-issues/issues/189[/url]
I wrote a workaround that's in DarkRP: [url]https://github.com/FPtje/DarkRP/blob/master/gamemode/modules/f1menu/cl_htmlcontrols.lua[/url]. The stop button still doesn't work but that's impossible to work around.
Hello there,
I am trying to wrap my head around the Player Classes, I got almost everything working expect the VM hands. I also already had a look at the [URL="http://wiki.garrysmod.com/page/Using_Viewmodel_Hands"]wiki article[/URL], but I did not get it to work.
Here is my code for the class:
[lua]
DEFINE_BASECLASS( "player_default" )
local PLAYER = {}
PLAYER.DisplayName = "Soldier"
PLAYER.WalkSpeed = 200
PLAYER.RunSpeed = 280
PLAYER.CanUseFlashlight = false
PLAYER.AvoidPlayers = false
PLAYER.TeammateNoCollide = false
PLAYER.MaxHealth = 125
PLAYER.StartHealth = 125
PLAYER.UseVMHands = true
function PLAYER:Loadout()
self.Player:RemoveAllAmmo()
self.Player:StripWeapons()
self.Player:GiveAmmo( 256, "357", true )
self.Player:GiveAmmo( 64, "Buckshot", true )
self.Player:Give( "weapon_crowbar" )
self.Player:Give( "weapon_357" )
self.Player:Give( "weapon_shotgun" )
self.Player:Give( "weapon_frag" )
end
player_manager.RegisterClass( "player_soldier", PLAYER, "player_default" )
[/lua]
My PlayerSpawn:
[lua]
function GM:PlayerSpawn(ply)
local class = player_manager.GetPlayerClass( ply )
if ( class ) then
MsgN(class)
self.BaseClass:PlayerSpawn( ply )
player_manager.OnPlayerSpawn( ply )
ply:SetupHands()
end
--SetPos
end
[/lua]
[lua]
function GM:PlayerSetModel( ply )
ply:SetModel( "models/captainbigbutt/vocaloid/miku_classic.mdl" ) -- yes this model has valid hands (tested in sandbox)
end
[/lua]
Yet, I always get the kleiner hands, what am I doing wrong or what exactly am I missing here?
Oh, also I am spawning via a concommand like so:
[lua]
concommand.Add("soldier", function(ply,com,args)
ply:SetTeam(TEAM_PLAYER)
player_manager.SetPlayerClass(ply, "player_soldier")
ply:Spawn()
end)
[/lua]
[QUOTE=wauterboi;47189782]Should I use this to see if something is within the map boundaries, or is there a better way?[/QUOTE]
Try [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/util/IsInWorld]util.IsInWorld( vector:point )[/url].
I'm trying to make a udp server, so it can receive request from Love2D ( which is a 2d engine in lua, with udp support)
(I'm using LuaSocket)
For the moment, i'm just trying to make communicate scrds with ... srcds, using
[lua]
local ip, port = "127.0.0.1", 42 -- opened with ufw
local udp = socket.udp()
hook.Add("Think", "TestUDP", function () udp:sendto("anything", ip, port)end)
[/lua]
At this point i have no idea if it's working. Am i doing this right ?
Then i just want to check if it's working by using
[lua]
udp:receive()
[/lua]
The problem is .... how should i use it ????
Should i make something like
[lua]
coroutine.create(function () while true do print(udp:receive()) end end)
[/lua]
(not really working)
I never worked with udp/tcp, i have no idea how to make this work
I never worked with coroutines
Any 3rd party module using the ILuaBase headers will crash if called in to from a coroutine. Your coroutine wouldn't work anyway because you're not yielding at any point.
[QUOTE=Acecool;47189091]I'd recommend commenting out all code in the functions, then trying it.. If it doesn't crash, change some code, respawn the weapon ( the new code takes effect on auto-refresh when you respawn the weapon ) and try again. Repeat until you uncomment a line that causes the crash.
Create a table inside your derma that can be accessed to update any existing elements. Example, for a scoreboard you'd create a few hooks in Panel:Init such as player_connect game-event, or player_disconnect game-event... You can simply check the list to see if the element exists, if it does remove ( on disconnect ), if not, add ( on connect )... On PlayerDeath ( would need to be networked ) have a net-receiver handle it.
There are so many different ways to manage vguis without needing to remove all rows and reload, or clear everything and reload, etc.... You CAN use hooks, you CAN use net-messages; just structure the content / panels so you know how to access them when the time comes..
Player:HasWeapon [url]http://wiki.garrysmod.com/page/Player/HasWeapon[/url] and other functions hooks. You could also use my CanPlayerDropWeapon and PlayerDroppedWeapon hook to go along with the weapon initialize, or deploy / equip functions... [url]https://bitbucket.org/Acecool/acecooldev_base/src/master/gamemode/shared/hooks/playerdroppedweapon/?at=master[/url]
Hope that logic helps. META_PLAYER is FindMetaTable( "Player" );
You can create a CUBE / RECT using 2 vectors... Opposite corners, one on bottom, one on top...
Visual Representation of cubes: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/render_lasers_rendering_cubes.lua.html[/url]
-edit- ninja'd on: You can use ents.FindInBox, or Find In AABB type function...[/QUOTE]
It is not that crash. It closes the game.
Sorry, you need to Log In to post a reply to this thread.