• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
Is there a simple way to prevent an entity from colliding with anything (including the world), but still be able to be manipulated by the physgun?
Have you tried using COLLISION_GROUP Enumerations ? I think I remember someone using COLLISION_GROUP_IN_VEHICLE to allow props to go through the world but I don't know if that is the right one and I don't know if it allows physgun manipulation.
didnt test hook.Add( "OnPlayerChat", "YourUniqueHookName", function( ply, strText, bTeam, bDead ) strText = string.lower( strText ) if string.StartWith( strText, "/giveweapon" ) then print( ply.." gave somebody a tool of brutalism" ) end end ) now this doesn't even check who is allowed to use the command since I don't know either
Looks like you can use the `FAdmin_OnCommandExecuted` hook, it's called with the player, command name, command arguments, and finally the results. You can see the results outlined by the return of this function, DarkRP/sv_init.lua at 353dc3286092cdb2efade2cc0f2145db5a6c2e69 ·..
I didn't even think of that. Thank you.
COLLISION_GROUP_IN_VEHICLE doesn't allow for physguns to manipulate the entity :/ Thanks for the tip though! I'd imagine it'd be quite useful in many other situations.
Is there some performance difference when using CurTime() instead of timer.Simple to make timers?
Could this work? http://wiki.garrysmod.com/page/constraint/NoCollide With the other entity set to worldspawn, combine this witha collision group that only collides with world
How can I set the headcrab on the head as body group on models : models/player/zombie_fast.mdl and models/player/zombie_soldier.mdl Because the following code line is not working on them : ply:SetBodygroup( 1, 1 ); But it does set the headcrab on the model : models/player/zombie_classic.mdl
Those models don't have headcrab bodygroups - zombie_classic is the only one.
Why?...
Because it wasn't designed to have one.
So How can I attach headcrab to the head of fast zombie / zombine?
You can create a clientside model of a headcrab and attach it to a player's head bone.
Server side because I want every player to see the headcrab on head of the models. local prop = ents.Create("prop_physics") prop:SetModel("models/headcrabclassic.mdl") prop:SetPos(ply:GetPos()) // How can I set it to the head bone? and have the proper angle? prop:Spawn() prop:Activate() prop:SetCollisionGroup(COLLISION_GROUP_WORLD); constraint.Weld(ply, prop, 0, 0, 0, false)
You would just create the clientside model for everyone - you shouldn't use serverside entities for bodygroups/hats, really.
Hi, I'm currently working on an inventory system for my addon and I was wondering what would be the best option.
Why not just immediately save their inventory whenever you change it? Instead of accessing the inventory directly, create some functions that will access the inventory for you, and then save the changes in the functions.
I do have functions like that It's just that I was wondering if constantly using file.Write gonna affect performance. If there's a server full of poeple and using their inventory and bunch of files being written/loaded, is that going to affect the server?
Depends on how many people are on the server, how often you can expect people to modify their inventory, and the size of the data you are saving. If you are that worried about performance, you shouldn't be using the file library. Use sql.
Hey, I have changed my mind and I want to place npc_headcrab on their head. I have tried this, but its not wokring : local boneVecotor, BoneAngle = ply:GetBonePosition( ply:LookupBone( "ValveBiped.Bip01_Head1" ) ) local npc = ents.Create("npc_headcrab") npc:SetPos(boneVecotor) npc:SetAngles(BoneAngle) npc:Spawn() npc:Activate() npc:SetCollisionGroup(COLLISION_GROUP_WORLD); npc:FollowBone( ply, ply:LookupBone( "ValveBiped.Bip01_Head1" ) )
You shouldn't be using an NPC for that - it will not behave correctly.
I've been stuck on this for nearly a week, so I'm just gonna ask here. I made a scoreboard but the kills don't update. Code to call the frags is here: function GM:PlayerDeath(victim, inflictor, attacker) attacker:SetFrags(attacker:Frags() + 1) end I get this lua error: "Attempt to call method 'Frags' (a nil value) " Where/how tf do I define Frags on the serverside? Also please stick to the code that's been written above. There's no reason I need to change it unless attacker:SetFrags to attacker:Frags plus 1 on PlayerDeath isn't the correct expression. Thank you
You have to check if attacker is a player, victim is a player, and attacker ~= victim (suicide).
Thank you for replying. This is what I put but I'm positive it's not right considering I got the lua error "function arguments expected near 'and' " function GM:PlayerDeath(victim, inflictor, attacker) if attacker:IsPlayer and victim:IsPlayer then  attacker:SetFrags(attacker:Frags() + 1) if attacker ~= victim then return end end
You need parentheses after IsPlayer - it's a function. Also, the suicide check needs to be part if the initial if-statement so frags aren't incremented.
like this? function GM:PlayerDeath(victim, inflictor, attacker) if attacker ~= victim then return false else if attacker:IsPlayer() and victim:IsPlayer() then  attacker:SetFrags(attacker:Frags() + 1) I'm really sorry I've never done this before.... I've watched a dozen tutorials, read the wiki, I know everything I need to know I just don't know how to put it together. It doesn't return any errors so maybe the fault is in the "false/nil" declaration? If not, then what?
Again, all checks should be in ONE if-statement, and you return nothing. Ex if firstcheck and secondcheck and something1 ~= something2 then
oh duh I forgot '~' is equivalent to "not". so it's saying... if attacker:IsPlayer and victim:IsPlayer AND attacker not equal to victim then give 1 point. function GM:PlayerDeath(victim, inflictor, attacker) if attacker:IsPlayer() and victim:IsPlayer() and attacker ~= victim  then  attacker:SetFrags(attacker:Frags() + 1) end end 'then' expected near 'not' is the lua error I get now
That code is fine - the error is not related.
Sorry, you need to Log In to post a reply to this thread.