<?xml version="1.0" encoding="utf-8"?>
<!-- Generated on Thu, 04 Jun 2026 10:05:55 +0200 -->
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>GMod-Fan Inc. - Форум</title>
    <link>https://gmod-fan.com/forum/gmodworld/topic-6546.html</link>
    <description>Последние ответы в теме: Помогите с кодом</description>
    <generator>LogicBoard</generator>
    <item>
      <title>Помогите с кодом</title>
      <description><![CDATA[Ребят, ломаю голову, не могу правильно прописать функцию. Я пытаюсь сделать в рации так, чтобы при перезарядки на определённой частоте(ну скажем 92.2) активировался код, однако код активируется на любой частоте, как правильно прописать и что именно нужно? Вот код<!--br--><br /><blockquote class="blockspoiler"><span class="titlespoiler"><a href='#' onclick="ShowAndHide('0b99796471c4f1cc3c3ac4cdace9327e'); return false;">Спойлер [+]</a></span><div id='0b99796471c4f1cc3c3ac4cdace9327e' style='display:none;' class="textspoiler">if(SERVER)then<!--br--><br /> AddCSLuaFile()<!--br--><br /> --// File generated by F0x's Resources Generator 3.0.0 \\--<!--br--><br /> resource.AddFile( &quot;materials/radio/button.vtf&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/buttons00.vmt&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/buttons1.vmt&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/buttons2.vmt&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/buttons2.vtf&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/buttons3.vtf&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/buttons4.vmt&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/digital.vtf&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/glass.vmt&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/holes.vmt&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/illum.vtf&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/illum_screen.vmt&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/plastic2_base_color.vtf&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/plastic_2.vmt&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/plastic_ambient_occlusion.vtf&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/plastic_base_color.vtf&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/plastic_height.vtf&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/plastic_normal.vtf&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/plastic_shiny.vmt&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/qwe.vtf&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/radio_plastic.vmt&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/rip.vtf&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/trans.vtf&quot; )<!--br--><br /> resource.AddFile( &quot;materials/radio/wart.vmt&quot; )<!--br--><br /> resource.AddFile( &quot;models/radio/c_radio.mdl&quot; )<!--br--><br /> resource.AddFile( &quot;models/radio/w_radio.mdl&quot; )<!--br--><br /> resource.AddFile( &quot;sound/snd_jack_job_radioswitch.wav&quot; )<!--br--><br /> resource.AddFile( &quot;sound/snd_jack_job_radiotone.wav&quot; )<!--br--><br />elseif(CLIENT)then<!--br--><br /> SWEP.DrawAmmo = false<!--br--><br /> SWEP.DrawCrosshair = false<!--br--><br /> SWEP.ViewModelFOV = 65<!--br--><br /> SWEP.ViewModelFlip = true<!--br--><br /> SWEP.Slot = 5<!--br--><br /> SWEP.SlotPos = 3<!--br--><br /> killicon.AddFont(&quot;wep_jack_job_drpradio&quot;, &quot;HL2MPTypeDeath&quot;, &quot;5&quot;, Color(0, 0, 255, 255))<!--br--><br /> function SWEP:Initialize()<!--br--><br />  --wat<!--br--><br /> end<!--br--><br /> function SWEP:DrawViewModel()<!--br--><br />  return false<!--br--><br /> end<!--br--><br /> function SWEP:DrawHUD()<!--br--><br />  local W,H=ScrW(),ScrH()<!--br--><br />  if not(self:GetActive())then return end<!--br--><br />  local ChanTxt=tostring(90+self:GetChannel()/10)<!--br--><br />  draw.SimpleTextOutlined(&quot;Channel: &quot;..ChanTxt,&quot;Trebuchet24&quot;,W*.76,H*.87,Color(255,255,255,255),TEXT_A<br />LIGN_CENTER,TEXT_ALIGN_CENTER,1,Color(0,0,0,255))<!--br--><br /> end<!--br--><br />end<!--br--><br />SWEP.Base=&quot;weapon_base&quot;<!--br--><br />SWEP.ViewModel = &quot;models/weapons/v_eq_fraggrenade.mdl&quot;<!--br--><br />SWEP.WorldModel = &quot;models/radio/w_radio.mdl&quot;<!--br--><br />SWEP.PrintName = &quot;Personal Radio 2&quot;<!--br--><br />SWEP.Instructions = &quot;&quot;<!--br--><br />SWEP.Author   = &quot;&quot;<!--br--><br />SWEP.Contact  = &quot;&quot;<!--br--><br />SWEP.Purpose  = &quot;&quot;<!--br--><br />SWEP.BobScale=3<!--br--><br />SWEP.SwayScale=3<!--br--><br />SWEP.Weight = 3<!--br--><br />SWEP.AutoSwitchTo  = true<!--br--><br />SWEP.AutoSwitchFrom  = false<!--br--><br />SWEP.Spawnable   = true<!--br--><br />SWEP.AdminOnly   = false<!--br--><br />SWEP.Primary.Delay   = 0.5<!--br--><br />SWEP.Primary.Recoil   = 3<!--br--><br />SWEP.Primary.Damage   = 120<!--br--><br />SWEP.Primary.NumShots  = 1 <!--br--><br />SWEP.Primary.Cone   = 0.04<!--br--><br />SWEP.Primary.ClipSize  = -1<!--br--><br />SWEP.Primary.Force   = 900<!--br--><br />SWEP.Primary.DefaultClip = -1<!--br--><br />SWEP.Primary.Automatic    = true<!--br--><br />SWEP.Primary.Ammo          = &quot;none&quot;<!--br--><br />SWEP.Secondary.Delay  = 0.9<!--br--><br />SWEP.Secondary.Recoil  = 0<!--br--><br />SWEP.Secondary.Damage  = 0<!--br--><br />SWEP.Secondary.NumShots  = 1<!--br--><br />SWEP.Secondary.Cone   = 0<!--br--><br />SWEP.Secondary.ClipSize  = -1<!--br--><br />SWEP.Secondary.DefaultClip = -1<!--br--><br />SWEP.Secondary.Automatic    = false<!--br--><br />SWEP.Secondary.Ammo         = &quot;none&quot;<!--br--><br />SWEP.DownAmt=0<!--br--><br />SWEP.VPos = Vector(5.025, -17, 0)<!--br--><br />SWEP.VAng = Angle(-20, -70, 10)<!--br--><br />SWEP.ShowViewModel = true<!--br--><br />SWEP.ViewModelBoneMods = {<!--br--><br /> [&quot;v_weapon.Flashbang_Parent&quot;] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) }<!--br--><br />}<!--br--><br />SWEP.VElements = {<!--br--><br /> [&quot;radio&quot;] = { type = &quot;Model&quot;, model = &quot;models/radio/c_radio.mdl&quot;, bone = &quot;v_weapon.Flashbang_Parent&quot;, rel = &quot;&quot;, pos = Vector(-11.7, 1.557, -3.6), angle = Angle(40.909, 3.506, 90), size = Vector(0.8, 0.8, 0.8), color = Color(255, 255, 255, 255), surpresslightning = false, material = &quot;&quot;, skin = 0, bodygroup = {} },<!--br--><br /> [&quot;light&quot;] = { type = &quot;Sprite&quot;, sprite = &quot;sprites/blueflare1&quot;, bone = &quot;v_weapon.Flashbang_Parent&quot;, rel = &quot;&quot;, pos = Vector(0, -.2, -.85), size = { x = 2, y = 2 }, color = Color(0, 255, 0, 0), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}<!--br--><br />}<!--br--><br />Re1 = &quot;help.wav&quot;<!--br--><br />Re2 = &quot;help.wav&quot;<!--br--><br />local Request = {}<!--br--><br /> Request[1] = (Re1)<!--br--><br /> Request[2] = (Re2)<!--br--><br /> <!--br--><br />function SWEP:Initialize()<!--br--><br /> self.OnlyOneBackup = false<!--br--><br /> self:SetWeaponHoldType( &quot;magic&quot; )<!--br--><br /> self:SetHoldType(&quot;normal&quot;)<!--br--><br /> self.DownAmt=20<!--br--><br /> self:SetActive(false)<!--br--><br /> self:Setabab(false)<!--br--><br /> self:SetEarpiece(self.HasEarpiece or false)<!--br--><br /> self:SetChannel(1)<!--br--><br /> self:SCKInitialize()<!--br--><br /> if(SERVER)then<!--br--><br />  self:PhysicsInitBox(Vector(-5,-5,-5),Vector(5,5,5))<!--br--><br />  self:SetCollisionBounds(Vector(-5,-5,-5),Vector(5,5,5))<!--br--><br />  self:SetMoveType(MOVETYPE_VPHYSICS)<!--br--><br />  self:SetSolid(SOLID_VPHYSICS)<!--br--><br />  local Phys=self:GetPhysicsObject()<!--br--><br />  Phys:Wake()<!--br--><br />  Phys:SetMass(10)<!--br--><br /> end<!--br--><br />end<!--br--><br />function SWEP:SetupDataTables()<!--br--><br /> self:NetworkVar(&quot;Bool&quot;,0,&quot;Active&quot;)<!--br--><br /> self:NetworkVar(&quot;Bool&quot;,1,&quot;Earpiece&quot;)<!--br--><br /> self:NetworkVar(&quot;Int&quot;,0,&quot;Channel&quot;)<!--br--><br /> self:NetworkVar(&quot;Bool&quot;,0,&quot;abab&quot;)<!--br--><br />end<!--br--><br />function SWEP:PrimaryAttack()<!--br--><br /> self:SetActive(!self:GetActive())<!--br--><br /> self:EmitSound(&quot;snd_jack_job_radioswitch.wav&quot;,60,110)<!--br--><br /> if(self:GetActive())then<!--br--><br />  self.VElements.light.color.a=255<!--br--><br /> else<!--br--><br />  self.VElements.light.color.a=0<!--br--><br /> end<!--br--><br /> self:SetNextPrimaryFire(CurTime()+.5)<!--br--><br />end<!--br--><br />function SWEP:Deploy()<!--br--><br /> self:SetNextPrimaryFire(CurTime()+1)<!--br--><br /> self.DownAmt=20<!--br--><br /> return true<!--br--><br />end<!--br--><br />function SWEP:Holster()<!--br--><br /> self:SCKHolster()<!--br--><br /> return true<!--br--><br />end<!--br--><br />-- this is messy, don't care. Ain't paid enough to be doing derma menus honestly<!--br--><br />if(SERVER)then util.AddNetworkString(&quot;jackjob_drp_radiochannelmenu&quot;) end<!--br--><br />function SWEP:SecondaryAttack()<!--br--><br /> if not(self:GetActive())then return end<!--br--><br /> if(SERVER)then<!--br--><br />  net.Start(&quot;jackjob_drp_radiochannelmenu&quot;)<!--br--><br />  net.WriteEntity(self)<!--br--><br />  net.Send(self.Owner)<!--br--><br /> end<!--br--><br /> --[[<!--br--><br /> local NewChannel=self:GetChannel()+1<!--br--><br /> if(NewChannel&gt;100)then NewChannel=1 end<!--br--><br /> self:SetChannel(NewChannel)<!--br--><br /> self:EmitSound(&quot;snd_jack_job_radioswitch.wav&quot;,40,90)<!--br--><br /> --]]<!--br--><br /> self:SetNextSecondaryFire(CurTime()+.1)<!--br--><br />end<!--br--><br />if(CLIENT)then<!--br--><br /> net.Receive(&quot;jackjob_drp_radiochannelmenu&quot;,function(len,ply)<!--br--><br />  local Wep=net.ReadEntity()<!--br--><br />  local DermaPanel=vgui.Create(&quot;DFrame&quot;)<!--br--><br />  DermaPanel:SetPos(40,80)<!--br--><br />  DermaPanel:SetSize(500,100)<!--br--><br />  DermaPanel:SetTitle(&quot;Select Channel&quot;)<!--br--><br />  DermaPanel:SetVisible(true)<!--br--><br />  DermaPanel:SetDraggable(true)<!--br--><br />  DermaPanel:ShowCloseButton(true)<!--br--><br />  DermaPanel:MakePopup()<!--br--><br />  DermaPanel:Center()<!--br--><br />  local DermaNumSlider=vgui.Create(&quot;DNumSlider&quot;,DermaPanel)<!--br--><br />  DermaNumSlider:SetPos(10,25)<!--br--><br />  DermaNumSlider:SetSize(490,50)<!--br--><br />  DermaNumSlider:SetText(&quot;Channel&quot;)<!--br--><br />  DermaNumSlider:SetMin(80.1)<!--br--><br />  DermaNumSlider:SetMax(130.1)<!--br--><br />  DermaNumSlider:SetDecimals(1)<!--br--><br />  DermaNumSlider:SetValue(Wep:GetChannel()/10+90)<!--br--><br />  DermaNumSlider.OnValueChanged=function(panel,val)<!--br--><br />   RunConsoleCommand(&quot;jackjob_drpradio_setchannel&quot;,tostring(math.Round(val<br />,1)))<!--br--><br />  end<!--br--><br /> end)<!--br--><br />end<!--br--><br />if(SERVER)then<!--br--><br /> concommand.Add(&quot;jackjob_drpradio_setchannel&quot;,function(ply,txt,args)<!--br--><br />  if(ply:HasWeapon(&quot;wep_jack_job_drpradio&quot;))then<!--br--><br />   local self=ply:GetWeapon(&quot;wep_jack_job_drpradio&quot;)<!--br--><br />   if(self:GetActive())then<!--br--><br />    local Chan=tonumber(args[1])<!--br--><br />    <!--br--><br />    if((Chan&gt;=80.1)and(Chan&lt;=130.1))then<!--br--><br />     self:EmitSound(&quot;snd_jack_job_radioswitch.wav&quot;,30,90)<!--br--><br />     local Rounded=math.Round((Chan-90)*10)<!--br--><br />     self:SetChannel(math.Clamp(Rounded,1,100))<!--br--><br />          elseif((Chan&gt;=95.7)and(Chan&lt;=95.7))then <!--br--><br />     self:EmitSound(&quot;radio_voice_1.wav&quot;,45,100)<!--br--><br />     local Rounded=math.Round((Chan-90)*10)<!--br--><br />     self:SetChannel(math.Clamp(Rounded,1,100))<!--br--><br />  <!--br--><br />                       elseif((Chan&gt;=97.5)and(Chan&lt;=97.5))then<!--br--><br />     self:EmitSound(&quot;radio_voice_2.wav&quot;,45,100) <!--br--><br />     local Rounded=math.Round((Chan-90)*10)<!--br--><br />     self:SetChannel(math.Clamp(Rounded,1,100))<!--br--><br />     <!--br--><br />                       elseif((Chan&gt;=91.2)and(Chan&lt;=91.2))then <!--br--><br />     self:EmitSound(&quot;radio_voice_3.wav&quot;,45,100) <!--br--><br />     local Rounded=math.Round((Chan-90)*10)<!--br--><br />     self:SetChannel(math.Clamp(Rounded,1,100))<!--br--><br />     <!--br--><br />                       elseif((Chan&gt;=99.9)and(Chan&lt;=99.9))then <!--br--><br />     self:EmitSound(&quot;radio_voice_4.wav&quot;,45,100) <!--br--><br />     local Rounded=math.Round((Chan-90)*10)<!--br--><br />     self:SetChannel(math.Clamp(Rounded,1,100))<!--br--><br />     <!--br--><br />                       elseif((Chan&gt;=100.1)and(Chan&lt;=100.1))then <!--br--><br />     self:EmitSound(&quot;radio_voice_5.wav&quot;,45,100) <!--br--><br />     local Rounded=math.Round((Chan-90)*10)<!--br--><br />     self:SetChannel(math.Clamp(Rounded,1,100))<!--br--><br />     end<!--br--><br /><font style='color:#274e13'><font size='6'>ВОТ НУЖНАЯ ЧАСТОТА</font></font><!--br--><br />     if(Chan==92.2)then <!--br--><br />     self:EmitSound(&quot;radio_voice_1.wav&quot;,45,100)<!--br--><br />    end<!--br--><br />   end<!--br--><br />  end<!--br--><br /> end)<!--br--><br />end<!--br--><br />function SWEP:Think()<!--br--><br /> --<!--br--><br />end<!--br--><br />function SWEP:CallBackup(tr)<!--br--><br /> <!--br--><br /> if SERVER then<!--br--><br />  local tr = self.Owner:GetEyeTrace()<!--br--><br />  if tr.HitPos:Distance(self:GetPos()) &gt; 200 or (  IsValid( self.ent1 ) or IsValid( self.ent2 ) or IsValid( self.ent3 ) ) then <!--br--><br />  self:EmitSound(&quot;Engi.Block&quot;) <!--br--><br />  else<!--br--><br />  self.ent1 = ents.Create( &quot;elite_backup&quot; )<!--br--><br />  self.ent2 = ents.Create( &quot;elite_backup&quot; )<!--br--><br />  self.ent3 = ents.Create( &quot;elite_backup&quot; )<!--br--><br />  self.ent1:SetPos(Vector(self.Owner:GetEyeTrace().HitPos.x, self.Owner:GetEyeTrace().HitPos.y, self.Owner:GetPos().z))<!--br--><br />  self.ent2:SetPos(Vector(self.ent1:GetPos().x-45, self.ent1:GetPos().y-45, self.ent1:GetPos().z))<!--br--><br />  self.ent3:SetPos(Vector(self.ent1:GetPos().x+45, self.ent1:GetPos().y-45, self.ent1:GetPos().z))<!--br--><br />  local newAng = Angle(0, self.Owner:GetAngles().y, 0)<!--br--><br />  self.ent1:SetAngles( newAng )<!--br--><br />  self.ent2:SetAngles( newAng )<!--br--><br />  self.ent3:SetAngles( newAng )<!--br--><br />  self.ent1:SetOwner( self.Owner )<!--br--><br />  self.ent2:SetOwner( self.Owner )<!--br--><br />  self.ent3:SetOwner( self.Owner )<!--br--><br />  timer.Simple(2, function()<!--br--><br />  if self.Owner:Alive() then<!--br--><br />  self.ent1:Spawn()<!--br--><br />  self.ent1:Activate()<!--br--><br />  self.ent2:Spawn()<!--br--><br />  self.ent2:Activate()<!--br--><br />  self.ent3:Spawn()<!--br--><br />  self.ent3:Activate()<!--br--><br />  end<!--br--><br />  end)<!--br--><br />  self:EmitSound( Request[math.random(1,2)], 100, 100 )<!--br--><br />  <!--br--><br />  cleanup.Add( self.Owner, &quot;props&quot;, self.ent1 )<!--br--><br />  cleanup.Add( self.Owner, &quot;props&quot;, self.ent2 )<!--br--><br />  cleanup.Add( self.Owner, &quot;props&quot;, self.ent3 )<!--br--><br />  end<!--br--><br /> end<!--br--><br />end<!--br--><br />function SWEP:Reload()<!--br--><br /><font style='color:#274e13'><font size='6'>ВОТ САМ КОД</font></font><!--br--><br />     self.Owner:SetAnimation(PLAYER_ATTACK1)<!--br--><br />                 self:CallBackup()<!--br--><br />                 self.Weapon:SetNextPrimaryFire( CurTime() + 1.00 )<!--br--><br /><font style='color:#274e13'><font size='6'>------------------</font></font><!--br--><br />if IsValid(self.ent1) and self.Owner:KeyDown(IN_ATTACK2) then<!--br--><br />self:KillMe(self.ent1)<!--br--><br />end<!--br--><br />if IsValid(self.ent2) and self.Owner:KeyDown(IN_ATTACK2) then<!--br--><br />self:KillMe(self.ent2)<!--br--><br />end<!--br--><br />if IsValid(self.ent3) and self.Owner:KeyDown(IN_ATTACK2) then<!--br--><br />self:KillMe(self.ent3)<!--br--><br />end<!--br--><br />end?</div></blockquote><!--spoiler --><!--br--><br />Вот сам аддон <a href="http://gmod-fan.ru/forum/away.php?s=http%3A%2F%2Fsteamcommunity.com%2Fsharedfiles%2Ffiledetails%2F%3Fid%3D737856583%26amp%3Bsearchtext%3Dradio" target="_blank">http://steamcommunity.com/sharedfiles/filedetails/?id=737856583&amp;searchtext=ra<br />dio</a>]]></description>
      <link>https://gmod-fan.com/forum/gmodworld/last/topic-6546.html</link>
      <pubDate>Mon, 23 Oct 2017 18:10:41 +0200</pubDate>
      <author>communist666</author>
      <guid isPermaLink="true"><![CDATA[https://gmod-fan.com/forum/gmodworld/last/topic-6546.html]]></guid>
    </item>
  </channel></rss>