[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/SetMuted]Player:SetMuted[/url] doesn't work if the player you are muting is currently talking. Works fine if they stop talking and then you mute them.
Or am I doing something wrong?
[QUOTE=MPan1;49019857]Sorry for not answering the question above, but:
Is there a way to make a DButton auto-resize to it's text?
[editline]31st October 2015[/editline]
Or create a DPanel that is sized to a DLabel with SetWrap enabled parented and Dock(FILL)'d to it?[/QUOTE]
Get its text size and use that to calculate how big the button needs to be
Nevermind, [URL="http://wiki.garrysmod.com/page/DLabel/SetAutoStretchVertical"]I found something[/URL]
Also, I didn't want to check the text size since it'd change constantly when the menu was resized and then it'd have to be updated too frequently for my liking
I have an interesting problem I'd like some help with.
I have made an animated .VTF texture (it rotates), and I would like to use this inside of an entity's Draw() function.
[t]http://puu.sh/l509P.jpg[/t]
I photoshopped the image onto the prop to show what I'm trying to accomplish.
The reason it's a VTF is because it's animated and I'm not sure how else to have an animated material.
[del]And then once I manage to draw it onto the prop, I was wondering if there was a way to only draw the material like a circle, like a mask.[/del]
fixed with stencils, however, now whenever the prop is grabbed w/physgun, the screen flashes
[QUOTE=Mrkrabz;49021110][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/SetMuted]Player:SetMuted[/url] doesn't work if the player you are muting is currently talking. Works fine if they stop talking and then you mute them.
Or am I doing something wrong?[/QUOTE]
Have you tired running the -voicerecord command before muting them?
You could always use the PlayerCanHearPlayersVoice hook too
[CODE]
ENT.Type = "anim"
ENT.PrintName = "Citizen"
ENT.Category = "NutScript"
ENT.Spawnable = true
ENT.AdminOnly = false
function ENT:Initialize()if (SERVER) then
self.dob = math.random(minDOB,maxDOB)
self.expireday = math.random(1,30)
self.expiremonth = math.random(1,12)
self.expireyear = math.random(2014,2020)
self.issueday = math.random(1,30)
self.issuemonth = math.random(1,12)
self.issueyear = math.random(2000,2015)
self.height = math.random(minHeight,maxHeight)
self.weight = math.random(minWeight,maxWeight)
self.gender = genders[math.random(1,#genders)]
if(self.gender=="Female")then
self.firstname = femalefirstnames[math.random(1,#femalefirstnames)]
self.race = races[math.random(1,#races)]
if(self.race=="Black")then
self.clothesmodel= blackFemaleModel[math.random(1,#blackFemaleModel)]
elseif(self.race=="Asian")then
self.clothesmodel= asianFemaleModel[math.random(1,#asianFemaleModel)]
elseif(self.race=="White")then
self.clothesmodel= whiteFemaleModel[math.random(1,#whiteFemaleModel)]
end
elseif(self.gender=="Male")then
self.firstname = malefirstnames[math.random(1,#malefirstnames)]
self.race = races[math.random(1,#races)]
if(self.race=="Black")then
self.clothesmodel= blackMaleModel[math.random(1,#blackMaleModel)]
elseif(self.race=="Asian")then
self.clothesmodel= asianMaleModel[math.random(1,#asianMaleModel)]
elseif(self.race=="White")then
self.clothesmodel= whiteMaleModel[math.random(1,#whiteMaleModel)]
end
end
self.lastname = lastnames[math.random(1,#lastnames)]
self:SetNWString("name",self.firstname.." "..self.lastname)
local issuestring = self.expiremonth.."-"..self.expireday.."-"..self.expireyear
local expirestring = self.issuemonth.."-"..self.issueday.."-"..self.issueyear
if(self.gender=="Female")then
local shirttype = femaleShirtTypes[math.random(1,#femaleShirtTypes)]
local shirtcolor= femaleShirtColor[math.random(1,#femaleShirtColor)]
local pantstype = femalePantsTypes[math.random(1,#femalePantsTypes)]
local shoestype = femaleShoesTypes[math.random(1,#femaleShoesTypes)]
self.clothesdesc="[APPERANCE] = "..shirtcolor.." "..shirttype.." | "..pantstype.." | "..shoestype.." | Appears to be a "..self.race.." "..self.gender.." |"
elseif(self.gender=="Male")then
local shirttype = maleShirtTypes[math.random(1,#maleShirtTypes)]
local shirtcolor= maleShirtColor[math.random(1,#maleShirtColor)]
local pantstype = malePantsTypes[math.random(1,#malePantsTypes)]
local shoestype = maleShoesTypes[math.random(1,#maleShoesTypes)]
self.clothesdesc="[APPERANCE] = "..shirtcolor.." "..shirttype.." | "..pantstype.." | "..shoestype.." | Appears to be a "..self.race.." "..self.gender.." |"
end
self:SetNWString("desc", self.clothesdesc)
self.eyecolor = eyeColors[math.random(1,#eyeColors)]
self.haircolor = hairColors[math.random(1,#hairColors)]
-- 1 2 3 4 5 6 7 8 9 10 11 12 13 14
self.info={self.firstname,self.lastname,self.dob,issuestring,expirestring,self.race,self.gender,2015-self.dob,self.eyecolor,self.height}
--self.secondInfo={self.weight,self.haircolor,self.clothesdesc,self}
self:SetModel(self.clothsmodel)
self:SetUseType(SIMPLE_USE)
self:SetMoveType(MOVETYPE_NONE)
self:DrawShadow(true)
self:SetSolid(SOLID_BBOX)
self:PhysicsInit(SOLID_BBOX)
local physObj = self:GetPhysicsObject()
if (IsValid(physObj)) then
physObj:EnableMotion(false)
physObj:Sleep()
end
end
timer.Simple(1, function()
if (IsValid(self)) then
self:setAnim()
end
end)
end
function ENT:setAnim()
for k, v in ipairs(self:GetSequenceList()) do
if (v:lower():find("idle") and v != "idlenoise") then
return self:ResetSequence(k)
end
end
self:ResetSequence(4)
end
if (SERVER) then
function ENT:Use(activator)
if (!self:canAccess(activator) or hook.Run("CanPlayerUseVendor", activator) == false) then
if (self.messages[VENDOR_NOTRADE]) then
activator:ChatPrint(self:getNetVar("name")..": "..self.messages[VENDOR_NOTRADE])
end
return
end
self.receivers[#self.receivers + 1] = activator
if (self.messages[VENDOR_WELCOME]) then
activator:ChatPrint(self:getNetVar("name")..": "..self.messages[VENDOR_WELCOME])
end
local items = {}
-- Only send what is needed.
for k, v in pairs(self.items) do
if (table.Count(v) > 0 and (activator:IsAdmin() or v[VENDOR_MODE])) then
items[k] = v
end
end
self.scale = self.scale or 0.5
local data = {}
data[1] = items
data[2] = self.money
data[3] = self.scale
if (activator:IsAdmin()) then
data[4] = self.messages
data[5] = self.factions
data[6] = self.classes
end
activator.nutVendor = self
netstream.Start(activator, "vendorOpen", self:EntIndex(), unpack(data))
end
function ENT:OnRemove()
end
else
function ENT:createBubble()
self.bubble = ClientsideModel("models/extras/info_speech.mdl", RENDERGROUP_OPAQUE)
self.bubble:SetPos(self:GetPos() + Vector(0, 0, 84))
self.bubble:SetModelScale(0.6, 0)
end
function ENT:Draw()
self:DrawModel()
end
function ENT:Think()
if ((self.nextAnimCheck or 0) < CurTime()) then
self:setAnim()
self.nextAnimCheck = CurTime() + 60
end
self:SetNextClientThink(CurTime() + 0.25)
return true
end
local TEXT_OFFSET = Vector(0, 0, 20)
local toScreen = FindMetaTable("Vector").ToScreen
local colorAlpha = ColorAlpha
local drawText = nut.util.drawText
local configGet = nut.config.get
ENT.DrawEntityInfo = true
function ENT:onDrawEntityInfo(alpha)
local position = toScreen(self.LocalToWorld(self, self.OBBCenter(self)) + TEXT_OFFSET)
local x, y = position.x, position.y
local desc = self:GetNWString("desc")
drawText(self:GetNWString("name", "John Doe"), x, y, colorAlpha(configGet("color"), alpha), 1, 1, nil, alpha * 0.65)
if (desc) then
drawText(desc, x, y + 16, colorAlpha(color_white, alpha), 1, 1, "nutSmallFont", alpha * 0.65)
end
end
end
[/CODE]
Doesnt show up in entity menu..ima try to find out why, but if any of you can help me thatd be awusome
You didn't AddCSLuaFile() at the beginning
[editline]31st October 2015[/editline]
Is there any reason that my VTF will only appear in 2D rendering contexts, such as HUDPaint, and not in any cam.Start3D2D stuff?
[code]
"UnlitGeneric"
{
"$basetexture" "effects/porttex/portal"
"$translucent" 1
"$vertexalpha" 0
"$vertexcolor" 1
"Proxies"
{
"AnimatedTexture"
{
"animatedtexturevar" "$basetexture"
"animatedtextureframenumvar" "$frame"
"animatedtextureframerate" "30"
}
}
}
[/code]
and the corresponding vtf file: [url]http://puu.sh/l5ai6.vtf[/url]
Every time when a vehicle got spawned, I want to check it's class and if it is a specific class, I want to spawn another vehicle with the position of the vehicle spawned before (y+100).
I'm unsure about how to spawn a new vehicle and manipulate the position, so how would I do this?
[QUOTE=Z0mb1n3;49025162]You didn't AddCSLuaFile() at the beginning
[editline]31st October 2015[/editline]
Is there any reason that my VTF will only appear in 2D rendering contexts, such as HUDPaint, and not in any cam.Start3D2D stuff?
[code]
"UnlitGeneric"
{
"$basetexture" "effects/porttex/portal"
"$translucent" 1
"$vertexalpha" 0
"$vertexcolor" 1
"Proxies"
{
"AnimatedTexture"
{
"animatedtexturevar" "$basetexture"
"animatedtextureframenumvar" "$frame"
"animatedtextureframerate" "30"
}
}
}
[/code]
and the corresponding vtf file: [url]http://puu.sh/l5ai6.vtf[/url][/QUOTE]
Try "$vertexalpha" 1 or removing both lines regarding vertex.
[editline]1st November 2015[/editline]
[QUOTE=P4sca1;49026139]Every time when a vehicle got spawned, I want to check it's class and if it is a specific class, I want to spawn another vehicle with the position of the vehicle spawned before (y+100).
I'm unsure about how to spawn a new vehicle and manipulate the position, so how would I do this?[/QUOTE]
Is your vehicle a Lua entity? You could try doing that in it's ENT:Initialize function on the server side.
[QUOTE=LegoGuy;49024694]Have you tired running the -voicerecord command before muting them?
You could always use the PlayerCanHearPlayersVoice hook too[/QUOTE]
This is just meant for a clientside mute, but guess ill have to do some serversided stuff also.
-snip fixed-
If I use findinsphere in a findenemy function an I set the searchradius to 280000..unfortunately the game crashes...how I can fix this? I really need to put a big number in searchradius so don't tell me to set it to 0.1 for avoid the problem..
[QUOTE=Frizios;49028403]If I use findinsphere in a findenemy function an I set the searchradius to 280000..unfortunately the game crashes...how I can fix this? I really need to put a big number in searchradius so don't tell me to set it to 0.1 for avoid the problem..[/QUOTE]
Use ents.GetAll() and this [url]http://wiki.garrysmod.com/page/Vector/Distance[/url]
Or don't use a radius of 280000 units ?
I'm using ply:IsOnGround() for a check, but it triggers if the player is standing on a prop - what should I do to get around this? I know it'll be something like see what's underneath their feet but I'd appreciate some guidance here, thanks!
[editline]1st November 2015[/editline]
Basically, I DON'T want my code to trigger if the player is on a prop, only a brush/normal ground
[editline]1st November 2015[/editline]
Whoops, think I found it!
[url]http://wiki.garrysmod.com/page/Entity/GetGroundEntity[/url]
[editline]1st November 2015[/editline]
Uhh, this is gonna sound very silly but how do I detect if GetGroundEntity is nill? Either I'm making a beginner's mistake or it's acting weird
prints 'tried to use NULL Entity' error in console instead of the sad face if I jump
[code]
if v:GetGroundEntity() then
v:ChatPrint(tostring(v:GetGroundEntity():GetClass()))
else
v:ChatPrint(":(")
end
[/code]
Same thing
[code]
if v:GetGroundEntity():GetClass() == "worldspawn" then
v:ChatPrint("a")
else
v:ChatPrint("b")
end
[/code]
[QUOTE=NiandraLades;49028607]I'm using ply:IsOnGround() for a check, but it triggers if the player is standing on a prop - what should I do to get around this? I know it'll be something like see what's underneath their feet but I'd appreciate some guidance here, thanks!
[editline]1st November 2015[/editline]
Basically, I DON'T want my code to trigger if the player is on a prop, only a brush/normal ground
[editline]1st November 2015[/editline]
Whoops, think I found it!
[url]http://wiki.garrysmod.com/page/Entity/GetGroundEntity[/url]
[editline]1st November 2015[/editline]
Uhh, this is gonna sound very silly but how do I detect if GetGroundEntity is nill? Either I'm making a beginner's mistake or it's acting weird
prints 'tried to use NULL Entity' error in console instead of the sad face if I jump
[code]
if v:GetGroundEntity() then
v:ChatPrint(tostring(v:GetGroundEntity():GetClass()))
else
v:ChatPrint(":(")
end
[/code]
Same thing
[code]
if v:GetGroundEntity():GetClass() == "worldspawn" then
v:ChatPrint("a")
else
v:ChatPrint("b")
end
[/code][/QUOTE]
HULL trace downwards with the hull of the player ( OBBMins, OBBMaxs ) and see if the trace hits what you want or dont want.
[editline]2nd November 2015[/editline]
And you are not testing if v:GetGroundEntity() IsValid().
-snip- I think I got it, ty
[code]if v:GetGroundEntity():IsValid() then
print("A: " .. v:GetGroundEntity():GetClass())
else
print("B: " .. v:GetGroundEntity():GetClass())
end[/code]
[code]print("B: " .. v:GetGroundEntity():GetClass())[/code]
B is executed when v:GetGroundEntity() is NOT valid, hence you are trying to use GetClass() on a non-existent entity.
The reason why it works for WorldSpawn is because the map, the world, worlspawn, is also considered invalid by IsValid(), even though it is a valid entity.
Also, I suggest you use IsValid( ent ) over ent:IsValid() at all times. ( The first one also checks if ent is nil or not )
If I were to make my own custom movement system for an entity base, what would be the best way to approach it? Would I use LerpVector() and LerpAngle() in a think hook with vars like self.PosToGoTo or something like that, along with util.IsInWorld to check if the vector the ent is moving to isn't out of the world? What would be the best way to approach this?(not using nextbot because coroutines are pretty damn hard to handle imo, gotten a lot of crashes from trying to handle them)
-snip probably really late, didn't realize what page-
I'm having a lot of trouble with this. How can I get an entity to render multiple times at different positions and alphas? Basically, render a model once with an alpha of 64, offset the render origin by a vector relative to the object, and then render it with an alpha of 255?
Hey are there certain things i need to downlaod via steamcmd for the HL2 e1 and e2 content packs for servers, or is it just the normal game, if its special content packs can someone give me the app id's
[QUOTE=DamienTehDemo;49030284]Hey are there certain things i need to downlaod via steamcmd for the HL2 e1 and e2 content packs for servers, or is it just the normal game, if its special content packs can someone give me the app id's[/QUOTE]
[url=https://developer.valvesoftware.com/wiki/Steam_Application_IDs#Source_Engine_Games]All are listed here[/url]
Is there any way to 'return' a value from a net message- e.g. if the message is successfully sent, then return something back to the sender to say that it actually worked, or do you have to send another net message?
(By the way, this is for an iMessage replica I'm making, so perhaps I could figure out when to display the 'Recieved' text below a sent message)
you have to send another message
Another thing- can bots receive net messages or doesn't it send?
[QUOTE=ExtReMLapin;49028573]Use ents.GetAll() and this [url]http://wiki.garrysmod.com/page/Vector/Distance[/url]
Or don't use a radius of 280000 units ?[/QUOTE]
fixed
[QUOTE=MPan1;49031446]Is there any way to 'return' a value from a net message- e.g. if the message is successfully sent, then return something back to the sender to say that it actually worked, or do you have to send another net message?
(By the way, this is for an iMessage replica I'm making, so perhaps I could figure out when to display the 'Recieved' text below a sent message)[/QUOTE]
No, you'll need to have the client send a "I received this" message to the server. I'm not sure how source makes it's packets "reliable" but with UDP (which source uses) there's no way of telling if they received a packet without them saying they did.
When I try to add a spawn code to my nextbot the game crashes saying "Lua Panic,Something went horribly wrong", I have 8 GB RAM so I don't think that this is the problem..If I remove the spawn function I can play well...I want to fix it but I don't know what's the reason of this...Any idea?
[CODE]function dehdupl()
local dupl = ents.Create( "escaper_nextbot" )
dupl:SetPos( Vector( 0, 0, 0 ) )
dupl:Spawn()
end
timer.Create( "Duplication", 5, 0, dehdupl ) --After 5 seconds it crashes..
[/CODE]
[QUOTE=Frizios;49032753]When I try to add a spawn code to my nextbot the game crashes saying "Lua Panic,Something went horribly wrong", I have 8 GB RAM so I don't think that this is the problem..If I remove the spawn function I can play well...I want to fix it but I don't know what's the reason of this...Any idea?
[CODE]function dehdupl()
local dupl = ents.Create( "escaper_nextbot" )
dupl:SetPos( Vector( 0, 0, 0 ) )
dupl:Spawn()
end
timer.Create( "Duplication", 5, 0, dehdupl ) --After 5 seconds it crashes..
[/CODE][/QUOTE]
your timer is set to repeat an infinite amount of times. change 0 to 1, unless that was intentional.
also try giving your nextbot a model with SetModel
[editline]2nd November 2015[/editline]
Does someone know the proper way to use the '3D' option in sound.PlayFile? I'm setting the sound's position, but when it is played, I hear nothing.
When is a good time to create particles for a player who is newly joining?
Right now I have a fire particle attached to an entity, but creating the particle on the entity on ENT:Initialize won't create the particles for the connecting player. The only thing I have found is to create a timer for 15 seconds and create the particles then. (Obv a bad idea because timers, and 15 is arbitrary)
Sorry, you need to Log In to post a reply to this thread.