I'm scripting my own prop protection for Flood mod. And I'm wondering if there was a way that I can push a player of someones prop if they aren't on their prop protection.
Right now all I have is: pl:SetVelocity(vector(0, 1000, 500))
Put it's returning an error saying that ENT is not valid or something. Here is the entire function:
[code]
function ENT:Touch(pl, ent)
if ent:IsValid() and ent:IsPlayer() then
if ent:GetNetworkedEntity("Owner") != pl then
if !ent:GetNetworkedEntity("Owner").Friends then return false end
if table.HasValue(ent.GetNetworkedEntity("Owner").Friends, string.Replace(pl:SteamID(), ":", "_")) then
--Do nottin'
else
pl:SetVelocity(Vector(0,1000,500))
end
end
end
end
[/code]
I'm not sure how to do this. But if this is wrong, please give me an example of the right way to do it. Thanks for any help given.
I think you have to use physics obj and not the player when setting velocity.
hmm... I'm not really sure. On wiki.garrysmod.com it says to use setvelocity instead of physobject. haha, but the prop protection i'm using is the one on your Flood mod! xD (2.00)
It's been awhile since I've done anything lua related, sorry you only use that for physics objects. Post the error and exact code and I'll fix it for you.
Here is the error:
[code]
[gamemodes\flood\gamemode\pp.lua:37] attempt to index global 'ENT' (a nil value)
[/code]
And here is the gamemode:
[url]http://www.mediafire.com/download.php?5cd2heqsg075gst[/url]
[QUOTE=mdew355;25498081]
Put it's returning an error saying that ENT is not valid or something. Here is the entire function:
[code]
function ENT:Touch(pl, ent)
if ent:IsValid() and ent:IsPlayer() then
if ent:GetNetworkedEntity("Owner") != pl then
if !ent:GetNetworkedEntity("Owner").Friends then return false end
if table.HasValue(ent.GetNetworkedEntity("Owner").Friends, string.Replace(pl:SteamID(), ":", "_")) then
--Do nottin'
else
pl:SetVelocity(Vector(0,1000,500))
end
end
end
end
[/code]
[/QUOTE]
You can only define entity functions like that on SENTs.
So then what would I use?
[QUOTE=mdew355;25499371]So then what would I use?[/QUOTE]
Normally I would tell you to use a gamemode hook, but there aren't really any gamemode hooks that are appropriate for this. Try using a think hook, and use [b][url=http://wiki.garrysmod.com/?title=Entity.GetGroundEntity]Entity.GetGroundEntity [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] on all the players to see what they are standing on.
[QUOTE=Jcw87;25499524]Normally I would tell you to use a gamemode hook, but there aren't really any gamemode hooks that are appropriate for this. Try using a think hook, and use [b][url=http://wiki.garrysmod.com/?title=Entity.GetGroundEntity]Entity.GetGroundEntity [img_thumb]http://wiki.garrysmod.com/favicon.ico[/img_thumb][/url][/b] on all the players to see what they are standing on.[/QUOTE]
Hm, didn't work.
[QUOTE=mdew355;25508158]Hm, didn't work.[/QUOTE]
Post the code you tried.
I deleted it.
I really need help. Any more suggestions?
Sorry, you need to Log In to post a reply to this thread.