Forum

> > CS2D > Scripts > Equip TRS SCRIPT
Forums overviewCS2D overview Scripts overviewLog in to reply

English Equip TRS SCRIPT

7 replies
To the start Previous 1 Next To the start

old Equip TRS SCRIPT

Jededias
User Off Offline

Quote
I need a script that equip all grenades to TERRORIST PLAYERS, ONLY TERRORIST PLAYERS.

Equip every 30 seconds

old Re: Equip TRS SCRIPT

RIP-HereRestsPlookerbooy
BANNED Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
equiptimer = 0
addhook("second","equiphe")
function equiphe()
	if equiptimer == 30 then
		equiptimer = 0
		for _, id in ipairs(player(0, "team1living")) do
			parse("equip "..id.." 51")
		end
	else
		equiptimer = equiptimer + 1
	end
end

Edited
user VADemon Thanks for your tip,I appreciate it so much :).
edited 2×, last 01.02.16 12:16:49 pm

old Re: Equip TRS SCRIPT

THEMUD
User Off Offline

Quote
You can simply do it with the CS2D's timer function like the example below:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function Grenades()
	for _, id in ipairs(player(0, "team1living"))
		do
		parse("equip "..id.." 51");
	end
	delay = false;
end

addhook("join", "_join")
function _join(id)
	timer(30000, "Grenades");
	delay = true;
end

addhook("ms100", "_ms100")
function _ms100()
	if delay ~= true then
		timer(30000, "Grenades");
		delay = true;
	end
end

old Re: Equip TRS SCRIPT

VADemon
User Off Offline

Quote
user THEMUD your script will start grenades timer every time a player joins. So if many players joined, the equip would be called more than once per 30 seconds.

@user RIP-HereRestsPlookerbooy: your script is straightforward and works flawlessly. Tip: you should use for _, id in ipairs(player(0, "team1living")) to iterate through players.
UPD: Screw that ^ it is a poor advice
edited 1×, last 01.02.16 09:49:08 pm

old Re: Equip TRS SCRIPT

THEMUD
User Off Offline

Quote
@user VADemon: Thanks for mentioning.
Otherwise, my code seems unusable. Because I tried to modfy it, and I came with storing a variable for every player who joins.
And it works, but it just gives that specified player the grenade not all the terrorists which is not the right intended of this code.
Thus, better use @user RIP-HereRestsPlookerbooy's code.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview