Can i get some help with striping weapons from a swep on a server
2 replies, posted
so im trying to make it when you use this swep it takes away all of your weapons and then gives you other weapons
but i get this error
[ERROR] lua/autorun/test.lua:45: attempt to call method 'StripWeapons' (a nil value) 1. unknown - lua/autorun/test.lua:45 2. unknown - lua/includes/modules/concommand.lua:54
code on swep
[CODE]
function SWEP:PrimaryAttack( right )
RunConsoleCommand("Weapstrip")
end
[/CODE]
code on auto run file
[CODE]
function Weapstrips( ply , command, arguments )
if SERVER then
ply:StripWeapons()
ply:Give( "weapon_zm_improvised" )
ply:Give( "jenssons_fistsone" )
ply:Give( "jenssons_fiststwo" )
ply:Give( "jenssons_fiststhree" )
ply:Give( "jenssons_fistsfour" )
ply:Give( "jenssons_fistsfive" )
ply:Give( "jenssons_fistssix" )
ply:Give( "jenssons_fistslast" )
ply:SetHealth(300)
end
end
concommand.Add( "Weapstrip", Weapstrips )
[/CODE]
any ideas on how to fix this?
No need to use a concommand
[CODE]
function SWEP:PrimaryAttack()
if IsFirstTimePredicted() and SERVER then
self.Owner:StripWeapons()
self.Owner:Give( "weapon_zm_improvised" )
self.Owner:Give( "jenssons_fistsone" )
self.Owner:Give( "jenssons_fiststwo" )
self.Owner:Give( "jenssons_fiststhree" )
self.Owner:Give( "jenssons_fistsfour" )
self.Owner:Give( "jenssons_fistsfive" )
self.Owner:Give( "jenssons_fistssix" )
self.Owner:Give( "jenssons_fistslast" )
self.Owner:SetHealth(300)
end
end
[/CODE]
[QUOTE=MPan1;52369817]No need to use a concommand
[CODE]
function SWEP:PrimaryAttack()
if IsFirstTimePredicted() and SERVER then
self.Owner:StripWeapons()
self.Owner:Give( "weapon_zm_improvised" )
self.Owner:Give( "jenssons_fistsone" )
self.Owner:Give( "jenssons_fiststwo" )
self.Owner:Give( "jenssons_fiststhree" )
self.Owner:Give( "jenssons_fistsfour" )
self.Owner:Give( "jenssons_fistsfive" )
self.Owner:Give( "jenssons_fistssix" )
self.Owner:Give( "jenssons_fistslast" )
self.Owner:SetHealth(300)
end
end
[/CODE][/QUOTE]
thank you so much
Sorry, you need to Log In to post a reply to this thread.