Changer le modèle des clés

  • Initiateur de la discussion
ShotenIG

ShotenIG

Nouveau né
Messages
22
Score réaction
5
Points
20
Bonjour à tous,

J'aimerais pouvoir faire en sorte que les clés soient avec ce modèle :

https://steamcommunity.com/sharedfiles/filedetails/?id=704317952

J'ai juste modifié la texture qui est dessus et je voudrais le mettre sur mon serveur mais je n'y arrive pas :confused:
J'ai d'abord été dans \steamapps\common\garrysmod\gamemodes\darkrp\content\materials\vgui\entities
et j'ai remplacer le keys.vtf avec ma texture mais après je ne sais pas quoi faire.

Merci de m'aider, ce serait sympa :)
 
BCZ Gaming

BCZ Gaming

Psychopathe
Messages
1 301
Score réaction
129
Points
275
ShotenIG à dit:
Bonjour à tous,

J'aimerais pouvoir faire en sorte que les clés soient avec ce modèle :

https://steamcommunity.com/sharedfiles/filedetails/?id=704317952

J'ai juste modifié la texture qui est dessus et je voudrais le mettre sur mon serveur mais je n'y arrive pas :confused:
J'ai d'abord été dans \steamapps\common\garrysmod\gamemodes\darkrp\content\materials\vgui\entities
et j'ai remplacer le keys.vtf avec ma texture mais après je ne sais pas quoi faire.

Merci de m'aider, ce serait sympa :)
Number one. Tu n'a pas le droit de faire sa. C'est du vole. Et sinon demande à @enzoferrarie . Il me la fait.
 
  • Initiateur de la discussion
ShotenIG

ShotenIG

Nouveau né
Messages
22
Score réaction
5
Points
20
Zappy#ORIGINAL à dit:
Number one. Tu n'a pas le droit de faire sa. C'est du vole. Et sinon demande à @enzoferrarie . Il me la fait.
Si, dans la description de l'addon il est écrit qu'on a le droit de le modifier
 
enzoFR60

enzoFR60

Geek suprême
Messages
90
Score réaction
21
Points
115
Voila tien :
dans addons, tu crée un dossier (exemple : clesdarkrp) dedans tu crée un dossier lua, dans lua tu crée un dossier weapons, dedans tu crée un dossier clesdarkrp, ensuite tu fait ça :
Code:
include('shared.lua')
SWEP.PrintName = "Clés"
SWEP.Slot = 1
SWEP.SlotPos = 1
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = false
SWEP.HoldType = "pistol"
SWEP.VElements = { ["PROP"] = { type = "Model", model = "models/sentry/pgkey.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(5, 2, -5), angle = Angle(15, -20, 0), size = Vector(1,1,1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
SWEP.WElements = { ["PROPP"] = { type = "Model", model = "models/sentry/pgkey.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 1.2, -5), angle = Angle(7, -6, 0), size = Vector(1,1,1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}

function SWEP:Initialize() if CLIENT then self.VElements = table.FullCopy( self.VElements ) self.WElements = table.FullCopy( self.WElements ) self.ViewModelBoneMods = table.FullCopy( self.ViewModelBoneMods ) self:CreateModels(self.VElements) // create viewmodels self:CreateModels(self.WElements) // create worldmodels if IsValid(self.Owner) then local vm = self.Owner:GetViewModel() if IsValid(vm) then self:ResetBonePositions(vm) if (self.ShowViewModel == nil or self.ShowViewModel) then vm:SetColor(Color(255,255,255,255)) else vm:SetColor(Color(255,255,255,1)) vm:SetMaterial("Debug/hsv") end end end end
end
function SWEP:Holster() if CLIENT and IsValid(self.Owner) then local vm = self.Owner:GetViewModel() if IsValid(vm) then self:ResetBonePositions(vm) end end return true
end
function SWEP:OnRemove() self:Holster()
end
if CLIENT then SWEP.vRenderOrder = nil function SWEP:ViewModelDrawn() local vm = self.Owner:GetViewModel() if !IsValid(vm) then return end if (!self.VElements) then return end self:UpdateBonePositions(vm) if (!self.vRenderOrder) then self.vRenderOrder = {} for k, v in pairs( self.VElements ) do if (v.type == "Model") then table.insert(self.vRenderOrder, 1, k) elseif (v.type == "Sprite" or v.type == "Quad") then table.insert(self.vRenderOrder, k) end end end for k, name in ipairs( self.vRenderOrder ) do local v = self.VElements[name] if (!v) then self.vRenderOrder = nil break end if (v.hide) then continue end local model = v.modelEnt local sprite = v.spriteMaterial if (!v.bone) then continue end local pos, ang = self:GetBoneOrientation( self.VElements, v, vm ) if (!pos) then continue end if (v.type == "Model" and IsValid(model)) then model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ) ang:RotateAroundAxis(ang:Up(), v.angle.y) ang:RotateAroundAxis(ang:Right(), v.angle.p) ang:RotateAroundAxis(ang:Forward(), v.angle.r) model:SetAngles(ang) local matrix = Matrix() matrix:Scale(v.size) model:EnableMatrix( "RenderMultiply", matrix ) if (v.material == "") then model:SetMaterial("") elseif (model:GetMaterial() != v.material) then model:SetMaterial( v.material ) end if (v.skin and v.skin != model:GetSkin()) then model:SetSkin(v.skin) end if (v.bodygroup) then for k, v in pairs( v.bodygroup ) do if (model:GetBodygroup(k) != v) then model:SetBodygroup(k, v) end end end if (v.surpresslightning) then render.SuppressEngineLighting(true) end render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255) render.SetBlend(v.color.a/255) model:DrawModel() render.SetBlend(1) render.SetColorModulation(1, 1, 1) if (v.surpresslightning) then render.SuppressEngineLighting(false) end elseif (v.type == "Sprite" and sprite) then local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z render.SetMaterial(sprite) render.DrawSprite(drawpos, v.size.x, v.size.y, v.color) elseif (v.type == "Quad" and v.draw_func) then local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ang:RotateAroundAxis(ang:Up(), v.angle.y) ang:RotateAroundAxis(ang:Right(), v.angle.p) ang:RotateAroundAxis(ang:Forward(), v.angle.r) cam.Start3D2D(drawpos, ang, v.size) v.draw_func( self ) cam.End3D2D() end end end SWEP.wRenderOrder = nil function SWEP:DrawWorldModel() if (self.ShowWorldModel == nil or self.ShowWorldModel) then self:DrawModel() end if (!self.WElements) then return end if (!self.wRenderOrder) then self.wRenderOrder = {} for k, v in pairs( self.WElements ) do if (v.type == "Model") then table.insert(self.wRenderOrder, 1, k) elseif (v.type == "Sprite" or v.type == "Quad") then table.insert(self.wRenderOrder, k) end end end if (IsValid(self.Owner)) then bone_ent = self.Owner else bone_ent = self end for k, name in pairs( self.wRenderOrder ) do local v = self.WElements[name] if (!v) then self.wRenderOrder = nil break end if (v.hide) then continue end local pos, ang if (v.bone) then pos, ang = self:GetBoneOrientation( self.WElements, v, bone_ent ) else pos, ang = self:GetBoneOrientation( self.WElements, v, bone_ent, "ValveBiped.Bip01_R_Hand" ) end if (!pos) then continue end local model = v.modelEnt local sprite = v.spriteMaterial if (v.type == "Model" and IsValid(model)) then model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ) ang:RotateAroundAxis(ang:Up(), v.angle.y) ang:RotateAroundAxis(ang:Right(), v.angle.p) ang:RotateAroundAxis(ang:Forward(), v.angle.r) model:SetAngles(ang) local matrix = Matrix() matrix:Scale(v.size) model:EnableMatrix( "RenderMultiply", matrix ) if (v.material == "") then model:SetMaterial("") elseif (model:GetMaterial() != v.material) then model:SetMaterial( v.material ) end if (v.skin and v.skin != model:GetSkin()) then model:SetSkin(v.skin) end if (v.bodygroup) then for k, v in pairs( v.bodygroup ) do if (model:GetBodygroup(k) != v) then model:SetBodygroup(k, v) end end end if (v.surpresslightning) then render.SuppressEngineLighting(true) end render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255) render.SetBlend(v.color.a/255) model:DrawModel() render.SetBlend(1) render.SetColorModulation(1, 1, 1) if (v.surpresslightning) then render.SuppressEngineLighting(false) end elseif (v.type == "Sprite" and sprite) then local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z render.SetMaterial(sprite) render.DrawSprite(drawpos, v.size.x, v.size.y, v.color) elseif (v.type == "Quad" and v.draw_func) then local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ang:RotateAroundAxis(ang:Up(), v.angle.y) ang:RotateAroundAxis(ang:Right(), v.angle.p) ang:RotateAroundAxis(ang:Forward(), v.angle.r) cam.Start3D2D(drawpos, ang, v.size) v.draw_func( self ) cam.End3D2D() end end end function SWEP:GetBoneOrientation( basetab, tab, ent, bone_override ) local bone, pos, ang if (tab.rel and tab.rel != "") then local v = basetab[tab.rel] if (!v) then return end pos, ang = self:GetBoneOrientation( basetab, v, ent ) if (!pos) then return end pos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ang:RotateAroundAxis(ang:Up(), v.angle.y) ang:RotateAroundAxis(ang:Right(), v.angle.p) ang:RotateAroundAxis(ang:Forward(), v.angle.r) else bone = ent:LookupBone(bone_override or tab.bone) if (!bone) then return end pos, ang = Vector(0,0,0), Angle(0,0,0) local m = ent:GetBoneMatrix(bone) if (m) then pos, ang = m:GetTranslation(), m:GetAngles() end if (IsValid(self.Owner) and self.Owner:IsPlayer() and ent == self.Owner:GetViewModel() and self.ViewModelFlip) then ang.r = -ang.r // Fixes mirrored models end end return pos, ang end function SWEP:CreateModels( tab ) if (!tab) then return end for k, v in pairs( tab ) do if (v.type == "Model" and v.model and v.model != "" and (!IsValid(v.modelEnt) or v.createdModel != v.model) and string.find(v.model, ".mdl") and file.Exists (v.model, "GAME") ) then v.modelEnt = ClientsideModel(v.model, RENDER_GROUP_VIEW_MODEL_OPAQUE) if (IsValid(v.modelEnt)) then v.modelEnt:SetPos(self:GetPos()) v.modelEnt:SetAngles(self:GetAngles()) v.modelEnt:SetParent(self) v.modelEnt:SetNoDraw(true) v.createdModel = v.model else v.modelEnt = nil end elseif (v.type == "Sprite" and v.sprite and v.sprite != "" and (!v.spriteMaterial or v.createdSprite != v.sprite) and file.Exists ("materials/"..v.sprite..".vmt", "GAME")) then local name = v.sprite.."-" local params = { ["$basetexture"] = v.sprite } local tocheck = { "nocull", "additive", "vertexalpha", "vertexcolor", "ignorez" } for i, j in pairs( tocheck ) do if (v[j]) then params["$"..j] = 1 name = name.."1" else name = name.."0" end end v.createdSprite = v.sprite v.spriteMaterial = CreateMaterial(name,"UnlitGeneric",params) end end end local allbones local hasGarryFixedBoneScalingYet = false function SWEP:UpdateBonePositions(vm) if self.ViewModelBoneMods then if (!vm:GetBoneCount()) then return end local loopthrough = self.ViewModelBoneMods if (!hasGarryFixedBoneScalingYet) then allbones = {} for i=0, vm:GetBoneCount() do local bonename = vm:GetBoneName(i) if (self.ViewModelBoneMods[bonename]) then allbones[bonename] = self.ViewModelBoneMods[bonename] else allbones[bonename] = { scale = Vector(1,1,1), pos = Vector(0,0,0), angle = Angle(0,0,0) } end end loopthrough = allbones end for k, v in pairs( loopthrough ) do local bone = vm:LookupBone(k) if (!bone) then continue end local s = Vector(v.scale.x,v.scale.y,v.scale.z) local p = Vector(v.pos.x,v.pos.y,v.pos.z) local ms = Vector(1,1,1) if (!hasGarryFixedBoneScalingYet) then local cur = vm:GetBoneParent(bone) while(cur >= 0) do local pscale = loopthrough[vm:GetBoneName(cur)].scale ms = ms * pscale cur = vm:GetBoneParent(cur) end end s = s * ms if vm:GetManipulateBoneScale(bone) != s then vm:ManipulateBoneScale( bone, s ) end if vm:GetManipulateBoneAngles(bone) != v.angle then vm:ManipulateBoneAngles( bone, v.angle ) end if vm:GetManipulateBonePosition(bone) != p then vm:ManipulateBonePosition( bone, p ) end end else self:ResetBonePositions(vm) end end function SWEP:ResetBonePositions(vm) if (!vm:GetBoneCount()) then return end for i=0, vm:GetBoneCount() do vm:ManipulateBoneScale( i, Vector(1, 1, 1) ) vm:ManipulateBoneAngles( i, Angle(0, 0, 0) ) vm:ManipulateBonePosition( i, Vector(0, 0, 0) ) end end  function table.FullCopy( tab ) if (!tab) then return nil end local res = {} for k, v in pairs( tab ) do if (type(v) == "table") then res[k] = table.FullCopy(v) // recursion ho! elseif (type(v) == "Vector") then res[k] = Vector(v.x, v.y, v.z) elseif (type(v) == "Angle") then res[k] = Angle(v.p, v.y, v.r) else res[k] = v end end return res end
end
Code:
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.HoldType = "pistol"
Code:
if SERVER then AddCSLuaFile("shared.lua")
end
if CLIENT then SWEP.PrintName = "Clés" SWEP.Slot = 1 SWEP.SlotPos = 1 SWEP.DrawAmmo = false SWEP.DrawCrosshair = false SWEP.HoldType = "pistol"
end
SWEP.Author = "Gmod Lua"
SWEP.Instructions = "Click Droit Pour Fermer et Click Gauche Pour Ouvrir"
SWEP.Category = "Cles DarkRP"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.Sound = "doors/door_latch3.wav"
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = 0
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = ""
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = 0
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = ""
SWEP.DrawAmmo = false
SWEP.DrawWeaponInfoBox = false
SWEP.BounceWeaponIcon = false
SWEP.DrawCrosshair = false
SWEP.Weight = 30
SWEP.HoldType = "pistol"
SWEP.ViewModelFOV = 70
SWEP.ViewModelFlip = false
SWEP.UseHands = false
SWEP.ViewModel = "models/weapons/c_arms_dod.mdl"
SWEP.WorldModel = "models/weapons/w_pistol.mdl"
SWEP.ShowViewModel = true
SWEP.ShowWorldModel = false
SWEP.ViewModelBoneMods = { ["ValveBiped.Bip01_Spine4"] = { scale = Vector(1, 1, 1), pos = Vector(-12, -8.334, -18), angle = Angle(110, 90, 0) }, ["ValveBiped.Bip01_R_Finger1"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) }, ["ValveBiped.Bip01_R_Finger11"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) }, ["ValveBiped.Bip01_R_Finger02"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-10, 10, -15) }, ["ValveBiped.Bip01_R_Finger01"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-10, 10, -15) }, ["ValveBiped.Bip01_R_Finger12"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) }, ["models/tglcles/tglcles.mdl"] = { scale = Vector(1,1,1), pos = Vector(4, 2, 2.5), angle = Angle(-180, 50, -35) }, ["ValveBiped.Bip01_R_Finger0"] = { scale = Vector(1, 0.8, 0.8), pos = Vector(0, 0, 0), angle = Angle(-10, 0, -15) }
}
function SWEP:Initialize() self:SetWeaponHoldType("pistol")
end
local function lookingAtLockable(ply, ent) local eyepos = ply:EyePos() return IsValid(ent) and ent:isKeysOwnable() and ( ent:isDoor() and eyepos:DistToSqr(ent:GetPos()) < 4225 or ent:IsVehicle() and eyepos:DistToSqr(ent:NearestPoint(eyepos)) < 10000 )
end
local function lockUnlockAnimation(ply, snd) ply:EmitSound("npc/metropolice/gear" .. math.floor(math.Rand(1,7)) .. ".wav") timer.Simple(0.9, function() if IsValid(ply) then ply:EmitSound(snd) end end) local RP = RecipientFilter() RP:AddAllPlayers() umsg.Start("anim_keys", RP) umsg.Entity(ply) umsg.String("usekeys") umsg.End() ply:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_GMOD_GESTURE_ITEM_PLACE, true)
end
local function doKnock(ply, sound) ply:EmitSound(sound, 100, math.random(90, 110)) umsg.Start("anim_keys") umsg.Entity(ply) umsg.String("knocking") umsg.End() ply:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_HL2MP_GESTURE_RANGE_ATTACK_FIST, true)
end
function SWEP:Reload() local trace = self:GetOwner():GetEyeTrace() if not IsValid(trace.Entity) or (IsValid(trace.Entity) and ((not trace.Entity:isDoor() and not trace.Entity:IsVehicle()) or self.Owner:EyePos():DistToSqr(trace.HitPos) > 40000)) then if CLIENT and not DarkRP.disabledDefaults["modules"]["animations"] then RunConsoleCommand("_DarkRP_AnimationMenu") end return end if SERVER then umsg.Start("KeysMenu", self:GetOwner()) umsg.End() end
end
function SWEP:PrimaryAttack() local trace = self:GetOwner():GetEyeTrace() if not lookingAtLockable(self:GetOwner(), trace.Entity) then return end self:SetNextPrimaryFire(CurTime() + 0.3) if CLIENT then return end if self:GetOwner():canKeysLock(trace.Entity) then trace.Entity:keysLock() -- Lock the door immediately so it won't annoy people lockUnlockAnimation(self:GetOwner(), self.Sound) elseif trace.Entity:IsVehicle() then DarkRP.notify(self:GetOwner(), 1, 3, DarkRP.getPhrase("do_not_own_ent")) else doKnock(self:GetOwner(), "physics/wood/wood_crate_impact_hard2.wav") end
end
function SWEP:SecondaryAttack() local trace = self:GetOwner():GetEyeTrace() if not lookingAtLockable(self:GetOwner(), trace.Entity) then return end self:SetNextSecondaryFire(CurTime() + 0.3) if CLIENT then return end if self:GetOwner():canKeysUnlock(trace.Entity) then trace.Entity:keysUnLock() -- Unlock the door immediately so it won't annoy people lockUnlockAnimation(self:GetOwner(), self.Sound) elseif trace.Entity:IsVehicle() then DarkRP.notify(self:GetOwner(), 1, 3, DarkRP.getPhrase("do_not_own_ent")) else doKnock(self:GetOwner(), "physics/wood/wood_crate_impact_hard3.wav") end
end


Merci Azok30 et à l'addon : SWEP Construction Kit
 
Dernière édition:
Akulla

Akulla

Helpeur Divin
Messages
3 808
Score réaction
2 240
Points
550
Zappy#ORIGINAL à dit:
Number one. Tu n'a pas le droit de faire sa. C'est du vole. Et sinon demande à @enzoferrarie . Il me la fait.
"Vous pouvez prendre l'addon,"
 
  • J'aime
Réactions: enzoFR60
  • Initiateur de la discussion
ShotenIG

ShotenIG

Nouveau né
Messages
22
Score réaction
5
Points
20
Merci beaucoup @enzoferrarie ! Maintenant j'aimerais juste changer la texture de la clé. J'ai donc créer un keys.vtf et keys.vmt mais je ne sais pas où les placer, pourrais-tu m'aider ? Merci d'avance.
 
  • Initiateur de la discussion
ShotenIG

ShotenIG

Nouveau né
Messages
22
Score réaction
5
Points
20
Merci, j'ai bien upload correctement mais les clés ont toujours le model de base :/
 
MerlinIageer

MerlinIageer

Geek
Messages
165
Score réaction
14
Points
65
Un conseil, evite de modifier dans le darkRP même si tu ne sais pas vraiment ce que tu fais
 
Discord d'entraide
Rejoignz-nous sur Discord