DarkRP.Player.PayDay

From GMod Wiki

Jump to: navigation, search
Deletion.pngThis page has been nominated for deletion. Deletion is due within approximately 30 days from nomination, unless the deletion has been disputed on the talk page. See more pages nominated for deletion here.
Reason for deletion: Not what Garry wants the wiki to be used for
Last Edit was made on 11/16/2011
Gamemode Function: DarkRP.Player.PayDay
DarkRP.Player.PayDay is a function that is defined in the DarkRP Gamemode and its derivatives.
Function
Syntax Player:PayDay( )
Where is this used?
Description:
Will trigger a pay day.
Returns: nil
Part of Library: Player
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=DarkRP.Player.PayDay]DarkRP.Player.PayDay [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionPart of a weapon that gives the victim a pay day, my kinda punishment.
Used onNewerServer.png
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

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox