Hello bois and girls :)
I'm trying to make a RDM report for our TTT server, running ULX Admin Plugin.
This is what I'm trying to make it do:
[QUOTE]
1. You get killed by an innocent or detective, announce that to the chat.
2. You can now type: !report, to get an popup to report this incidence
-If you type: !report it will also announce to the admins that X is tempting to report Y
3. You type an custom message and it will be sent to the admins by: !asay (Via ULX) (Console code)
4. Admins can check log and take actions
[/QUOTE]
I also would like to:
[QUOTE]Display in the "RDM Manager" WHO killed you and if they were innocent or detective.[/QUOTE]
I'm running into quite a few troubles and now I'm wondering if someone would please help me out a bit :)
Got two LUA files, one for CLIENT side and one for SERVER side.
I've noticed I can't get it to display whom killed you client side.
Some help would be much appreciated :)
[B]Take a look:
[/B]
Client Script:
[CODE]net.Receive("Playerdead", function(length)
--Main GUI
local Form = vgui.Create("DFrame")
Form:SetPos(870, 370)
Form:SetSize(300, 130)
Form:SetTitle("-= Vikings RDM Report Manager =-")
Form:SetVisible(true)
Form:SetDraggable(true)
Form:SetMouseInputEnabled(true)
Form:SetKeyboardInputEnabled(true)
Form:MakePopup()
--Did you really get RDM'd?
local Label = vgui.Create("DLabel", Form)
Label:SetText ("Did you get RDM'd?")
Label:SetColor(Color(255,255,255))
Label:SetPos(5, 45)
Label:SizeToContents()
--Lets get your name, good sir.
local playername = vgui.Create("DLabel", Form)
playername:SetPos(95, 25)
playername:SetColor(Color(255,255,255))
local name = LocalPlayer():Nick()
playername:SetText("You died, ".. name ..".")
playername:SizeToContents()
--Yes.
local ButtonYes = vgui.Create("DButton")
ButtonYes:SetParent(Form)
ButtonYes:SetPos(2, 65)
ButtonYes:SetText("Yes")
ButtonYes.DoClick = function ()
Form:Close()
Form2:SetVisible(true)
end
--The "Yes." button picture.
local ButtonYesPic = vgui.Create("DImageButton", ButtonYes)
ButtonYesPic:SetMaterial("materials/icon16/tick.png")
ButtonYesPic:SetPos(1, 4)
ButtonYesPic:SizeToContents()
--False reports will lead to a punishment.
local falsereports = vgui.Create("DLabel", Form)
falsereports:SetText("Note: False reports will get you banned.")
falsereports:SetPos(70, 70)
falsereports:SetColor(Color(255,255,255))
falsereports:SizeToContents()
--No.
local ButtonNo = vgui.Create("DButton")
ButtonNo:SetParent(Form)
ButtonNo:SetPos(2, 90)
ButtonNo:SetText("No")
ButtonNo.DoClick = function ()
Form:Close()
end
--The "No." button picture.
local ButtonNoPic = vgui.Create("DImageButton", ButtonNo)
ButtonNoPic:SetMaterial("materials/icon16/cross.png")
ButtonNoPic:SetPos(1, 4)
ButtonNoPic:SizeToContents()
--The next Form GUI for the RDM typing.
Form2 = vgui.Create("DFrame")
Form2:SetPos(870, 370)
Form2:SetSize(300, 130)
Form2:SetTitle("-= Vikings RDM Manager =-")
Form2:SetVisible(false)
Form2:SetDraggable(true)
Form2:SetBackgroundBlur(true)
Form2:SetMouseInputEnabled(true)
Form2:SetKeyboardInputEnabled(true)
Form2:MakePopup()
--Examples of reporting.
local report = vgui.Create("DLabel", Form2)
report:SetPos(20, 25)
report:SetColor(Color(255,255,255))
report:SetText(" Please type here what happened. \n Ex: 'playername' shot me for being low on health.")
report:SizeToContents()
--Textbox used to report.
local reporttextbox = vgui.Create("DTextEntry", Form2)
reporttextbox:SetSize(294,20)
reporttextbox:SetPos(3, 60)
reporttextbox.OnEnter = function()
RunConsoleCommand("say", "@"..reporttextbox:GetValue());
Form2:Close()
end
--Report button - Finally used to submit the report.
local reportbutton = vgui.Create("DButton")
reportbutton:SetParent(Form2)
reportbutton:SetPos(110, 90)
reportbutton:SetText(" Report")
reportbutton.DoClick = function()
RunConsoleCommand("say", "@"..reporttextbox:GetValue());
Form2:Close()
end
--The "Report" button picture.
local reportbuttonpic = vgui.Create("DImageButton", reportbutton)
reportbuttonpic:SetMaterial("materials/icon16/report_go.png")
reportbuttonpic:SetPos(1, 3)
reportbuttonpic:SizeToContents()
end)[/CODE]
Server Script:
[CODE]if(CLIENT) then return end
hook.Add("PlayerDeath", "TTT_PlayerDeath_SayRole", function(victim, weapon, killer)
if gmod.GetGamemode().Name == "Trouble in Terrorist Town" then
if killer:IsPlayer() then
victim:ChatPrint("You were killed by "..killer:GetName()..", he was "..string.Capitalize(killer:GetRoleString())..". Report this? Type: !report")
hook.Add( "PlayerSay", "!report", function( ply, text, public )
text = string.lower( text ) -- Make the chat message entirely lowercase
if ( string.sub( text, 1 ) == "!report" ) then
function playerdead(victim, _, killer)
if not killer:IsPlayer() then return end
net.Start("Playerdead")
net.Send(victim)
end
hook.Add("PlayerDeath","RDM",playerdead)
RunConsoleCommand("say", "@", " tempting to report: "..killer:GetName()..", he is "..string.Capitalize(killer:GetRoleString())..".");
return false
end
end )
end )
elseif killer == victim then
else
end
end
end)
[/CODE]
Your clientside stuff makes sense, but I have no idea what you are doing serverside, the tabbing is a mess, there are new functions declared within hooks, if CLIENT return end isn't needed unless this is shared, and also this:
[lua]
elseif killer == victim then
else
end
[/lua]
[editline]7th January 2015[/editline]
On second glance it looks like you have cut stuff out, if so, why?
Tabs seem all over the place...
Instead of adding a hook ( which gets overwritten ) each player death... Leave it there to begin with.
There are several options...... When a player dies from activate game, what gets set on the player? If nothing we can find:
On PlayerDeath set a variable ( all serverside ) such as victim.CanReport
On Preparing round or BeginRound reset the variable
On PlayerSay, if speaker types command, and CanReport then.... allow it. Otherwise prevent it.
Hope this helps...
Here's my kill notifier ( colors and grammar in chat ): [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_zipped_code/acecool_ttt_kill_notifier.r[/url]
Sorry, you need to Log In to post a reply to this thread.