Вопрос палка которая меняет профессию.

  • 28
  • 0
Контакты для связи отсутствуют.
Доброе время суток. Мне нужна палочка которая при ударе меняет профессию человеку которого ударили на другую + давала бан на 10 минут на все профы. Сделал что-то подобное своими кривыми руками. Ошибок нет но профу не меняет (Тестил на боте.)

Сам "код"

Lua:
AddCSLuaFile()

if CLIENT then --Cliply stuff
SWEP.PrintName = "Отправить в тюрьму" --Name
SWEP.Slot = 1
SWEP.SlotPos = 3
SWEP.DrawAmmo = false --Draw ammo in bottom right corner
SWEP.DrawCrosshair = false --Draw crosshair?
end

SWEP.Author = "Federal" --Author
SWEP.Instructions = "Gjcflbnm" --How to use
SWEP.Contact = "" --Contact
SWEP.Purpose = "Отправить человека в тюрьму" --Purpose

SWEP.ViewModelFOV = 62
SWEP.ViewModelFlip = false
SWEP.AnimPrefix = "stunstick"
SWEP.Category = "RP"

SWEP.Spawnable = true
SWEP.AdminOnly = true --Only spawnable by admins!

SWEP.NextStrike = 0

SWEP.ViewModel = Model("models/weapons/v_stunstick.mdl") --The model while being held
SWEP.WorldModel = Model("models/weapons/w_stunbaton.mdl") --World model (on the ground)

SWEP.Sound = Sound("weapons/stunstick/stunstick_swing1.wav") --The sound

SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = 0
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = ""

SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = 0
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = ""

function SWEP:Initialize()
self:SetHoldType("normal")
end

function SWEP:PrimaryAttack()
if CurTime() < self.NextStrike then return end

self:SetHoldType("normal")
timer.Simple(0.3, function() if self:IsValid() then self:SetHoldType("normal") end end) --Checks that the swep hasn't quickly been switched

self.Owner:SetAnimation(PLAYER_ATTACK1)
self.Weapon:EmitSound(self.Sound) ---Emit a sound, the stunstick wack
self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER)

self.NextStrike = CurTime() + 0.51

if CLIENT then return end --No cliplys past here

self.Owner:LagCompensation(true)
local trace = util.QuickTrace(self.Owner:EyePos(), self.Owner:GetAimVector() * 90, {self.Owner})
self.Owner:LagCompensation(false)

local plu = self.Owner:getEyeSightHitEntity(nil, nil, function(p) return p ~= self.Owner and p:IsPlayer() and p:Alive() end)

if not IsValid(ply) or (self.Owner:EyePos():Distance(ply:GetPos()) > 90) or (not ply:IsPlayer() and not ply:IsNPC()) then
return
end

ply:changeTeam(number (TEAM_ZEN), force (true))
ply:teamBan(number (TEAM_SOLOSET, TEAM_KAPOSET, TEAM_ZDONOSET, TEAM_CONOSET, TEAM_DONOSET, TEAM_SMOTR, TEAM_PYRO, TEAM_NONRP, TEAM_GG, TEAM_TGUN, TEAM_VZLOMJOPA, TEAM_VZLOM, TEAM_TERR, TEAM_LTERR, TEAM_ZGO2_PRO, TEAM_ZGO2_BASIC, TEAM_ZGO2_AMATEUR, TEAM_KARMAN, TEAM_CHECHYA, TEAM_HITMAN, TEAM_ZMLAB2_COOK, TEAM_BITCOIN, TEAM_GANGMAK, TEAM_VIPGANGMAK, TEAM_MOBMAK, TEAM_GANGTAM, TEAM_VIPGANGTAM, TEAM_MOBTAM, TEAM_MEDIC, TEAM_MEDICGL, TEAM_POH, TEAM_POH1, TEAM_POLICE, TEAM_HEADPOLICE, TEAM_OMON, TEAM_KOMON, TEAM_SWAT, TEAM_SWATMED, TEAM_HEVISWAT, TEAM_HEADSWAT, TEAM_FBI, TEAM_CHIEF, TEAM_REVIZORO, TEAM_CPE, TEAM_DCPE, TEAM_JUDGE, TEAM_PMEMBER, TEAM_MAYOR, TEAM_GUN, TEAM_LGEYSEC, TEAM_GEYSEC, TEAM_OHRANA, TEAM_OHRANAVIP, TEAM_COLLEC, TEAM_ARISTOKRAT, TEAM_BANK, TEAM_HOBO, TEAM_ZPIZMAK_CHEF, TEAM_MEH, TEAM_CITIZEN, TEAM_ZRMINE_MINER), 600)
end

function SWEP:SecondaryAttack()
self:PrimaryAttack() --Run Primary Attack
end

Заранее спасибо!
 
  • 28
  • 0
Контакты для связи отсутствуют.
Опечатка на 63-й строке `local plu`
Теперь ошибка
L 03/24/2023 - 22:54:34: Lua Error: [ERROR] gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:786: table index is nil 1. getDemoteGroup - gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:786 2. changeAllowed - gamemodes/darkrp/gamemode/modules/jobs/sv_jobs.lua:216 3. changeTeam - gamemodes/darkrp/gamemode/modules/jobs/sv_jobs.lua:15 4. unknown - gamemodes/darkrp/entities/weapons/federal/shared.lua:71 [ERROR] gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:786: table index is nil 1. getDemoteGroup - gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:786 2. changeAllowed - gamemodes/darkrp/gamemode/modules/jobs/sv_jobs.lua:216 3. changeTeam - gamemodes/darkrp/gamemode/modules/jobs/sv_jobs.lua:15 4. unknown - gamemodes/darkrp/entities/weapons/federal/shared.lua:71
 
  • 50
  • 3
  • 6
Теперь ошибка
L 03/24/2023 - 22:54:34: Lua Error: [ERROR] gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:786: table index is nil 1. getDemoteGroup - gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:786 2. changeAllowed - gamemodes/darkrp/gamemode/modules/jobs/sv_jobs.lua:216 3. changeTeam - gamemodes/darkrp/gamemode/modules/jobs/sv_jobs.lua:15 4. unknown - gamemodes/darkrp/entities/weapons/federal/shared.lua:71 [ERROR] gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:786: table index is nil 1. getDemoteGroup - gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:786 2. changeAllowed - gamemodes/darkrp/gamemode/modules/jobs/sv_jobs.lua:216 3. changeTeam - gamemodes/darkrp/gamemode/modules/jobs/sv_jobs.lua:15 4. unknown - gamemodes/darkrp/entities/weapons/federal/shared.lua:71
Не используй айди профессий, посмотри первое сообщение Jien'a и поменяй эту часть кода, также измени TEAM_ZEN на TEAM_CITIZEN
 
Последнее редактирование:
Сверху Снизу