Alright what this code should do is right click, then point at car and take the person out of it. It isnt. I right click and nothing happens.
[lua]
if (SERVER) then
AddCSLuaFile("shared.lua")
end
if (CLIENT) then
SWEP.PrintName = "Carjacker"
SWEP.Slot = 5
SWEP.SlotPos = 1
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = false
end
-- Variables that are used on both client and server
SWEP.Base = "weapon_cs_base2"
SWEP.Author = "Bubka3"
SWEP.Instructions = "Left click to get people out of their vehicles."
SWEP.Contact = ""
SWEP.Purpose = ""
SWEP.IconLetter = ""
SWEP.ViewModelFOV = 62
SWEP.ViewModelFlip = false
SWEP.ViewModel = Model("models/weapons/v_rpg.mdl")
SWEP.WorldModel = Model("models/weapons/w_rocket_launcher.mdl")
SWEP.AnimPrefix = "rpg"
SWEP.Spawnable = false
SWEP.AdminSpawnable = true
SWEP.Sound = Sound("physics/wood/wood_box_impact_hard3.wav")
SWEP.Primary.ClipSize = -1 -- Size of a clip
SWEP.Primary.DefaultClip = 0 -- Default number of bullets in a clip
SWEP.Primary.Automatic = false -- Automatic/Semi Auto
SWEP.Primary.Ammo = ""
SWEP.Secondary.ClipSize = -1 -- Size of a clip
SWEP.Secondary.DefaultClip = 0 -- Default number of bullets in a clip
SWEP.Secondary.Automatic = false -- Automatic/Semi Auto
SWEP.Secondary.Ammo = ""
/*---------------------------------------------------------
Name: SWEP:Initialize()
Desc: Called when the weapon is first loaded
---------------------------------------------------------*/
function SWEP:Initialize()
self.LastIron = CurTime()
self:SetWeaponHoldType("normal")
self.Ready = false
end
function SWEP:Deploy()
self.Ready = false
end
/*---------------------------------------------------------
Name: SWEP:PrimaryAttack()
Desc: +attack1 has been pressed
---------------------------------------------------------*/
function SWEP:PrimaryAttack()
if (CLIENT) then return end
if not self.Ready then return end
local trace = self.Owner:GetEyeTrace()
self.Weapon:SetNextPrimaryFire(CurTime() + 2.5)
if (not ValidEntity(trace.Entity) or not trace.Entity:IsVehicle() ) then
return
end
if (trace.Entity:IsVehicle() and self.Owner:EyePos():Distance(trace.HitPos) > 100) then
self.Owner:SetAnimation(PLAYER_ATTACK1)
self.Owner:EmitSound(self.Sound)
trace.Entity:Fire("unlock", "", .5)
local driver = trace.Entity:GetDriver()
if driver and driver.ExitVehicle then
driver:ExitVehicle()
end
self.Owner:ViewPunch(Angle(-10, math.random(-5, 5), 0))
end
end
function SWEP:SecondaryAttack()
self.LastIron = CurTime()
self.Ready = not self.Ready
if self.Ready and SERVER then
self:SendHoldType("rpg")
elseif SERVER then
self:SendHoldType("normal")
end
end
function SWEP:GetViewModelPosition(pos, ang)
local Mul = 1
if self.LastIron > CurTime() - 0.25 then
Mul = math.Clamp((CurTime() - self.LastIron) / 0.25, 0, 1)
end
if self.Ready then
Mul = 1-Mul
end
ang:RotateAroundAxis(ang:Right(), - 15 * Mul)
return pos,ang
end
[/lua]
Thanks.
_-*bump*-_
[QUOTE=Bubka3;24785529]Alright what this code should do is right click, then point at car and take the person out of it. It isnt. I right click and nothing happens.
[lua]
if (SERVER) then
AddCSLuaFile("shared.lua")
end
if (CLIENT) then
SWEP.PrintName = "Carjacker"
SWEP.Slot = 5
SWEP.SlotPos = 1
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = false
end
-- Variables that are used on both client and server
SWEP.Base = "weapon_cs_base2"
SWEP.Author = "Bubka3"
SWEP.Instructions = "Left click to get people out of their vehicles."
SWEP.Contact = ""
SWEP.Purpose = ""
SWEP.IconLetter = ""
SWEP.ViewModelFOV = 62
SWEP.ViewModelFlip = false
SWEP.ViewModel = Model("models/weapons/v_rpg.mdl")
SWEP.WorldModel = Model("models/weapons/w_rocket_launcher.mdl")
SWEP.AnimPrefix = "rpg"
SWEP.Spawnable = false
SWEP.AdminSpawnable = true
SWEP.Sound = Sound("physics/wood/wood_box_impact_hard3.wav")
SWEP.Primary.ClipSize = -1 -- Size of a clip
SWEP.Primary.DefaultClip = 0 -- Default number of bullets in a clip
SWEP.Primary.Automatic = false -- Automatic/Semi Auto
SWEP.Primary.Ammo = ""
SWEP.Secondary.ClipSize = -1 -- Size of a clip
SWEP.Secondary.DefaultClip = 0 -- Default number of bullets in a clip
SWEP.Secondary.Automatic = false -- Automatic/Semi Auto
SWEP.Secondary.Ammo = ""
/*---------------------------------------------------------
Name: SWEP:Initialize()
Desc: Called when the weapon is first loaded
---------------------------------------------------------*/
function SWEP:Initialize()
self.LastIron = CurTime()
self:SetWeaponHoldType("normal")
self.Ready = false
end
function SWEP:Deploy()
self.Ready = false
end
/*---------------------------------------------------------
Name: SWEP:PrimaryAttack()
Desc: +attack1 has been pressed
---------------------------------------------------------*/
function SWEP:PrimaryAttack()
if (CLIENT) then return end
if not self.Ready then return end
local trace = self.Owner:GetEyeTrace()
self.Weapon:SetNextPrimaryFire(CurTime() + 2.5)
if (not ValidEntity(trace.Entity) or not trace.Entity:IsVehicle() ) then
return
end
if (trace.Entity:IsVehicle() and self.Owner:EyePos():Distance(trace.HitPos) > 100) then
self.Owner:SetAnimation(PLAYER_ATTACK1)
self.Owner:EmitSound(self.Sound)
trace.Entity:Fire("unlock", "", .5)
local driver = trace.Entity:GetDriver()
if driver and driver.ExitVehicle then
driver:ExitVehicle()
end
self.Owner:ViewPunch(Angle(-10, math.random(-5, 5), 0))
end
end
function SWEP:SecondaryAttack()
self.LastIron = CurTime()
self.Ready = not self.Ready
if self.Ready and SERVER then
self:SendHoldType("rpg")
elseif SERVER then
self:SendHoldType("normal")
end
end
function SWEP:GetViewModelPosition(pos, ang)
local Mul = 1
if self.LastIron > CurTime() - 0.25 then
Mul = math.Clamp((CurTime() - self.LastIron) / 0.25, 0, 1)
end
if self.Ready then
Mul = 1-Mul
end
ang:RotateAroundAxis(ang:Right(), - 15 * Mul)
return pos,ang
end
[/lua]
Thanks.[/QUOTE]
Try left clicking?
The code is made where you need to right click first....
i'm going to have a crack at this.
I'll send you the code if i fix it.
okay, Ive finished it [B]see if this works.[/B]
[code]
if (SERVER) then
AddCSLuaFile("shared.lua")
end
if (CLIENT) then
SWEP.PrintName = "Carjacker"
SWEP.Slot = 5
SWEP.SlotPos = 1
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = false
end
-- Variables that are used on both client and server
SWEP.Base = "weapon_cs_base2"
SWEP.Author = "Bubka3"
SWEP.Instructions = "Left click to get people out of their vehicles."
SWEP.Contact = ""
SWEP.Purpose = ""
SWEP.IconLetter = ""
SWEP.ViewModelFOV = 62
SWEP.ViewModelFlip = false
SWEP.ViewModel = Model("models/weapons/v_rpg.mdl")
SWEP.WorldModel = Model("models/weapons/w_rocket_launcher.mdl")
SWEP.AnimPrefix = "rpg"
SWEP.Spawnable = false
SWEP.AdminSpawnable = true
SWEP.Sound = Sound("physics/wood/wood_box_impact_hard3.wav")
SWEP.Primary.ClipSize = -1 -- Size of a clip
SWEP.Primary.DefaultClip = 0 -- Default number of bullets in a clip
SWEP.Primary.Automatic = false -- Automatic/Semi Auto
SWEP.Primary.Ammo = ""
SWEP.Secondary.ClipSize = -1 -- Size of a clip
SWEP.Secondary.DefaultClip = 0 -- Default number of bullets in a clip
SWEP.Secondary.Automatic = false -- Automatic/Semi Auto
SWEP.Secondary.Ammo = ""
/*---------------------------------------------------------
Name: SWEP:Initialize()
Desc: Called when the weapon is first loaded
---------------------------------------------------------*/
function SWEP:Initialize()
self.LastIron = CurTime()
self:SetWeaponHoldType("normal")
self.Ready = false
end
function SWEP:Deploy()
self.Ready = false
end
/*---------------------------------------------------------
Name: SWEP:PrimaryAttack()
Desc: +attack1 has been pressed
---------------------------------------------------------*/
function SWEP:PrimaryAttack()
if (CLIENT) then return end
if not self.Ready then return end
local trace = self.Owner:GetEyeTrace()
self.Weapon:SetNextPrimaryFire(CurTime() + 2.5)
if (not ValidEntity(trace.Entity) or not trace.Entity:IsVehicle() ) then
return
end
if (trace.Entity:IsVehicle() and self.Owner:EyePos():Distance(trace.HitPos) > 100) then
self.Owner:SetAnimation(PLAYER_ATTACK1)
self.Owner:EmitSound(self.Sound)
self.Owner:ChatPrint("You have Hijacked a car from "..trace.Entity:GetDriver():Nick()..".")
trace.Entity:Fire("unlock", "", 0)
trace.Entity:GetDriver():ExitVehicle()
end
self.Owner:ViewPunch(Angle(-10, math.random(-5, 5), 0))
end
function SWEP:SecondaryAttack()
self.LastIron = CurTime()
self.Ready = not self.Ready
if self.Ready and SERVER then
self:SendHoldType("rpg")
elseif SERVER then
self:SendHoldType("normal")
end
end
function SWEP:GetViewModelPosition(pos, ang)
local Mul = 1
if self.LastIron > CurTime() - 0.25 then
Mul = math.Clamp((CurTime() - self.LastIron) / 0.25, 0, 1)
end
if self.Ready then
Mul = 1-Mul
end
ang:RotateAroundAxis(ang:Right(), - 15 * Mul)
return pos,ang
end
[/code]
or the lua version
[lua]
if (SERVER) then
AddCSLuaFile("shared.lua")
end
if (CLIENT) then
SWEP.PrintName = "Carjacker"
SWEP.Slot = 5
SWEP.SlotPos = 1
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = false
end
-- Variables that are used on both client and server
SWEP.Base = "weapon_cs_base2"
SWEP.Author = "Bubka3"
SWEP.Instructions = "Left click to get people out of their vehicles."
SWEP.Contact = ""
SWEP.Purpose = ""
SWEP.IconLetter = ""
SWEP.ViewModelFOV = 62
SWEP.ViewModelFlip = false
SWEP.ViewModel = Model("models/weapons/v_rpg.mdl")
SWEP.WorldModel = Model("models/weapons/w_rocket_launcher.mdl")
SWEP.AnimPrefix = "rpg"
SWEP.Spawnable = false
SWEP.AdminSpawnable = true
SWEP.Sound = Sound("physics/wood/wood_box_impact_hard3.wav")
SWEP.Primary.ClipSize = -1 -- Size of a clip
SWEP.Primary.DefaultClip = 0 -- Default number of bullets in a clip
SWEP.Primary.Automatic = false -- Automatic/Semi Auto
SWEP.Primary.Ammo = ""
SWEP.Secondary.ClipSize = -1 -- Size of a clip
SWEP.Secondary.DefaultClip = 0 -- Default number of bullets in a clip
SWEP.Secondary.Automatic = false -- Automatic/Semi Auto
SWEP.Secondary.Ammo = ""
/*---------------------------------------------------------
Name: SWEP:Initialize()
Desc: Called when the weapon is first loaded
---------------------------------------------------------*/
function SWEP:Initialize()
self.LastIron = CurTime()
self:SetWeaponHoldType("normal")
self.Ready = false
end
function SWEP:Deploy()
self.Ready = false
end
/*---------------------------------------------------------
Name: SWEP:PrimaryAttack()
Desc: +attack1 has been pressed
---------------------------------------------------------*/
function SWEP:PrimaryAttack()
if (CLIENT) then return end
if not self.Ready then return end
local trace = self.Owner:GetEyeTrace()
self.Weapon:SetNextPrimaryFire(CurTime() + 2.5)
if (not ValidEntity(trace.Entity) or not trace.Entity:IsVehicle() ) then
return
end
if (trace.Entity:IsVehicle() and self.Owner:EyePos():Distance(trace.HitPos) > 100) then
self.Owner:SetAnimation(PLAYER_ATTACK1)
self.Owner:EmitSound(self.Sound)
self.Owner:ChatPrint("You have Hijacked a car from "..trace.Entity:GetDriver():Nick()..".")
trace.Entity:Fire("unlock", "", 0)
trace.Entity:GetDriver():ExitVehicle()
end
self.Owner:ViewPunch(Angle(-10, math.random(-5, 5), 0))
end
function SWEP:SecondaryAttack()
self.LastIron = CurTime()
self.Ready = not self.Ready
if self.Ready and SERVER then
self:SendHoldType("rpg")
elseif SERVER then
self:SendHoldType("normal")
end
end
function SWEP:GetViewModelPosition(pos, ang)
local Mul = 1
if self.LastIron > CurTime() - 0.25 then
Mul = math.Clamp((CurTime() - self.LastIron) / 0.25, 0, 1)
end
if self.Ready then
Mul = 1-Mul
end
ang:RotateAroundAxis(ang:Right(), - 15 * Mul)
return pos,ang
end
[/lua]
I hope this works for you.
Sorry, you need to Log In to post a reply to this thread.