• Weapon set material
    9 replies, posted
How to set the material of the active weapons? That's what tasted: [CODE] --print( ply:GetActiveWeapon()) local wpp = ply:GetActiveWeapon() wpp:SetMaterial("models/dog/eyeglass") [/CODE] Sorry for my English.
SetMaterial is for entities only afaik, to set weapon mats you need to edit the vtf?
I found this script. But I need to simplify it. [CODE] local month=tonumber(os.date("%m",time)) local day=tonumber(os.date("%d",time)) function IsChristmas() local time=os.time() if month==1 or month==12 then if month==1 and day<=8 or month==12 and day>=18 then return true end end return false end WeaponsMaterials={} WeaponsMaterials["Carbonic"]=Material("models/combine_mine/combine_mine03") WeaponsMaterials["BlackPlastic"]=Material("models/weapons/c_arms_citizen/c_arms_citizen_glove") WeaponsMaterials["BlueSteel"]=Material("models/props_combine/combine_light001a") WeaponsMaterials["GreenMasked"]=Material("models/weapons/v_rocket_launcher/rocket launcher sheet") WeaponsMaterials["YellowEnergy"]=Material("models/items/combinerifle_ammo") WeaponsMaterials["Asimov"]=Material("models/weapons/skins/asimov") WeaponsMaterials["Orange"]=Material("models/weapons/skins/awporange") if SERVER then hook.Add("WeaponEquip","PS_WeaponsWorldSkins",function(weapon) timer.Simple(0.1,function() if weapon:IsValid() then local Owner=weapon:GetOwner() local WeaponClass=weapon:GetClass() if PS!=nil then if PS.WeaponsSkins!=nil then if PS.WeaponsSkins[Owner]!=nil then if PS.WeaponsSkins[Owner][WeaponClass]!=nil then if PS.WeaponsSkins[Owner][WeaponClass]["MaterialName"]!=nil then weapon:SetMaterial(tostring(WeaponsMaterials[PS.WeaponsSkins[Owner][WeaponClass]["MaterialName"]])) end end end end end end end) end) end if CLIENT then hook.Add("PreDrawViewModel","PS_WeaponsViewSkins",function(vm,ply,weapon) local LP=LocalPlayer() if LocalPlayer():GetActiveWeapon():IsValid() then local LPW=LocalPlayer():GetActiveWeapon():GetClass() local LPV=LocalPlayer():GetViewModel() if PS!=nil then if PS.WeaponsSkins!=nil then if PS.WeaponsSkins[LP]!=nil then if PS.WeaponsSkins[LP][LPW]!=nil then if PS.WeaponsSkins[LP][LPW]["MaterialName"]!=nil then for k,v in pairs(LPV:GetMaterials()) do if v!="models/weapons/v_models/hands/v_hands" then render.MaterialOverrideByIndex(k-1,WeaponsMaterials[PS.WeaponsSkins[LP][LPW]["MaterialName"]]) end end end end end end end end end) hook.Add("PostDrawViewModel","PS_WeaponsViewSkins",function(vm,ply,weapon) local LP=LocalPlayer() if LocalPlayer():GetActiveWeapon():IsValid() then local LPW=LocalPlayer():GetActiveWeapon():GetClass() if PS !=nil then if PS.WeaponsSkins!=nil then if PS.WeaponsSkins[LP]!=nil then if PS.WeaponsSkins[LP][LPW]!=nil then if PS.WeaponsSkins[LP][LPW]["MaterialName"]!=nil then render.ModelMaterialOverride() end end end end end end end) if false then hook.Add("PostDrawViewModel","ChristmasWeaponsSkin",function(vm,ply,weapon) for I=1,vm:GetBoneCount() do if vm:GetBoneName(I)!="__INVALIDBONE__" and not string.find(vm:GetBoneName(I), "arm", 1, true) and not string.find(vm:GetBoneName(I), "Hand", 1, true) and not string.find(vm:GetBoneName(I), "Finger", 1, true) and not string.find(vm:GetBoneName(I), "Bone", 1, true) then local bone = vm:LookupBone(vm:GetBoneName(I)) if not bone then return end local m = vm:GetBoneMatrix(bone) if not m then return end local pos, ang = m:GetTranslation(), m:GetAngles() if weapon.ViewModelFlip then ang.r = -ang.r end local GlowColor=Color(math.abs(math.cos(I))*255,math.abs(math.sin(I))*255,math.abs(math.sin(I)*-1)*255) local GlowSize=math.max(math.abs(math.cos(CurTime()+(I*100)))*6.5,1) render.SetMaterial(Material("sprites/light_glow02_add")) render.DrawSprite((pos),GlowSize,GlowSize,GlowColor) render.SetMaterial(Material("sprites/sent_ball")) render.DrawSprite((pos), 0.35, 0.35,GlowColor) end end end) end end [/CODE]
[QUOTE=godred2;48353459]&#1071; &#1085;&#1072;&#1096;&#1077;&#1083; &#1101;&#1090;&#1086;&#1090; &#1089;&#1082;&#1088;&#1080;&#1087;&#1090;. &#1053;&#1086; &#1084;&#1085;&#1077; &#1077;&#1075;&#1086; &#1085;&#1091;&#1078;&#1085;&#1086; &#1091;&#1087;&#1088;&#1086;&#1089;&#1090;&#1080;&#1090;&#1100;. -snip-[/QUOTE] And now in english. :v:
[QUOTE=whitestar;48353476]And now in english. :v:[/QUOTE] I found this script. But I need to simplify it.
[QUOTE=godred2;48353540]I found this script. But I need to simplify it.[/QUOTE] Then simplify it, we wont do it for you, this forum is not for C+P.
[QUOTE=whitestar;48353242]SetMaterial is for entities only afaik, to set weapon mats you need to edit the vtf?[/QUOTE] Weapons are entities. Op, give us all the code you used originally. Including file location.
[QUOTE=crazyscouter;48353642]Weapons are entities. Op, give us all the code you used originally. Including file location.[/QUOTE] I always thought weapons differ from ents >-< Dayum I haz to learn moar!
[QUOTE=crazyscouter;48353642]Weapons are entities. Op, give us all the code you used originally. Including file location.[/QUOTE] I need to change the material through PointShop
[QUOTE=godred2;48353982]I need to change the material through PointShop[/QUOTE] then paste your pointshop code here?! We dont want to know WHERE you change it, we want the CODE which shows HOW you do it completely.
Sorry, you need to Log In to post a reply to this thread.