[CODE]AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/props/CS_militia/crate_extralargemill.mdl")
self:SetColor( Color( 47, 124, 55, 255 ) )
self:SetGravity( 100 )
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
local phys = self:GetPhysicsObject()
if phys and phys:IsValid() then
phys:Wake()
end
end
function ENT:PhysicsCollide(data, physobj)
end
function ENT:Use(activator, caller)
if activator:IsPlayer() then
self:EmitSound(Sound("items/ammopickup.wav"),70,100)
activator:PrintMessage(HUD_PRINTTALK, "You started looting the supply drop!")
activator:ConCommand( "act bow" )
timer.Create ("SupplyDropLooting", 10, 1, function()
local ent = ents.Create( "ent_kevlar_armor" )
ent:SetPos( activator:GetPos() )
ent:Spawn()
ent:Activate()
activator:Give( "weapon_rust_m4" )
activator:Give( "weapon_rust_p250" )
activator:GiveAmmo( 200, "9mm" )
activator:GiveAmmo( 100, "556" )
activator:GiveAmmo( 20, "shotgun" )
activator:Give( "ent_bandage" )
activator:Give( "ent_cloth_armor" )
activator:Give( "ent_largemedkit" )
end)
self:Remove()
end
end
[/CODE]
*Code is for you people who want to take a look.*
Hello again guys, i need some help with LUA...
I want to make that once the player used the entity, he would be frozen for about 10 secs. Before he can move again.
Is there any way to make it like i said?
You could just use a timer if that is what you want
[CODE]activator:Freeze(true)
timer.Simple(10, function() activator:Freeze(false))[/CODE]
[QUOTE=SirFrancisB;50478595]You could just use a timer if that is what you want
[CODE]activator:Freeze(true)
timer.Simple(10, function() activator:Freeze(false))[/CODE][/QUOTE]
Ok not to sound stupid but could you show me on where this is supposed to go?
Seriously?
[QUOTE=BlackSnow;50478211]once the player [b]used[/b] the entity[/QUOTE]
[img]https://i.gyazo.com/a13e1e9ef0a53178dc84646e8f6bbf36.png[/img]
Edit:
[img]https://i.gyazo.com/d65746bf120c6d414a5fd5910455a309.png[/img]
Did you write any part of that code?
[QUOTE=BlackSnow;50478734]Ok not to sound stupid but could you show me on where this is supposed to go?[/QUOTE]
You should also check if the player entity is valid on the timer, in the case they disconnect before 10 seconds.
[code]
local whenToUnfreeze = 10
function ENT:Use(activator, caller, usetype, value)
activator:Freeze(true)
timer.Simple(whenToUnfreeze, function()
if IsValid(activator) then
activator:Freeze(false)
end
end )
end
[/code]
[QUOTE=NeatNit;50478815]Seriously?
[img]https://i.gyazo.com/a13e1e9ef0a53178dc84646e8f6bbf36.png[/img][/QUOTE]
"unexpected symbol near ')' "
I place it where it is supposed to happen when it is activated, but sadly i get this error
This error is from line 2
-snip shit-
Use my code
:snip:
put some effort in, do you want to make your stuff work or do you want other people to make your stuff work?
Sorry, you need to Log In to post a reply to this thread.