DarkRP.Player.PayDay

From DarkRP
This page refers to DarkRP 2.4.3. This information may be incorrect as of later versions.
Check here for a up-to-date list of functions.
Function
Function name Player:PayDay()
Description:
Will trigger a pay day.
Returns: nil
Part of Library: Player
Realm:
BBCode Link: [b][url=http://wiki.darkrp.com/index.php?title=DarkRP.Player.PayDay]Player:PayDay[/url][/b]

Examples[edit]

DescriptionPart of a weapon that gives the victim a pay day, my kinda punishment.
Used on
Code
if SERVER then
	AddCSLuaFile("shared.lua")
end

if CLIENT then
	SWEP.PrintName = "Pay Day Baton"
	SWEP.Slot = 1
	SWEP.SlotPos = 3
	SWEP.DrawAmmo = false
	SWEP.DrawCrosshair = false
end

SWEP.Author = "KillerLUA"
SWEP.Instructions = "Left or right click to give the player a pay day"
SWEP.Contact = ""
SWEP.Purpose = ""

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

SWEP.Spawnable = false
SWEP.AdminSpawnable = true

SWEP.NextStrike = 0

SWEP.ViewModel = Model("models/weapons/v_stunstick.mdl")
SWEP.WorldModel = Model("models/weapons/w_stunbaton.mdl")

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

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()
	if SERVER then self:SetWeaponHoldType("normal") end
end

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

	if SERVER then
		self:SetWeaponHoldType("melee")
		timer.Simple(0.3, function(wep) if wep:IsValid() then wep:SetWeaponHoldType("normal") end end, self)
	end
	self.Owner:SetAnimation(PLAYER_ATTACK1)
	self.Weapon:EmitSound(self.Sound)
	self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER)

	self.NextStrike = CurTime() + .4
	
	if CLIENT then return end

	trace.Entity:PayDay()
end

function SWEP:SecondaryAttack()
	self:PrimaryAttack()
end
OutputN/A


Additional Notes[edit]

  • Get the full weapon tutorial here.