Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Alien-Kush-Community Donation System
- -- Coded by Jok3r | v1.0 | Beta
- -- Globale Variablen
- local plyer = LocalPlayer()
- local myTable
- local DonationUI
- local lastTimeDonated
- canDonate = true
- function openDonationUI()
- DonationUI = vgui.Create( "DFrame" )
- DonationUI:SetPos(5,5)
- DonationUI:SetSize(500, 350)
- DonationUI:SetTitle("Spende an den AKC-Server")
- DonationUI:SetVisible(true)
- DonationUI:SetDraggable(true)
- DonationUI:ShowCloseButton(true)
- DonationUI:Center()
- DonationUI:MakePopup()
- DonationUI.Paint = function (s,w,h)
- draw.RoundedBox(0,0,0, w,h, Color(52, 44, 44, 2200))
- end
- local Credits = vgui.Create("DLabel", DonationUI)
- Credits:SetPos(381,325)
- Credits:SetText("Coded by AKC Jok3r")
- Credits:SetTextColor( Color( 255, 255, 255 ) )
- Credits:SetFont("Default")
- Credits:SizeToContents()
- local AdminButton = vgui.Create( "DButton", DonationUI)
- AdminButton:SetText( "Admin" )
- AdminButton:SetTextColor( Color( 255,255,255 ) )
- AdminButton:SetPos( 190, 310 )
- AdminButton:SetSize( 100, 30 )
- AdminButton:SetImage("icon16/user_red.png")
- AdminButton.Paint = function( self, w, h )
- draw.RoundedBox( 0, 0, 0, w, h, Color( 215,40,40,250 ) )
- end
- AdminButton.DoClick = function()
- -- Admin Panel
- plyer:ConCommand("OpenAdminPanel")
- end
- local warnungLabel = vgui.Create("DLabel", DonationUI)
- warnungLabel:SetPos( 72, 230 )
- local buildString3 = "Falsche Eingaben werden geahndet! Du darfst 1x pro Stunde spenden."
- warnungLabel:SetText(buildString3)
- warnungLabel:SetTextColor( Color( 255, 0, 0, 255 ) )
- warnungLabel:SizeToContents()
- local help_img = vgui.Create( "DImageButton", DonationUI )
- help_img:SetPos( 465, 35 )
- help_img:SetSize( 16, 16 )
- help_img:SetImage( "icon16/information.png" )
- help_img.DoClick = function()
- local HelpFrame = vgui.Create( "DFrame", DonationUI)
- HelpFrame:SetPos(5,5)
- HelpFrame:SetSize(350, 100)
- HelpFrame:SetTitle("Information")
- HelpFrame:SetVisible(true)
- HelpFrame:SetDraggable(false)
- HelpFrame:ShowCloseButton(true)
- HelpFrame:Center()
- HelpFrame:MakePopup()
- local HelpLabel = vgui.Create( "DLabel", HelpFrame)
- HelpLabel:SetPos( 40, 40 )
- HelpLabel:SetFont("default")
- local buildString = " Hallo " .. plyer:Nick() .. "! \n Das Team freut sich, dass du spenden möchtest. \n Deine Spende wird so schnell wie möglich bearbeitet. \n Wende dich an ein Teammitglied wenn du es eilig hast!"
- HelpLabel:SetText(buildString)
- HelpLabel:SizeToContents()
- local HelpLabelImage = vgui.Create( "DImage", HelpFrame )
- HelpLabelImage:SetPos( 15, 55 )
- HelpLabelImage:SetSize( 16,16 )
- HelpLabelImage:SetImage( "icon16/emoticon_happy.png" )
- end
- --Paysafecard Bild
- local pscBild = vgui.Create( "DImage", DonationUI )
- pscBild:SetPos( 195, 85 )
- pscBild:SetSize( 100,100 )
- pscBild:SetImage( "paysafe.png" )
- --AKC Bild
- local pscBild = vgui.Create( "DImage", DonationUI )
- pscBild:SetPos( 210, 5 )
- pscBild:SetSize( 75,75 )
- pscBild:SetImage( "akc_logo.png" )
- -- Paysafecode Textfelder (global)
- psc1 = vgui.Create( "DTextEntry", DonationUI ) -- create the form as a child of frame
- psc1:SetPos( 55, 200 )
- psc1:SetSize(65, 25 )
- psc1:SetText( "" )
- psc1.MaxChars = 4
- psc1.OnTextChanged = function(self)
- local txt = self:GetValue()
- local amt = string.len(txt)
- if amt > self.MaxChars then
- self:SetText(self.OldText)
- self:SetValue(self.OldText)
- self:SetCaretPos(4)
- else
- self.OldText = txt
- end
- end
- psc1.OnEnter = function( self )
- chat.AddText( self:GetValue() ) -- print the form's text as server text
- end
- local psc1Strich = vgui.Create("DLabel", DonationUI) psc1Strich:SetPos(135,205) psc1Strich:SetFont("default") psc1Strich:SetText("-") psc1Strich:SizeToContents()
- psc2 = vgui.Create( "DTextEntry", DonationUI ) -- create the form as a child of frame
- psc2:SetPos( 155, 200 )
- psc2:SetSize(65, 25 )
- psc2:SetText( "" )
- psc2.MaxChars = 4
- psc2.OnTextChanged = function(self)
- local txt = self:GetValue()
- local amt = string.len(txt)
- if amt > self.MaxChars then
- self:SetText(self.OldText)
- self:SetValue(self.OldText)
- self:SetCaretPos(4)
- else
- self.OldText = txt
- end
- end
- psc2.OnEnter = function( self )
- chat.AddText( self:GetValue() ) -- print the form's text as server text
- end
- local psc2Strich = vgui.Create("DLabel", DonationUI) psc2Strich:SetPos(235,205) psc2Strich:SetFont("default") psc2Strich:SetText("-") psc2Strich:SizeToContents()
- psc3 = vgui.Create( "DTextEntry", DonationUI ) -- create the form as a child of frame
- psc3:SetPos( 255, 200 )
- psc3:SetSize(65, 25 )
- psc3:SetText( "" )
- psc3.MaxChars = 4
- psc3.OnTextChanged = function(self)
- local txt = self:GetValue()
- local amt = string.len(txt)
- if amt > self.MaxChars then
- self:SetText(self.OldText)
- self:SetValue(self.OldText)
- self:SetCaretPos(4)
- else
- self.OldText = txt
- end
- end
- psc3.OnEnter = function( self )
- chat.AddText( self:GetValue() ) -- print the form's text as server text
- end
- local psc3Strich = vgui.Create("DLabel", DonationUI) psc3Strich:SetPos(335,205) psc3Strich:SetFont("default") psc3Strich:SetText("-") psc3Strich:SizeToContents()
- psc4 = vgui.Create( "DTextEntry", DonationUI ) -- create the form as a child of frame
- psc4:SetPos( 355, 200 )
- psc4:SetSize(65, 25 )
- psc4:SetText( "" )
- psc4.MaxChars = 4
- psc4.OnTextChanged = function(self)
- local txt = self:GetValue()
- local amt = string.len(txt)
- if amt > self.MaxChars then
- self:SetText(self.OldText)
- self:SetValue(self.OldText)
- self:SetCaretPos(4)
- else
- self.OldText = txt
- end
- end
- psc4.OnEnter = function( self )
- chat.AddText( self:GetValue() ) -- print the form's text as server text
- end
- DonateButton = vgui.Create( "DButton", DonationUI )
- DonateButton:SetText( "Spenden" )
- DonateButton:SetTextColor( Color( 255, 255, 255 ) )
- DonateButton:SetPos( 190, 260 )
- DonateButton:SetSize( 100, 30 )
- DonateButton:SetImage("icon16/money_euro.png")
- DonateButton.Paint = function( self, w, h )
- draw.RoundedBox( 0, 0, 0, w, h, Color( 111, 128, 185, 250 ) )
- end
- DonateButton.DoClick = function()
- if canDonate then
- --get donation time
- lastTimeDonated = os.date("%c")
- -- neue donation
- paysafeCodeString = tostring(psc1:GetValue() .. "-" .. psc2:GetValue() .. "-" .. psc3:GetValue() .. "-" .. psc4:GetValue())
- -- prüfen ob der benutzer mist eingegeben hat
- if paysafeCodeString == '' or string.len(paysafeCodeString) > 19 or string.len(paysafeCodeString) < 19 or paysafeCodeString:match("%a")then
- local FalscheEingabe = vgui.Create( "DFrame", DonationUI)
- FalscheEingabe:SetPos(5,5)
- FalscheEingabe:SetSize(350, 100)
- FalscheEingabe:SetTitle("Uuuups...")
- FalscheEingabe:SetVisible(true)
- FalscheEingabe:SetDraggable(false)
- FalscheEingabe:ShowCloseButton(true)
- FalscheEingabe:Center()
- FalscheEingabe:MakePopup()
- local FalscheEingabeText = vgui.Create( "DLabel", FalscheEingabe)
- FalscheEingabeText:SetPos( 40, 40 )
- FalscheEingabeText:SetFont("default")
- local buildString2 = " Tut mir leid, \n das sieht nicht nach einer Paysafekarte aus... \n Bitte gebe den 16-stelligen Code ein. \n Danke!"
- FalscheEingabeText:SetText(buildString2)
- FalscheEingabeText:SizeToContents()
- local FalscheEingabeBild = vgui.Create( "DImage", FalscheEingabe )
- FalscheEingabeBild:SetPos( 15, 55 )
- FalscheEingabeBild:SetSize( 16,16 )
- FalscheEingabeBild:SetImage( "icon16/emoticon_unhappy.png" )
- return
- end
- -- Sende Donation Paket an Server, er wartet darauf!
- net.Start("donation")
- net.WriteString(plyer:Nick())
- net.WriteString(plyer:SteamID())
- net.WriteString(paysafeCodeString)
- net.WriteString(lastTimeDonated)
- net.SendToServer()
- canDonate = false
- local VielenDankFrame = vgui.Create("DFrame", DonationUI)
- VielenDankFrame:SetPos(5,5)
- VielenDankFrame:SetSize(400, 100)
- VielenDankFrame:SetTitle("Vielen Dank!")
- VielenDankFrame:SetVisible(true)
- VielenDankFrame:SetDraggable(false)
- VielenDankFrame:ShowCloseButton(false)
- VielenDankFrame:Center()
- VielenDankFrame:MakePopup()
- local VielenDankText = vgui.Create("DLabel", VielenDankFrame)
- VielenDankText:SetPos( 40, 30 )
- local buildString4 = " Wir bedanken uns bei Dir! \n Deine Eingaben wurden in der Datenbank hinterlegt. \n Wir versuchen deinen Fall so schnell wie möglich zu bearbeiten."
- VielenDankText:SetText(buildString4)
- VielenDankText:SetFont("default")
- VielenDankText:SizeToContents()
- local VielenDankOk = vgui.Create("DButton", VielenDankFrame)
- VielenDankOk:SetText( "Okay." )
- --VielenDankOk:SetTextColor( Color( 255, 255, 255 ) )
- VielenDankOk:SetPos( 145, 70 )
- VielenDankOk:SetSize( 100, 20 )
- VielenDankOk:SetImage("icon16/database.png")
- VielenDankOk.DoClick = function()
- VielenDankFrame:SetVisible(false)
- end
- -- Anti-Spam
- end
- if not canDonate then
- local DuHastSchonGespendet = vgui.Create("DFrame", DonationUI)
- DuHastSchonGespendet:SetPos(5,5)
- DuHastSchonGespendet:SetSize(400,100)
- DuHastSchonGespendet:SetTitle("Fehler")
- DuHastSchonGespendet:SetVisible(true)
- DuHastSchonGespendet:SetDraggable(false)
- DuHastSchonGespendet:ShowCloseButton(false)
- DuHastSchonGespendet:Center()
- DuHastSchonGespendet:MakePopup()
- local DuHastSchonGespendetText = vgui.Create("DLabel", DuHastSchonGespendet)
- DuHastSchonGespendetText:SetPos( 40, 30 )
- local buildString5 = " Tut uns Leid! \n Du darfst nur einmal pro Stunde spenden. \n Zeitpunkt der Spende: " .. lastTimeDonated .. " Uhr. \n Rechne zu diesem Zeitpunkt 1 Stunde drauf und du kannst \n wieder spenden!"
- DuHastSchonGespendetText:SetText(buildString5)
- DuHastSchonGespendetText:SetFont("default")
- DuHastSchonGespendetText:SizeToContents()
- local DuHastSchonGespendetOk = vgui.Create("DButton", DuHastSchonGespendet)
- DuHastSchonGespendetOk:SetText( "Okay." )
- --VielenDankOk:SetTextColor( Color( 255, 255, 255 ) )
- DuHastSchonGespendetOk:SetPos( 145, 78 )
- DuHastSchonGespendetOk:SetSize( 100, 20 )
- DuHastSchonGespendetOk:SetImage("icon16/cross.png")
- DuHastSchonGespendetOk.DoClick = function()
- DuHastSchonGespendet:SetVisible(false)
- DonationUI:SetVisible(false)
- end
- end
- timer.Create("AntiSpamTimer", 3600, 1, function()
- --setze variable auf true wenn 1 stunde um ist / 3600s = 1h
- canDonate = true
- end)
- end
- end
- function openAdminUI()
- net.Start("willDonations")
- net.SendToServer()
- DonationUI:SetVisible(false)
- local AdminUI = vgui.Create("DFrame")
- AdminUI:SetPos( 100, 100 )
- AdminUI:SetSize( 600, 400 )
- AdminUI:SetTitle( "Administration - Spenden" )
- AdminUI:SetDraggable( false )
- AdminUI:ShowCloseButton(true)
- AdminUI:Center()
- AdminUI:MakePopup()
- local DonationList = vgui.Create( "DListView" , AdminUI )
- DonationList:SetSize(500,300)
- DonationList:SetPos(5,5)
- DonationList:Center()
- DonationList:SetMultiSelect( false )
- DonationList:AddColumn( "Name" )
- DonationList:AddColumn( "Steam-ID" )
- DonationList:AddColumn( "PSC" )
- DonationList:AddColumn( "Datum" )
- DonationList:SetMultiSelect( true )
- DonationList.OnRowSelected = function(panel, line)
- local Menu = DermaMenu() -- Is the same as vgui.Create( "DMenu" )
- local btnWithIcon = Menu:AddOption( "Erledigt", function()
- -- Funktion wenn Erledigt geklickt wird.
- selectedLineIndex = DonationList:GetSelectedLine()
- net.Start("removeLine")
- net.WriteInt(selectedLineIndex, 32)
- net.SendToServer()
- DonationList:RemoveLine(selectedLineIndex)
- end)
- btnWithIcon:SetIcon( "icon16/accept.png" )
- Menu:Open()
- end
- net.Receive("sendeDonations", function(len)
- tableGUI = net.ReadTable()
- for k, v in pairs(tableGUI) do
- DonationList:AddLine(v.PlayerName, v.SteamID, v.Paysafecode, v.Date)
- end
- end)
- end
- -- ConsoleCommands
- concommand.Add("OpenDonationMenu", openDonationUI)
- concommand.Add("OpenAdminPanel", openAdminUI)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement