Dropping suits errors
First of all im tryna make it so the suits can be dropped, this is what my developer has made, i placed it in init.lua in darkrp folder but i get bunch of script errors and messes up my entire server
hook.Add( "PlayerSay", "SuitCommand", function( ply, text, team ) if (string.sub( text, 1, string.len("/dropsuit") ) == "/dropsuit") then ply:removeArmorSuit() if ply.armorSuit != "Speed Suit" then local crate = ents.Create(found.shipmentClass or "spawned_shipment") crate.SID = ply.SID crate:Setowning_ent(ply) crate:SetContents(armor_power, 1) crate:SetPos(Vector(tr.HitPos.x, tr.HitPos.y, tr.HitPos.z)) crate.nodupe = true crate.ammoadd = found.spareammo crate.clip1 = found.clip1 crate.clip2 = found.clip2 crate:Spawn() crate:SetPlayer(ply) if ply.armorSuit != "NanoSuit" then local crate = ents.Create(found.shipmentClass or "spawned_shipment") crate.SID = ply.SID crate:Setowning_ent(ply) crate:SetContents(armor_speed, 1) crate:SetPos(Vector(tr.HitPos.x, tr.HitPos.y, tr.HitPos.z)) crate.nodupe = true crate.ammoadd = found.spareammo crate.clip1 = found.clip1 crate.clip2 = found.clip2 crate:Spawn() crate:SetPlayer(ply) end end end )
We also tried this before and couldnt get it to work: hook.Add( "PlayerSay", "SuitCommand", function( ply, text, team ) if (string.sub( text, 1, string.len("/dropsuit") ) == "/dropsuit") then ply:removeArmorSuit() if ply.armorSuit != "Speed Suit" then local crate = ents.Create("spawned_shipment") crate:SetContents("armor_power") crate:Spawn() end elseif ply.armorSuit != "NanoSuit" then local crate = ents.Create("spawned_shipment") crate:SetContents("armor_speed") crate:Spawn() end end return "" end end )
damn i love pasting code here
--[[--------------------------------------------------------------------------- HUD ConVars ---------------------------------------------------------------------------]] local ConVars = {} local HUDWidth local HUDHeight
local Color = Color local CurTime = CurTime local cvars = cvars local DarkRP = DarkRP local draw = draw local GetConVar = GetConVar local hook = hook local IsValid = IsValid local Lerp = Lerp local localplayer local math = math local pairs = pairs local ScrW, ScrH = ScrW, ScrH local SortedPairs = SortedPairs local string = string local surface = surface local table = table local timer = timer local tostring = tostring local plyMeta = FindMetaTable("Player")
local colors = {} colors.black = Color(0, 0, 0, 255) colors.blue = Color(0, 0, 255, 255) colors.brightred = Color(200, 30, 30, 255) colors.darkred = Color(0, 0, 70, 100) colors.darkblack = Color(0, 0, 0, 200) colors.gray1 = Color(0, 0, 0, 155) colors.gray2 = Color(51, 58, 51,100) colors.red = Color(255, 0, 0, 255) colors.white = Color(255, 255, 255, 255) colors.white1 = Color(255, 255, 255, 200)
local function ReloadConVars() ConVars = { background = {0,0,0,100}, Healthbackground = {0,0,0,200}, Healthforeground = {140,0,0,180}, HealthText = {255,255,255,200}, Job1 = {0,0,150,200}, Job2 = {0,0,0,255}, salary1 = {0,150,0,200}, salary2 = {0,0,0,255} }
end ReloadConVars()
local Scrw, Scrh, RelativeX, RelativeY --[[--------------------------------------------------------------------------- HUD separate Elements ---------------------------------------------------------------------------]] local Health = 0 local function DrawHealth() local maxHealth = localplayer:GetMaxHealth() local myHealth = localplayer:Health() Health = math.min(maxHealth, (Health == myHealth and Health) or Lerp(0.1, Health, myHealth))
end
local salaryText, JobWalletText local function DrawInfo() salaryText = salaryText or DarkRP.getPhrase("salary", DarkRP.formatMoney(localplayer:getDarkRPVar("salary")), "")
end
local Page = Material("icon16/page_white_text.png") local function GunLicense() if localplayer:getDarkRPVar("HasGunlicense") then surface.SetMaterial(Page) surface.SetDrawColor(255, 255, 255, 255) surface.DrawTexturedRect(RelativeX + HUDWidth, Scrh - 34, 32, 32) end end
local agendaText local function Agenda() local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_Agenda") if shouldDraw == false then return end
end
hook.Add("DarkRPVarChanged", "agendaHUD", function(ply, var, _, new) if ply ~= localplayer then return end if var == "agenda" and new then agendaText = DarkRP.textWrap(new:gsub("//", "\n"):gsub("\n", "\n"), "DarkRPHUD1", 440) else agendaText = nil end
end)
local VoiceChatTexture = surface.GetTextureID("voice/icntlk_pl") local function DrawVoiceChat() if localplayer.DRPIsTalking then local _, chboxY = chat.GetChatBoxPos()
end
local function LockDown() local chbxX, chboxY = chat.GetChatBoxPos() if GetGlobalBool("DarkRP_LockDown") then local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_LockdownHUD") if shouldDraw == false then return end local cin = (math.sin(CurTime()) + 1) / 2 local chatBoxSize = math.floor(Scrh / 4) draw.DrawNonParsedText(DarkRP.getPhrase("lockdown_started"), "ScoreboardSubtitle", chbxX, chboxY + chatBoxSize, Color(cin * 255, 0, 255 - (cin * 255), 255), TEXT_ALIGN_LEFT) end end
local Arrested = function() end
usermessage.Hook("GotArrested", function(msg) local StartArrested = CurTime() local ArrestedUntil = msg:ReadFloat()
end)
local AdminTell = function() end
usermessage.Hook("AdminTell", function(msg) timer.Remove("DarkRP_AdminTell") local Message = msg:ReadString()
end)
--[[--------------------------------------------------------------------------- Drawing the HUD elements such as Health etc. ---------------------------------------------------------------------------]] local function DrawHUD() local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_HUD") if shouldDraw == false then return end
end
--[[--------------------------------------------------------------------------- Entity HUDPaint things ---------------------------------------------------------------------------]] -- Draw a player's name, health and/or job above the head -- This syntax allows for easy overriding plyMeta.drawPlayerInfo = plyMeta.drawPlayerInfo or function(self) local pos = self:EyePos()
end
-- Draw wanted information above a player's head -- This syntax allows for easy overriding plyMeta.drawWantedInfo = plyMeta.drawWantedInfo or function(self) if not self:Alive() then return end
end
--[[--------------------------------------------------------------------------- The Entity display: draw HUD information about entities ---------------------------------------------------------------------------]] local function DrawEntityDisplay() local shouldDraw, players = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_EntityDisplay") if shouldDraw == false then return end
end
--[[--------------------------------------------------------------------------- Drawing death notices ---------------------------------------------------------------------------]] function GM:DrawDeathNotice(x, y) if not GAMEMODE.Config.showdeaths then return end self.Sandbox.DrawDeathNotice(self, x, y) end
--[[--------------------------------------------------------------------------- Display notifications ---------------------------------------------------------------------------]] local function DisplayNotify(msg) local txt = msg:ReadString() GAMEMODE:AddNotify(txt, msg:ReadShort(), msg:ReadLong()) surface.PlaySound("buttons/lightswitch2.wav")
end usermessage.Hook("_Notify", DisplayNotify)
--[[--------------------------------------------------------------------------- Remove some elements from the HUD in favour of the DarkRP HUD ---------------------------------------------------------------------------]] function GM:HUDShouldDraw(name) if name == "CHudHealth" or name == "CHudBattery" or name == "CHudSuitPower" or (HelpToggled and name == "CHudChat") then return false else return self.Sandbox.HUDShouldDraw(self, name) end end
--[[--------------------------------------------------------------------------- Disable players' names popping up when looking at them ---------------------------------------------------------------------------]] function GM:HUDDrawTargetID() return false end
--[[--------------------------------------------------------------------------- Actual HUDPaint hook ---------------------------------------------------------------------------]] function GM:HUDPaint() localplayer = localplayer and IsValid(localplayer) and localplayer or LocalPlayer() if not IsValid(localplayer) then return end
end
ye all i see is bunch of balh blah blah, im just gonna wait for my developer to tell me what to do
Edited The developer does no know what u pasted either
ByLAST OF USat 28th of August 2018 09:14:04
ye all i see is bunch of balh blah blah, im just gonna wait for my developer to tell me what to doEditedThe developer does no know what u pasted either
Sounds like your developer has a DarkRP dev certificate if he doesn't know what Lapin posted.
should i just paste it in init.lua?
Change his rank to jobs.lua developer.
No, you don't edit gamemode files. Create a seperate serverside file in 'lua/autorun/server' and put it there.
u want me to paste what he pasted or what i pasted?
Edited Btw i pasted both in the server folder and they all didnt do anything so ye
No man, you don't just blatantly put any code in your server, thats how you get backdoors and get your server hacked. Never put any third party code in your server unless you trust it. Get a proper developer who can do more than edit a text file called jobs.lua. You yourself should get some proper knowledge on how to atleast understand code that is being given to you.
Ive been trying for a 2 weeks to get this done, but i need help
goto https://forum.facepunch.com/f/gmoddev if u want lua help
ByLAST OF USat 28th of August 2018 09:14:04
ye all i see is bunch of balh blah blah, im just gonna wait for my developer to tell me what to doEditedThe developer does no know what u pasted either
People who can make GayRP jobs are not developers. A developer would have understood what Lapin posted. Get a new developer.