Few Script Requests for my DarkRP server.

Here we go, i hope someone can help.

  1. I need a script that demotes the mayor to a citizen on death
  2. A weapon that on primary attack will trigger a sound and a screen shake. (sound/slurp.wav)
  3. I need an extension on this script that needs to include.
  • The restriction of the physics tool list (turret etc)

[lua]function WireRestriction( ply, tr, toolmode )
if string.find(toolmode, “wire”) then
if ply:Team() == TEAM_ELECTRICIAN then – add or ply:IsAdmin() if you want admins to be able to use them anyway
return true
else
return false
end
end
end

hook.Add( “CanTool”, “WireRestriction”, WireRestriction) [/lua]


(User was banned for this post ("Undescriptive thread title" - mahalis))

  1. Untested but should work.
    [lua]function DemoteMayorToCitizen(ply)
    if ply:Team() == TEAM_MAYOR then ply:ChangeTeam(TEAM_CITIZEN) end
    end
    hook.Add(“PlayerDeath”, “DemoteMayorToCitizen”, DemoteMayorToCitizen)
    [/lua]

  2. This should work fine.
    [lua]
    if (SERVER) then AddCSLuaFile(“shared.lua”); end;

– Check if we’re running on the client.
if (CLIENT) then
SWEP.Slot = 4;
SWEP.SlotPos = 1;
SWEP.DrawAmmo = false;
SWEP.DrawCrosshair = false;
end;

– Set some shared information.
SWEP.Author = “The Master”;
SWEP.Instructions = “Primary Fire: Shake.”;
SWEP.Purpose = “Shaker weapon”;
SWEP.Category = “DarkRP”;
SWEP.PrintName = “Shaker”;
SWEP.Contact = “”
SWEP.Purpose = “”

SWEP.ViewModelFOV = 62
SWEP.ViewModelFlip = false
SWEP.AnimPrefix = “rpg”

SWEP.Spawnable = false
SWEP.AdminSpawnable = true
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = 0
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = “”

function SWEP:Initialize()
if (SERVER) then self:SetWeaponHoldType(“normal”); end;
end;

function SWEP:Deploy()
if SERVER then
self.Owner:DrawViewModel(false)
self.Owner:DrawWorldModel(false)
end
end

– The primary attack function.
function SWEP:PrimaryAttack()
if (SERVER) then
local force = math.random(10,1000)
util.ScreenShake(Vector(0,0,0), force, math.random(25,50), math.random(5,12), 9999999999)

	self.Owner:EmitSound("sound/slurp.wav")
end

end

– The secondary attack function.
function SWEP:SecondaryAttack() end;
[/lua]

  1. If you want to ban certain tools then most admin mods can provide that feature easily.