Forum

> > CS2D > Scripts > Delay script
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Delay script

12 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Delay script

ead
User Off Offline

Zitieren
Hello everyone! I need a script that works like this, the player can buy the AWP gun a few times in 5 to 20 round for example and the rest of 15 rounds he can not buy weapon. I need a script like this because I use the de_cs2d map and it gets a little hard to detect someone using hack

Thank you in advance

Edit ;
For who did not understand I want a script like this, prohibit buy 1 round and another not the AWP gun.
1× editiert, zuletzt 17.02.17 17:06:59

alt Re: Delay script

Zeik
User Off Offline

Zitieren
Requirements are not clear:

• "the player can buy the AWP gun a few times in 5 to 20 round ... and the rest of 15 rounds he can not buy weapon"
How much is "few" times?
From round 5 to 20 you can only buy AWP a "few" times? but from round 20 to 35 you can't buy it even though you had not bought it a "few" times yet?

• "prohibit buy 1 round and another not the AWP gun."
Here you're saying that you can buy AWP in odd rounds and not in even rounds?

The second requirement contradicts the first and none of them is clear.

alt Re: Delay script

ead
User Off Offline

Zitieren
@user Zeik: Hello, so I want a script like this. Not allow always the player buy only AWP every round

alt Re: Delay script

Bowlinghead
User Off Offline

Zitieren
If someone writes that your requirements are not clear then it is not optimal to write 1 sentence that doesnt give additional information.

Please give more detail (Use more words, be specific!)!

alt Re: Delay script

Cure Pikachu
User Off Offline

Zitieren
Suppose the player buys an AWP on round 5, now you don't want that player to buy another AWP until round 7. Is that correct?

alt Re: Delay script

ead
User Off Offline

Zitieren
It would be like:
Round 1: Buy AWP.
Round 2: Can't buy AWP.
Round 3: Buy AWP.

In this chronology on

alt Re: Delay script

Zeik
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
round = 1

addhook("endround", "e_endround")
function e_endround()
  round = round + 1
end

addhook("buy", "e_buy")
function e_buy(id, wp)
  if (wp == 35 and round%2 == 0) then
    return 1
  end
end
1× editiert, zuletzt 19.02.17 04:42:24

alt Re: Delay script

Cure Pikachu
User Off Offline

Zitieren
@user Zeik: Your line 10 has a missing
then
. Besides, I can shorten your code to this:
1
2
3
4
5
6
addhook("buy","e_buy")
function e_buy(id,wp)
	if wp == 35 and (tonumber(game("round"))%2 == 0) then
		return 1
	end
end

This is IMO a better version - it prevents players from buying more than 1 AWP in a single round and don't have to wait for even rounds to buy one.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
awpcooldown = 2 -- How many rounds to wait before you can buy another AWP

awplocked = {}
awplockround = {}

addhook("join","e_join")
function e_join(id)
	awplocked[id] = false
	awplockround[id] = 0
end

addhook("leave","e_leave")
function e_leave(id)
	awplocked[id] = nil
	awplockround[id] = nil
end

addhook("endround","e_endround")
function e_endround()
	for _, id in ipairs(player(0,"table")) do
		if awplocked[id] then
			awplockround[id] = awplockround[id] + 1
			if awplockround[id] == awpcooldown then
				awplocked[id] = false
				awplockround[id] = 0
			end
		end
	end
end

addhook("buy","e_buy")
function e_buy(id,wp)
	if wp == 35 then
		if awplocked[id] then
			msg2(id,"\169255000000You can't buy another AWP until "..(awpcooldown-awplockround[id]).." round(s) later!")
			return 1
		else
			awplocked[id] = true
		end
	end
end
2× editiert, zuletzt 19.02.17 05:10:47

alt Re: Delay script

Yates
Reviewer Off Offline

Zitieren
That would never be noticeable. If you said it were for better practice, sure, but not for "better performance".
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht