• Respawn Time Help
    2 replies, posted
Hello, So i got this problem with this script i [URL="http://facepunch.com/showthread.php?t=1003419&p=25062685&viewfull=1#post25062685"]found.[/URL] [lua] CreateConVar("respawnsecs", 10, FCVAR_NOTIFY) function SetRespawnSeconds(ply, cmd, args) if ply:IsAdmin() then RunConsoleCommand("respawnsecs", tonumber(args[1])) else return end end concommand.Add("setrespawnsecs", SetRespawnSeconds) local function RespawnPlayer(ply) ply:UnLock() ply:ChatPrint("You can respawn now") end function ForcePlayerRespawn(ply) if GetConVarNumber("respawnsecs") ~= 0 then ply:Lock() ply:ChatPrint("You have to wait " .. GetConVarNumber("respawnsecs") .. " seconds before you can respawn") timer.Simple(GetConVarNumber("respawnsecs"), RespawnPlayer, ply) end end hook.Add("PlayerDeath", "ForcePlayerRespawn", ForcePlayerRespawn) [/lua] It is giving me the error: [ERROR] lua/autorun/playerspawn.lua:12: attempt to index local 'ply' (a nil value) 1. unknown - lua/autorun/playerspawn.lua:12 Timer Failed! [Simple][@lua/autorun/playerspawn.lua (line 20)] I pretty sure i know why i get this, but since i'm not good at lua i don't know how to solve it. If someone could help me i would really appreciate it.
[lua]timer.Simple(GetConVarNumber("respawnsecs"), function() RespawnPlayer(ply) end)[/lua]
Thank you! :dance:
Sorry, you need to Log In to post a reply to this thread.