General > Developers Corner
Listing Players Weapons by String
Megiddo:
I believe GetClass() is what you want.
Zmaster:
"On another topic, is there a way to check is a players is Noclipping"
PlayerNoClip is called when a player wants to turn on/off noclip
You can probably do stuff like that with that hook
Bite That Apple:
--- Quote from: Zmaster on January 15, 2015, 03:41:28 AM ---"On another topic, is there a way to check is a players is Noclipping"
PlayerNoClip is called when a player wants to turn on/off noclip
You can probably do stuff like that with that hook
--- End quote ---
--- Quote from: Bite That Apple on January 14, 2015, 08:22:41 PM ---On another topic, is there a way to check is a players is Noclipping, because the command PlayerNoClip is very buggy.
--- End quote ---
------------------------------------
--- Quote from: Megiddo on January 14, 2015, 08:36:50 PM ---I believe GetClass() is what you want.
--- End quote ---
Thank you, that's what I was looking for, but sadly, due to the fact that PlayerNoClip is so buggy, my idea failed, but I got it to work with other means.
JamminR:
--- Quote from: Bite That Apple on January 14, 2015, 08:22:41 PM ---players entire weapons by string, instead of table, because I don't understand tables enough to actually somehow make it work.
--- End quote ---
Until you learn, your going to be extremely limited in anything you can do in lua, or any programming language for that matter.
Table. Array. Matrix. 3 common terms across various languages.
Learn them Padawan.
Additionally, though I've not done any research what-so-ever, I question playernoclip actually being buggy, instead of just not being used correctly.
We use it in ULX with no issue we know of.
Bite That Apple:
--- Quote from: JamminR on January 15, 2015, 09:01:53 PM ---Until you learn, your going to be extremely limited in anything you can do in lua, or any programming language for that matter.
Table. Array. Matrix. 3 common terms across various languages.
Learn them Padawan.
--- End quote ---
I worded it incorrectly, let me try again. I understand tables, but I don't know library enough to actually use all features. There are just some things I don't feel the need to do use unless I really need them, and I'll typically get lucky and get them to work, others; well then we're in this type of situation that I was in.
--- Quote from: JamminR on January 15, 2015, 09:01:53 PM ---Additionally, though I've not done any research what-so-ever, I question playernoclip actually being buggy, instead of just not being used correctly.
We use it in ULX with no issue we know of.
--- End quote ---
Code:
(Whether or not the timer is there doesn't make a difference to the error, it will still error out, and not work)
This simple little piece of code should work, and it DOES, but only half way. This does give the message to the player saying they should not kill while in noclip, but then gives the error which will be located below. Now if you say I'm using it wrong still, obviously my basic understanding of hooks has changed.
--- Code: ---[1] -- SERVER SIDE
[2]
[3]function DisableNoclipNoWeps2( ply )
[4] timer.Simple(0.5, function()
[5] if ply:GetMoveType() == 8 then
[6] umsg.Start("PlayerNoNoclipKill", ply)
[7] umsg.String("You are now in noclip do not kill people while in noclip!")
[8] umsg.End()
[9] end
[10] end)
[11]end
[12]hook.Add("PlayerNoClip", "DisableNoclipNoWeps2", DisableNoclipNoWeps2)
--- End code ---
ERROR:
--- Code: ---[Dev Apple|191|STEAM_0:0:35379784] Lua Error:
[ERROR] addons/apple_noclip_noweapons/lua/autorun/sv_noclip_no.lua:6: attempt to index global 'umsg' (a nil value)
1. unknown - addons/apple_noclip_noweapons/lua/autorun/sv_noclip_no.lua:6
--- End code ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version