[QUOTE=DoubleElite;39626305]Alright I'll take a look.
I'm having some issues, why isn't the variable "shouldShowHud" being set to true?
The HUD isn't being drawn when an entity is hit.
[lua]
// Enemy HitBox //
shouldShowHud = false
function DamageTaken( target, dmginfo )
if( target:IsPlayer() == false ) then
shouldShowHud = true
Msg(shouldDrawHud)
Msg( target:GetName(), " Took Damage" )
end
end
hook.Add("EntityTakeDamage", "HitDetection", DamageTaken)
function Hitbox()
if( shouldDrawHud ) then
// Top line
draw.RoundedBox( 0, (ScrW() / 2) - 10, (ScrH() / 2) - 15, 20, 3, Color( 255, 255, 255, 150 ) )
// Bottom line
draw.RoundedBox( 0, (ScrW() / 2) - 10, (ScrH() / 2) + 15, 20, 3, Color( 255, 255, 255, 150 ) )
end
end
hook.Add("HUDPaint", "HUD", Hitbox)
[/lua]
[B]P.S[/B]: Does anyone have the link to Garrys .gma extractor?[/QUOTE]
You can't use serverside hooks in a clientside file.
[QUOTE=brandonj4;39626561]You can't use serverside hooks in a clientside file.[/QUOTE]
The hook still runs though, the only thing is the variable isn't being set in the hook. The Msg function still works and prints stuff.
[QUOTE=DoubleElite;39627036]The hook still runs though, the only thing is the variable isn't being set in the hook. The Msg function still works and prints stuff.[/QUOTE]
Use the net library to send variables to the client.
Is there a way to trace the Ent:Remove() function as to see the file in which it is called, or anything along these lines? My server is plagued by a 'random vanishing entity' bug, regrettably I have been analyzing the problem for quite a while with no success.
Edit:
Added the following, now I can't get the bug to occur. . .
[code]
EMETA = FindMetaTable("Entity")
function EMETA:Remove()
debug.Trace()
self:Fire("kill","",0)
end
[/code]
[QUOTE=luavirusfree;39620142]content/models, content/materials, and content/anything else you want.
[editline]17th February 2013[/editline]
Is it possible to get the tick time with Lua? Is it possible to get the think time?[/QUOTE]
If you bloody hell read the wiki, you would know that THINK Is called every god damn frame, and tick is called ever (convar) times per second. Jesus Christ, you're as clueless as you are in your threads.
[QUOTE=brandonj4;39627174]Use the net library to send variables to the client.[/QUOTE]
How would I go about doing that? It's not for an entity, and the only search results I get are for Entities.
[url]http://glua.me/search/?keywords=net[/url]
[QUOTE=DoubleElite;39627435]How would I go about doing that? It's not for an entity, and the only search results I get are for Entities.
[url]http://glua.me/search/?keywords=net[/url][/QUOTE]
That's not the [i]net[/i] library.
Use the Garry's Mod wiki and you'll find it there.
[QUOTE=Banana Lord.;39619117]Take a look at [url=http://pastebin.com/Nr598C6h]fatekeeper[/url], it's really REALLY simple
[/QUOTE]
Thanks man I really appreciate that.
Hey guys! How do I use
[CODE]surface.SetTexture[/CODE]
and
[CODE]chat.AddText[/CODE]
in SinglePlayer??
(I know how to use it in MultiPlayer)
[QUOTE=DoubleElite;39627435]How would I go about doing that? It's not for an entity, and the only search results I get are for Entities.
[url]http://glua.me/search/?keywords=net[/url][/QUOTE]
Luasearch isn't (and probably won't be) updated to GMod 13
[editline]18th February 2013[/editline]
[QUOTE=theVendetta;39629191]Thanks man I really appreciate that.[/QUOTE]
no problem :smile:
[QUOTE=monadko;39630007]Hey guys! How do I use
[CODE]surface.SetTexture[/CODE]
and
[CODE]chat.AddText[/CODE]
in SinglePlayer??
(I know how to use it in MultiPlayer)[/QUOTE]
I dont see why they wont work, they are both clientside. What exactly is your problem?
Is it possible to read models mesh and recreate it in lua IMesh?
[QUOTE=Benjiko99;39630325]I dont see why they wont work, they are both clientside. What exactly is your problem?[/QUOTE] I don't know what should I type.
for example:
[CODE]if ( (game.SinglePlayer() && SERVER) || CLIENT ) then[/CODE]
this one..
Anyone know how to remove the 'Player <name> left the game (Disconnect by user.)' message?
[b][url=http://gmodwiki.net/Lua/Hooks/Base/ChatText]Lua/Hooks/Base/ChatText[img]http://gmodwiki.net/favicon.ico[/img][/url][/b]
[editline]18th February 2013[/editline]
[QUOTE=EvacX;39623437]Does anyone know how I would change what the player has entered into the chatbox? It's for an auto-completion thingy where you can press the down and up arrows.[/QUOTE]
base gamemode does it like this
[lua]--[[---------------------------------------------------------
Name: gamemode:OnChatTab( str )
Desc: Tab is pressed when typing (Auto-complete names, IRC style)
-----------------------------------------------------------]]
function GM:OnChatTab( str )
local LastWord
for word in string.gmatch( str, "%a+" ) do
LastWord = word;
end
if (LastWord == nil) then return str end
playerlist = player.GetAll()
for k, v in pairs( playerlist ) do
local nickname = v:Nick()
if ( string.len(LastWord) < string.len(nickname) &&
string.find( string.lower(nickname), string.lower(LastWord) ) == 1 ) then
str = string.sub( str, 1, (string.len(LastWord) * -1) - 1)
str = str .. nickname
return str
end
end
return str;
end[/lua]
( [url]http://glua.me/bin/?path=/gamemodes/base/gamemode/cl_init.lua[/url] )
But that's for the TAB key..if you want the arrows you'll likely need your own chat box
[QUOTE=Frankess;39630374]Is it possible to read models mesh and recreate it in lua IMesh?[/QUOTE]
You can't read the mesh of mdls straight from lua without a module, but what you could do is setup a server that reads the decompiled model and sends the mesh data back.
Probably not the best, though.
[QUOTE=Kuro Light;39627412]If you bloody hell read the wiki, you would know that THINK Is called every god damn frame, and tick is called ever (convar) times per second. Jesus Christ, you're as clueless as you are in your threads.[/QUOTE]
Dude, I know that tickrate has a convar. What I'm asking is how to get that with Lua. I guess if something is called every frame it doesn't really have a set rate. What wiki? I stopped using the official one because it has no more search bar.
[QUOTE=vexx21322;39631286]You can't read the mesh of mdls straight from lua without a module, but what you could do is setup a server that reads the decompiled model and sends the mesh data back.
Probably not the best, though.[/QUOTE]
Or spent few weeks on converting manualy meshes to IMesh. I'll start working then!
The wikia doesn't have anything about Lua. Prove me wrong, and if it does, it doesn't come up when I search for that function.
[QUOTE=Frankess;39631332]Or spent few weeks on converting manualy meshes to IMesh. I'll start working then![/QUOTE]
A module might be even better.
Program, or find someone to program a module that reads the mdl itself and spits out an IMesh. Shouldn't actually be too difficult.
[QUOTE=luavirusfree;39631336]The wikia doesn't have anything about Lua. Prove me wrong, and if it does, it doesn't come up when I search for that function.[/QUOTE]
[URL="wiki.garrysmod.com"]wiki.garrysmod.com[/URL]
[QUOTE=jaooe;39631581][URL="http://wiki.garrysmod.com"]wiki.garrysmod.com[/URL][/QUOTE]
Like i said, no search bar.
garrysmod.wikia.com has nothing about Lua. I'm not going to browse a wiki like wiki.garrysmod.com when I don't even know what some shit even classifies as. Also, I like to be able to just type something in for a search so I can find things that I thought of, but never needed to use before.
[editline]18th February 2013[/editline]
I found it, but it's in the opposite location from where it used to be.
Is there a current way to analyze the origin of a crash?
I used dumps.garrysmod.com when it was still alive and it always hinted me at the causing .cpp file, which helped me to work around the crash by disabling Lua scripts connected to these until Garry released a fix. But now I can't do anything. How do you go about random server crashes? Or are you also as helpless as I am? I already heard about [url]http://dumps.metastruct.uk.to/[/url] but it only hints me at the compiled files which is as useful as telling me that it originates from GMod.
How I make a player open a url in the steam community browser?
EDIT: NVM FOUND IT [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index2c41.html[/url]
is there anyway i can get an npc to open up _undfinded's pointshop for darkrp use?
-How can I limit the players movement to only the X and Y Axis? (only left and right/ up and down)
-How can I change the players camera angle/position of third person?
I've tried adding this to my DarkRP but, when it just so happens that if the attacker is a CP or not he will still become wanted. Any help?
[lua]
function WarrantShooter(target, dmginfo)
local attacker = dmginfo:GetAttacker()
if attacker:IsCP() then
return false
elseif attacker:IsValid() && attacker:IsPlayer() && target:IsCP() then
attacker:SetDarkRPVar("wanted", true)
attacker:SetDarkRPVar("wantedReason", "Attacked Government Official")
timer.Create(attacker:UniqueID() .. " wantedtimer", GAMEMODE.Config.wantedtime, 1, function() TimerUnwanted(ply, attacker) end)
end
end
hook.Add("EntityTakeDamage", "WarrantShooter", WarrantShooter)
[/lua]
[QUOTE=luavirusfree;39632264]Like i said, no search bar.[/QUOTE]
Scroll up.
[QUOTE=Agent766;39638310]Scroll up.[/QUOTE]
Bah, I found it... waaay before you posted that; that deserves no zing. The wiki must've been updated since I was using the official one for some time, but when it switched to what it is now I couldn't find the search bar. It practically flipped locations both horizontally and vertically when compared to the old layout. [I'm very tired right now...]
I am making a DarkRP server but what I want to do is learn lua by changing it drastically into its own gamemode.
Where can I learn (Perferably not the wiki since it doesn't go into detail) how to make a new HUD to replace this disgusting one?
Any helpful Lua links would be appreciated!
Sorry, you need to Log In to post a reply to this thread.