Can someone do that?
Forum
CS2D Scripts Only CT Buy Weapons ScriptOnly CT Buy Weapons Script
5 replies 1
Can someone do that?
1
2
3
4
5
6
7
8
9
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
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
2
3
4
5
6
addhook("buy","by") function by(id) 	if player(id,"team") == 1 then 		return 1 	end end
1
2
3
4
5
6
7
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
1
2
3
4
5
6
7
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.
1