mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 21:53:46 +03:00
Upload
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
SWEP.Base = "weapon_base"
|
||||
SWEP.PrintName = "Bavul"
|
||||
SWEP.Category = "HL2 RP"
|
||||
SWEP.Author = "Exobit"
|
||||
SWEP.Instructions = "Eski moda bir bavuldan başka bir şey değil."
|
||||
|
||||
|
||||
SWEP.ViewModel = ""
|
||||
SWEP.WorldModel = "models/weapons/w_suitcase_passenger.mdl"
|
||||
SWEP.ViewModelFOV = 47
|
||||
SWEP.DrawAmmo = false
|
||||
SWEP.DrawCrosshair = false
|
||||
SWEP.HoldType = "normal"
|
||||
SWEP.UseHands = true
|
||||
SWEP.Weight = 0
|
||||
SWEP.AutoSwitchTo = false
|
||||
SWEP.Spawnable = false
|
||||
SWEP.Drop = false
|
||||
SWEP.IsAlwaysLowered = true
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType(self.HoldType)
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack() end
|
||||
function SWEP:SecondaryAttack() end
|
||||
|
||||
function SWEP:CanPrimaryAttack()
|
||||
return false
|
||||
end
|
||||
|
||||
function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha )
|
||||
y = y + 10
|
||||
x = x + 10
|
||||
wide = wide -20
|
||||
|
||||
surface.SetDrawColor( 255, 255, 255, alpha )
|
||||
surface.SetMaterial( Material( "hud/"..self.ClassName..".png"))
|
||||
|
||||
surface.DrawTexturedRect( x + wide/4 + 0.5,y,wide / 2,wide / 2)
|
||||
end
|
||||
|
||||
// https://wiki.facepunch.com/gmod/WEAPON:DrawWorldModel
|
||||
|
||||
if CLIENT then
|
||||
function SWEP:Initialize()
|
||||
self.worldModel = ClientsideModel(self.WorldModel)
|
||||
self.worldModel:SetNoDraw(true)
|
||||
end
|
||||
|
||||
function SWEP:DrawWorldModel()
|
||||
local owner = self.Owner
|
||||
local worldModel = self.worldModel
|
||||
|
||||
if owner and worldModel then
|
||||
local offsetVec = Vector(4.8, 0, 0)
|
||||
local offsetAng = Angle(260, 0, 0)
|
||||
|
||||
local boneid = owner:LookupBone("ValveBiped.Bip01_R_Hand")
|
||||
if !boneid then return end
|
||||
|
||||
local matrix = owner:GetBoneMatrix(boneid)
|
||||
if !matrix then return end
|
||||
|
||||
local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())
|
||||
|
||||
worldModel:SetPos(newPos)
|
||||
worldModel:SetAngles(newAng)
|
||||
worldModel:SetupBones()
|
||||
|
||||
worldModel:DrawModel()
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:OnRemove()
|
||||
if IsValid(self.worldModel) then
|
||||
self.worldModel:Remove()
|
||||
self.worldModel = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,142 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
ITEM.name = "Bavul"
|
||||
ITEM.description = "Taşımak istemediğiniz her şeyi taşımaya hazır küçük bir bavul."
|
||||
ITEM.model = Model("models/weapons/w_suitcase_passenger.mdl")
|
||||
|
||||
if (CLIENT) then
|
||||
function ITEM:PaintOver(item, w, h)
|
||||
if (item:GetData("equip")) then
|
||||
surface.SetDrawColor(110, 255, 110, 100)
|
||||
surface.DrawOutlinedRect(1, 1, w - 2, h - 2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ITEM.functions.Equip = {
|
||||
name = "Kuşan",
|
||||
tip = "equipTip",
|
||||
icon = "icon16/tick.png",
|
||||
OnRun = function(item)
|
||||
local client = item.player
|
||||
if client then
|
||||
client:Give("ix_suitcase")
|
||||
end
|
||||
item:SetData("equip", true)
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(item)
|
||||
local client = item.player
|
||||
local character = client:GetCharacter()
|
||||
local characterInv = character:GetInventory()
|
||||
if client then
|
||||
if client:HasWeapon("ix_suitcase") then
|
||||
return false
|
||||
end
|
||||
if character and characterInv then
|
||||
if characterInv:HasItem(item.uniqueID) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.EquipUn = {
|
||||
name = "Çıkar",
|
||||
tip = "unequipTip",
|
||||
icon = "icon16/cross.png",
|
||||
OnRun = function(item)
|
||||
local client = item.player
|
||||
if client then
|
||||
client:StripWeapon("ix_suitcase")
|
||||
end
|
||||
item:SetData("equip", false)
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(item)
|
||||
local client = item.player
|
||||
if client then
|
||||
if client:HasWeapon("ix_suitcase") then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
}
|
||||
|
||||
function ITEM:CanTransfer(oldInventory, newInventory)
|
||||
if (newInventory and self:GetData("equip")) then
|
||||
return false
|
||||
end
|
||||
|
||||
local index = self:GetData("id")
|
||||
if (newInventory) then
|
||||
if (newInventory.vars and newInventory.vars.isBag and !newInventory.vars.isContainer) then
|
||||
return false
|
||||
end
|
||||
|
||||
local index2 = newInventory:GetID()
|
||||
|
||||
if (index == index2) then
|
||||
return false
|
||||
end
|
||||
|
||||
for _, v in pairs(self:GetInventory():GetItems()) do
|
||||
if (v:GetData("id") == index2) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
if index2 and newInventory.vars then
|
||||
for _, v in pairs(newInventory:GetItems()) do
|
||||
if v.name == self.name then
|
||||
if newInventory:GetOwner() then
|
||||
if v.name == "Bavul" then
|
||||
newInventory:GetOwner():NotifyLocalized("Birden fazla bavul taşıyamazsın!")
|
||||
else
|
||||
newInventory:GetOwner():NotifyLocalized("Bu çantadan birden fazlasını taşıyamazsın!")
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return !newInventory or newInventory:GetID() != oldInventory:GetID() or newInventory.vars.isBag
|
||||
end
|
||||
|
||||
function ITEM:OnRemoved()
|
||||
local inventory = ix.item.inventories[self.invID]
|
||||
local owner = inventory.GetOwner and inventory:GetOwner()
|
||||
|
||||
if (IsValid(owner) and owner:IsPlayer()) then
|
||||
local weapon = owner:GetWeapon("ix_suitcase")
|
||||
|
||||
if (IsValid(weapon)) then
|
||||
owner:StripWeapon("ix_suitcase")
|
||||
end
|
||||
end
|
||||
|
||||
local index = self:GetData("id")
|
||||
if (index) then
|
||||
local query = mysql:Delete("ix_items")
|
||||
query:Where("inventory_id", index)
|
||||
query:Execute()
|
||||
|
||||
query = mysql:Delete("ix_inventories")
|
||||
query:Where("inventory_id", index)
|
||||
query:Execute()
|
||||
end
|
||||
end
|
||||
39
gamemodes/darkrp/plugins/suitcase/sh_plugin.lua
Normal file
39
gamemodes/darkrp/plugins/suitcase/sh_plugin.lua
Normal file
@@ -0,0 +1,39 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
PLUGIN.name = "Suitcase"
|
||||
PLUGIN.description = "Adds a wearable suitcase"
|
||||
PLUGIN.author = "Exobit"
|
||||
|
||||
function PLUGIN:PlayerLoadedCharacter(client, character)
|
||||
local characterInv = character:GetInventory()
|
||||
local suitcase = characterInv:HasItem("suitcase")
|
||||
if suitcase then
|
||||
suitcase:SetData("equip", false)
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:DoPlayerDeath(client, attacker, damageinfo)
|
||||
local character = client:GetCharacter()
|
||||
if (!character) then return end
|
||||
|
||||
local inventory = character:GetInventory()
|
||||
if (character and inventory) then
|
||||
if inventory:HasItem("suitcase") then
|
||||
local item = inventory:HasItem("suitcase")
|
||||
item:SetData("equip", false)
|
||||
item.player = client
|
||||
item.functions.EquipUn.OnRun(item)
|
||||
item.player = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user