Forum

> > CS2D > Scripts > Only CT Buy Weapons Script
Forums overviewCS2D overview Scripts overviewLog in to reply

English Only CT Buy Weapons Script

5 replies
To the start Previous 1 Next To the start

old Re: Only CT Buy Weapons Script

Yunuu
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
addhook("buy","by")
function by(id,wp)
te = player(id,"team")
if te == 1 then
return 1 
else
return 0 
end
end

old Re: Only CT Buy Weapons Script

Cure Pikachu
User Off Offline

Quote
@user Yunuu: Improved it a bit:
• 2nd parameter is unused so you can omit it
• There's no need to do the te = player(id,"team") and then if te == 1 then when you can just if player(id,"team") == 1, it saves a global variable
• No need to explicitly return 0 in this case
• Indent your code - it makes it easier to see
1
2
3
4
5
6
addhook("buy","by")
function by(id)
	if player(id,"team") == 1 then
		return 1
	end
end

old Re: Only CT Buy Weapons Script

Paulo49
User Off Offline

Quote
1
2
3
4
5
6
7
addhook("buy","OnBuy")
function OnBuy(id)
if player(id,'team') == 1 then
msg2(id,'Error: terrorist shop blocked!')
end
return 1
end

old Re: Only CT Buy Weapons Script

Talented Doge
User Off Offline

Quote
1
2
3
4
5
6
7
addhook("buy","OnBuy")
function OnBuy(id)
if player(id,'team') == 1 then
msg2(id,'Error: terrorist shop blocked!')
end
return 1
end

It blocks everyone from buying items. Cool.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview