• box death spawn code thing help me please
    14 replies, posted
i need a code to make a crate spawn out of someone when they die so how would i do that
sounds more like a request, but none the less; [lua] function Death(ply) box = ents.Create("prop_physics") -- showing it's a physics prop box:SetModel("models/props_junk/wood_crate001a_damaged.mdl") -- Setting the model if ply:Alive(false) and ply:IsPlayer() then do -- if the player (ply) isn't alive and ply is a player then box:SetPos(ply:GetPos()) -- set the position to where the player died box:Spawn() -- spawn the box end end end hook.Add( "PlayerDeath", "box", Death ) [/lua]
well i want to know how to do this so i can do things like in in the future im just a starting and the more i know the better i get so it would help to know
have you read the wiki's tutorial?
they have a tutorial wow i didnt know that
that explains things; [url]http://wiki.garrysmod.com/?title=About_the_Tutorial[/url]
thanks alot
Don't you mean if not ply:Alive()? I don't think that function takes any arguments.
[QUOTE=MegaJohnny;23618293]Don't you mean if not ply:Alive()? I don't think that function takes any arguments.[/QUOTE] That's what I was thinking :)
ok now im getting confused
instead of doing [lua] ply:Alive(false) [/lua] you would do [lua] if not ply:IsAlive() [/lua]
it returns a boolean, so I made it check the boolean
im useing fretta and was thinking of doing the command CLASS:ondeath gm_spawn ( "models/props_junk/wood_crate002a.mdl" ) or would that not work
well what exactly are you trying to do
im makeing a gamemode for the gamemode contest ( i know im going to do bad but no one else joined it besides lonewolf) and the theam is recycling and i want it so that when you die you drop a crate so someone can use it to make a base (recycle the enemy.)
Sorry, you need to Log In to post a reply to this thread.