Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --CLIENT
- local currenthits = {}
- local function hitmenu( data )
- str=data:ReadString()
- table.insert( currenthits, str )
- print( "loaded hits!" )
- end
- usermessage.Hook( "hits", hitmenu )
- function showmenu( ply )
- local panel = vgui.Create( "DFrame")
- panel:MakePopup()
- panel:SetMouseInputEnabled(true)
- panel:SetKeyboardInputEnabled(true)
- panel:SetTitle( "Hit list" )
- panel:SetSize( 500, 400 )
- panel:SetPos( ScrW()/2-(panel:GetWide()/2), ScrH()/2-(panel:GetTall()/2) )
- local listed = vgui.Create( "DListView", panel )
- listed:SetSize( 450, 330 )
- listed:SetPos( 25, 45 )
- listed:AddColumn( "Name" )
- for k, v in pairs( currenthits ) do
- listed:AddLine(table.concat( currenthits[v] ))
- end
- end
- usermessage.Hook( "hitmenu", showmenu )
- function showclientmenu( ply )
- local panel = vgui.Create( "DFrame")
- panel:MakePopup()
- panel:SetMouseInputEnabled(true)
- panel:SetKeyboardInputEnabled(true)
- panel:SetTitle( "Place a hit!" )
- panel:SetSize( 500, 400 )
- panel:SetPos( ScrW()/2-(panel:GetWide()/2), ScrH()/2-(panel:GetTall()/2) )
- end
- usermessage.Hook( "placehitmenu", showclientmenu )
- usermessage.Hook( "newHit", function(data)
- local ply=data:ReadEntity()
- local amnt=data:ReadShort()
- ply.HitMoney=amnt
- end)
- --SERVER
- function menu( ply, text)
- if ( string.sub( text, 1, 5 ) == "!hits" ) and ply:Team() != TEAM_HIT then
- umsg.Start( "placehitmenu", ply )
- umsg.End()
- return ""
- elseif TEAM_HIT == ply:Team() then
- umsg.Start( "hitmenu", ply )
- umsg.End()
- end
- end
- hook.Add( "PlayerSay", "chat", menu )
- hits = {}
- players = {}
- function getplayers()
- end
- local function MakeHit(ply, args)
- local plyname=string.lower(string.sub(ply, 0, string.len(args)-string.find(string.reverse(args), " ")))
- local num=tonumber(string.sub(args, string.len(args)-1, string.len(args)))
- if !(plyname and num) then
- GAMEMODE:Notify(ply, 1, 4, "Your hit was not set - you probably formatted the command wrong! /hit player amount")
- return
- end
- local hitte=NULL
- for f, v in pairs(player.GetAll()) do
- if string.find(v:Nick(), plyname) then
- hitte=v
- break
- end
- end
- if IsValid(hitte) then return end
- v.HitMoney=num
- for f, v in pairs(player.GetAll()) do
- if v:Team()==TEAM_HIT then
- SendUserMessage("newHit", v, hitte, num)
- end
- end
- end
- AddChatCommand("/hit", MakeHit)
Advertisement
Add Comment
Please, Sign In to add comment