CSGO Knifes into Pointshop

#close

It can be done fairly easily with lua.

Yeah but is there somewhere a Code for it ?

yo mate,
the pointshop codes will probably need something like this
ITEM.Name = ‘<Dat knife name>’
ITEM.Price = 0
ITEM.Model = ‘models/weapons/<Knifename>l’

function ITEM:OnEquip(ply)
ply:StripWeapon(‘weapon_zm_improvised’)
ply:Give(self.WeaponClass)
end

Correct me if im wrong

===================
Edit 1: his just asked how it’s possible…
Hint : ply:StripWeapon(‘weapon_zm_improvised’) --the crowbar
ply:Give(self.WeaponClass) --your pointshop melee wep
^ is gonna be useful, do some reading up on the pointshop documentation

You do not have ITEM:Holster which will probably make the person not be able to holster it.

thx ill try it out

[editline]3rd October 2015[/editline]

Now it looks like this :


ITEM.Name = 'Karambit Tiger Tooth' 
ITEM.Price = 0
ITEM.Model = 'models/weapons/w_csgo_karambit.mdl' 
ITEM.WeaponClass = 'csgo_karambit_fade'

function ITEM:OnBuy(ply)
	ply:Give(self.WeaponClass)
	ply:SelectWeapon(self.WeaponClass)
end

function ITEM:OnSell(ply)
	ply:StripWeapon(self.WeaponClass)
end

function ITEM:OnEquip(ply)
ply:StripWeapon('weapon_crowbar')
ply:Give(self.WeaponClass)
end

But after equipping ive got the crowbar and dont have the Karambit :frowning:

Because its ITEM:OnBuy

what do you mean?

Are you using TTT? If so, it needs to be on the ttt weapon base

Yeah , Im using TTT

Copypaste the default crowbar swep, rename the duplicate, change the view/model world to that knife and then other settings - use that instead

Thx Ill try it out

[editline]3rd October 2015[/editline]

K thx Ive got it now but can you tell me the function that the knife removes himself and puts the Crowbar back? When I holster it

Are you trying at all?



ply:StripWeapon('weapon_crowbar')
ply:Give(self.WeaponClass)


recode that, then you did it.

What do u mean?
I tried it but my Problem is that its for all players and cant be holstert in the pointshop( it can be holstered but it makes nothing)


ITEM.Name = 'Karambit Tiger Tooth'
ITEM.Price = 0
ITEM.Model = 'models/weapons/w_csgo_karambit.mdl'
ITEM.WeaponClass = 'csgo_karambit_fade'

function ITEM:OnEquip(ply, modifications)
	hook.Add( "TTTPrepareRound", "tigertooth" .. ply:EntIndex( ), function()
		timer.Simple(0, function() 
			ply:StripWeapon('weapon_crowbar') --you should change this to TTT's crowbar instead of this
			ply:Give(self.WeaponClass)
			ply:SelectWeapon(self.WeaponClass)
		end)
	end)
end


function ITEM:OnHolster(ply)
	hook.Remove( "TTTPrepareRound", "tigertooth" .. ply:EntIndex( ) )
end

function ITEM:OnSell(ply)
	hook.Remove( "TTTPrepareRound", "tigertooth" .. ply:EntIndex( ) )
end


Not sure if it’ll work for you, but it sure works for me :stuck_out_tongue:

BONUS:


function ITEM:CanPlayerEquip(ply)
	if ply:PS_HasItemEquipped( 'itemname' ) then
		ply:PS_Notify( 'Don't equip 2 knifes at once' )
		return false
	end

	return true
end


I use that part when I have more than one melee weapon that replaces crowbar on pointshop

EDIT: if this shitty code ACTUALLY works fine, we’ll see many servers with shitty reskins…

it doesnt matter if you code it with hooks, he just doesnt understand how to do shit, and wants it spoonfed.

Thx , Ive got it now.
#close

Close it yourself? Theres a big fat button on the top saying “Mark this thread as solved” >w<