So; Im scripting some things for my future DarkRP server (Yeah, DarkRP - so what? >:P).
I’m trying to make a Derma menu open, when the player is killed, asking wether or not he accepts the terms and rules of New Life Rule. But whenever I add the code, it makes the Gamemode unloadable, for some reason. Here’s the code:
[lua]function PlayerDies( victim, weapon, killer )
frame = vgui.Create (“DFrame”)
frame:SetPos (ScrW() / 2, ScrH() / 2)
frame:SetSize (300, 120)
frame:SetTitle (“New Life Rule”)
frame:SetText (“You died. You only remember your friends, home and job. Do not revenge your death by killing the guy who killed you.”)
accept = vgui.Create ("DButton", frame ) accept:SetPos (100, 40) accept:SetSize (50, 50) accept:SetText ("Accept!") accept.DoClick = function()frame:Close() ply:Spawn() end end decline = vgui.Create ("DButton", frame ) decline:SetPos (200, 80) decline:SetSize (50, 50) decline:SetText ("Decline!") decline.DoClick = function()frame:Close() RunConsoleCommand ("disconnect") end end
hook.Add( “PlayerDeath”, “playerDeathTest”, playerDies )[/lua]
This code is supposed to be in cl_init.lua, right?
I dont know if this is right, but if you spot the error/mistake - please write back to me with the correct code/the spotted error.
[Please dont make this to a “LAWLZ i H8S DrakRP, becuase is soks” - I dont care what you think about it]
- Thank you in advance :: Busymonkey