Forum

> > CS2D > Scripts > Only CT Buy Weapons Script
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Only CT Buy Weapons Script

5 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Re: Only CT Buy Weapons Script

Yunuu
User Off Offline

Zitieren
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

alt Re: Only CT Buy Weapons Script

Cure Pikachu
User Off Offline

Zitieren
@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

alt Re: Only CT Buy Weapons Script

Paulo49
User Off Offline

Zitieren
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

alt Re: Only CT Buy Weapons Script

Talented Doge
User Off Offline

Zitieren
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.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht