• Airdrop type function not working correctly
    5 replies, posted
Hey guys, I have kind of a dumb question to ask. I'm working on a airdrop function and I've got a entity to spawn in front of the player but I want it to spawn higher and in front - Heres what I have so far. [lua] function WeaponDropTest(ply) local ent = ents.Create("ent_factory") --timer.Create("SpawnWep",10,0,function() if ply:GetDollars() > 1000 then ply:TakeDollars(1000) ent:SetPos(ply:GetShootPos() + ply:GetAimVector() * 1000) ent:Spawn() umsg.Start("buyGun") umsg.End() end --end) end concommand.Add("WeaponDropTest",BuyPistol) [/lua] Thanks for any help!
[lua]ent:SetPos((ply:GetShootPos() + ply:GetAimVector() * 1000)+Vector(0,0,500))[/lua]
Thank you sooo much!
No problem. Glad to help :) It may be better to do a trace to how high the skybox is then drop it just below that.
I was thinking about doing that, thanks
For your ply:GetDollars() function I recommend instead of using greater than. You use greater than or equal to. [lua]local meta = GetMetaTable("players") function meta:CanAfford( am ) if self:GetDollars() >= am then return true else return false end end [/lua] You could use that instead, so it simply returns true if you can afford the amount or false if you cannot.
Sorry, you need to Log In to post a reply to this thread.