you know 'luavirusfree' and 'ninjas' are getting so many boxes they could move in together and argue there instead of here.
No. Neither of us would like that... Him, well... Not very long to change his mind will she have.
[QUOTE=P.Tigris;38655359]Pw0nageXD: Look for the sound function and search that function on the new wiki.[/QUOTE]
I don't see any differences with it. I did notice something about the timer that tells it to play though.
[code] if sound[2] and sound[2] ~= "" then
local i
timer.Simple(Time, DoSound, ply, sound[2], num)
end[/code]
That's the timer code. According to the wiki
[quote]
Previously, you could pass extra arguments after the function which would be then passed to the given function after the delay, this functionality was removed in Garry's Mod 13. It will throw an error if you do (timer.Simple - called wrong!)[/quote]
The function it's calling is
[code]local function DoSound( ply, snd, num )
if IsValid(ply) then
if MutedPlayers[ply:UniqueID( )] then return; end
num = num or 0
local pitch = math.random( 94, 102 )
for i = 1, num+1 do
ply:EmitSound(Sound(snd), 90, pitch)
end
end
end
[/code]
From what I can tell, the timer is trying to send the variables to DoSound through a method that was removed.
I may be wrong as I only know a little about coding.
Can anyone instruct me on how I'd fix it?
[url]http://www.garrysmod.org/downloads/?a=view&id=74108[/url]
This is the addon I'm trying to fix.
Thanks
[code]
local origin_ents = ents.FindInBox( ply:GetPos() + Vector( -50, -50, 0 ), ply:GetPos() + Vector( 50, 50, 64 ) )
PrintTable(origin_ents)
print(origin_ents)
if !table.HasValue( origin_ents, "npc_trader" ) then
GAMEMODE:Notify(ply, 1, 4, "You need to actually be at the npc to buy stuff.")return end
[/code]
Table prints(when in range of npc):
[code]
1 = Player [1][JR]
2 = Entity [89][predicted_viewmodel]
3 = Entity [88][predicted_viewmodel]
4 = Entity [77][predicted_viewmodel]
5 = NPC [937][npc_trader]
[/code]
I don't know tables that good, but how would I tell if npc_trader is in the table or not with a if statement.
How could I get my mouse's position on the screen when I'm using an isometric view? I'm trying to make a point-click gamemode.
I am getting the Couldn't load module library!
And it is talking about, require("tmysql4")
I also use libmysql.dll
And I have the Lua\bin\gmsv_tmysql4_win32.dll
How do I install Microsoft Visual C++ for Vilayer? I don't understand really how most modules work. :|
Please help.
[QUOTE=J.R.;38661672][code]
local origin_ents = ents.FindInBox( ply:GetPos() + Vector( -50, -50, 0 ), ply:GetPos() + Vector( 50, 50, 64 ) )
PrintTable(origin_ents)
print(origin_ents)
if !table.HasValue( origin_ents, "npc_trader" ) then
GAMEMODE:Notify(ply, 1, 4, "You need to actually be at the npc to buy stuff.")return end
[/code]
Table prints(when in range of npc):
[code]
1 = Player [1][JR]
2 = Entity [89][predicted_viewmodel]
3 = Entity [88][predicted_viewmodel]
4 = Entity [77][predicted_viewmodel]
5 = NPC [937][npc_trader]
[/code]
I don't know tables that good, but how would I tell if npc_trader is in the table or not with a if statement.[/QUOTE]
[lua]
local origin_ents = ents.FindInBox( ply:GetPos() + Vector( -50, -50, 0 ), ply:GetPos() + Vector( 50, 50, 64 ) )
local found = false
for k,v in pairs(origin_ents) do
if v:GetClass() == "npc_trader" then
found = true
end
end
if found == false then
GAMEMODE:Notify(ply, 1, 4, "You need to actually be at the npc to buy stuff.")return end
[/lua]
This might not be efficient if you are running it in a think hook or something, but it should work.
[QUOTE=ollie;38662728]
This might not be efficient if you are running it in a think hook or something, but it should work.[/QUOTE]
Thanks, it's used for a concommand which I wanted to only use near the npc. (buy_car)
So i am basicaly working on a pointshop for TTT first lua coding where i am working on.
It is looking good but i cant figure out how to make it so that if a player is dead the trails he is using will be removed.
[IMG]http://puu.sh/1whQO[/IMG]
[QUOTE]ITEM.Name = 'Smoke Trail'
ITEM.Price = 150
ITEM.Material = 'trails/smoke.vmt'
function ITEM:OnEquip(ply, modifications)
ply.SmokeTrail = util.SpriteTrail(ply, 0, modifications.color, false, 15, 1, 4, 0.125, self.Material)
end
function ITEM:OnHolster(ply)
SafeRemoveEntity(ply.SmokeTrail)
end
function ITEM:Modify(modifications)
PS:ShowColorChooser(self, modifications)
end
function ITEM:OnModify(ply, modifications)
SafeRemoveEntity(ply.SmokeTrail)
self:OnEquip(ply, modifications)
end[/QUOTE]
how could i make it so?
hook.Add PlayerDeath than remove trail/smoke
[QUOTE=G4MB!T;38660045]you know 'luavirusfree' and 'ninjas' are getting so many boxes they could move in together and argue there instead of here.[/QUOTE]
I would love that, When's the marriage? :v:
[QUOTE=TylerB;38662184]How could I get my mouse's position on the screen when I'm using an isometric view? I'm trying to make a point-click gamemode.[/QUOTE]
This thread wouldn't help, would it?
[url]http://facepunch.com/showthread.php?t=891702[/url]
Hi guys,
I'm trying to make a system where the user has to press "E" before they pickup a weapon (rather than auto picking up when they walk over it)
I got the actual button press working, but now I'd like a way to display a "PRESS E TO PICKUP BLAH BLAH" message. Currently, the way I did it was to send a usermessage in the PlayerCanPickupWeapon hook:
[lua]
hook.Add( "PlayerCanPickupWeapon", "EPickup", function( ply, wep )
if ( ( ply.PickupTimeout or 0 ) < CurTime() ) then
umsg.Start("weapon_canpickup", ply)
umsg.String("wep name here")
umsg.End()
return false
end
end )
[/lua]
And on client side, the usermessage is used to control the addition/removal of a HUD draw hook.
Trouble is, the PlayerCanPickupWeapon is called many times a second and so thousands of usermessages get sent if the player is standing on a weapon and has not pressed E. I was wondering, is there a way to check for a nearby weapon clientside? To tell the truth, I'm terrible when it comes to entities so any help/pointers or even a different method would be appreciated
Cheers
Why not make a trace and check if the trace is pointing at a weapon? Then once
you got the weapon, get the class of the weapon and you can probably define
a table of weapon names or something.
ent:IsWeapon()?
[QUOTE=Chessnut;38665372]Why not make a trace and check if the trace is pointing at a weapon? Then once
you got the weapon, get the class of the weapon and you can probably define
a table of weapon names or something.[/QUOTE]
Well, I was hoping more of an FPS style where you don't have to be looking at the gun to pick it up, just walk over and press E
Is there a way to find entities (or specifically, weapons) within a radius? Or would I have to get all entities of class "weapon_*", and manually check the distances to see if the player is within a suitable distance? Because that seems computationally expensive, especially since we'll be working with vectors and a potentially huge list of weapons running every draw frame (or in a think hook, so that the "PRESS BLAH" message shows up)
ents.FindInSphere(vector, distance)
Huzzah, you genius. Cheers
Haven't created anything in ages :/ Where do i stick modules now ?
What's a good start place for making a bioshock 2 gamemode? Or the plasmids and weapons.
[QUOTE=Jamies;38666122]Haven't created anything in ages :/ Where do i stick modules now ?[/QUOTE]
lua/bin
Ok, this one might be a bit hard to understand...
I have a cylinder that acts like a trigger, I want to make anything that touches the cylinder get sucked toward the center of the cylinder's radius, but not move it toward either end of the cylinder.
No idea how.
Pw0nageXD: It is the timer that’s broken:
[url]https://docs.google.com/document/d/1khSuIYrAMkqXu7wlH5YRJNwz6hOH6Xqi5lqBhE3x6gA/edit?pli=1[/url]
how do i hook endtouch of all func_door? im not sure how ENT:Touch works or if its only for SENTs or something
[QUOTE=Kwaq;38666331]how do i hook endtouch of all func_door? im not sure how ENT:Touch works or if its only for SENTs or something[/QUOTE]
It's only for SENTs afaik
[QUOTE=Halokiller38;38662206]I am getting the Couldn't load module library!
And it is talking about, require("tmysql4")
I also use libmysql.dll
And I have the Lua\bin\gmsv_tmysql4_win32.dll
How do I install Microsoft Visual C++ for Vilayer? I don't understand really how most modules work. :|
Please help.[/QUOTE]
Anyone got help for me? This is making my gamemode "Base Gamemode"
It's using BlackAwps gmsv_tmysql4_win32.dll from his svn.
[QUOTE=P.Tigris;38666302]Pw0nageXD: It is the timer that’s broken:
[url]https://docs.google.com/document/d/1khSuIYrAMkqXu7wlH5YRJNwz6hOH6Xqi5lqBhE3x6gA/edit?pli=1[/url][/QUOTE]
Can anyone instruct me on how to fix this?
Also there's a quote button for a reason.
[quote]
I don't see any differences with it. I did notice something about the timer that tells it to play though.
[code] if sound[2] and sound[2] ~= "" then
local i
timer.Simple(Time, DoSound, ply, sound[2], num)
end[/code]
That's the timer code. According to the wiki
[quote]
Previously, you could pass extra arguments after the function which would be then passed to the given function after the delay, this functionality was removed in Garry's Mod 13. It will throw an error if you do (timer.Simple - called wrong!)[/quote]
The function it's calling is
[code]local function DoSound( ply, snd, num )
if IsValid(ply) then
if MutedPlayers[ply:UniqueID( )] then return; end
num = num or 0
local pitch = math.random( 94, 102 )
for i = 1, num+1 do
ply:EmitSound(Sound(snd), 90, pitch)
end
end
end
[/code]
From what I can tell, the timer is trying to send the variables to DoSound through a method that was removed.
I may be wrong as I only know a little about coding.
Can anyone instruct me on how I'd fix it?
[url]http://www.garrysmod.org/downloads/?a=view&id=74108[/url]
This is the addon I'm trying to fix.
Thanks
[/quote]
If anyone could instruct me on what I'd have to do to repair this timer, that'd be appreciated.
How i can create a multidimensional table
I've tried
[lua]
apple = {} -- create the matrix
for i=1,20 do
apple[i] = {} -- create a new row
for j=1,20 do
apple[i][j] = 0
end
end
[/lua]
But, when i want write value i get a nil value error :S
[QUOTE=gonzalolog;38666599]How i can create a multidimensional table
I've tried
[lua]
apple = {} -- create the matrix
for i=1,20 do
apple[i] = {} -- create a new row
for j=1,20 do
apple[i][j] = 0
end
end
[/lua]
But, when i want write value i get a nil value error :S[/QUOTE]
I just tried that code and it works fine.
[editline]1st December 2012[/editline]
[QUOTE=Pw0nageXD;38666499]Can anyone instruct me on how to fix this?
Also there's a quote button for a reason.
If anyone could instruct me on what I'd have to do to repair this timer, that'd be appreciated.[/QUOTE]
The easiest way to fix it is to change
[code]timer.Simple(Time, DoSound, ply, sound[2], num)[/code]
to
[code]timer.Simple(Time, function() DoSound( ply, sound[2], num) end)[/code]
SO... Any help on that, where could I start for a bioshock2 gamemode?
[QUOTE=Divran;38666629]I just tried that code and it works fine.
[editline]1st December 2012[/editline]
The easiest way to fix it is to change
[code]timer.Simple(Time, DoSound, ply, sound[2], num)[/code]
to
[code]timer.Simple(Time, function() DoSound( ply, sound[2], num) end)[/code][/QUOTE]
Thanks. It works
Sorry, you need to Log In to post a reply to this thread.