Forum

> > CS2D > Scripts > LFS| Spawn equip & Equip on kill
Forums overviewCS2D overview Scripts overviewLog in to reply

English LFS| Spawn equip & Equip on kill

4 replies
To the start Previous 1 Next To the start

old LFS| Spawn equip & Equip on kill

Ace Howl
User Off Offline

Quote
Hello!
I have 2 problems about lua for my server.
Spoiler >
I'm not a lua expert... and these are the problems.
Problem 1:
I want every player will generate $100 in every second(bots doesn't matter.)
Here's what I write:
1
2
3
4
5
addhook("second","generation")

function generation()
	parse("setmoney "..id.." 100")
end
I got this when I see console:
attempt to concatenate local 'id' (a nil value)


Problem 2:
When the player enter specific teams on spawn, they will get certain items. Example: Survivor will get Mac-10, Zombies will get Gut Bomb with unlimited uses.

Hope you can solve this 'easy' problems.
edited 4×, last 15.11.14 01:11:38 pm

old Re: LFS| Spawn equip & Equip on kill

Avo
User Off Offline

Quote
1)
1
2
3
4
5
6
addhook("second","generation")
function generation()
	for _, id in pairs(player(0, "tableliving")) do
		parse("setmoney "..id.." "..(player(id, "money") + 100))
	end
end

old Re: LFS| Spawn equip & Equip on kill

EngiN33R
Moderator Off Offline

Quote
user Ace Howl has written
Problem 2:
When the player enter specific teams on spawn, they will get certain items. Example: Survivor will get Mac-10, Zombies will get Gut Bomb with unlimited uses.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
local prevwep = {} -- Last selected weapon

addhook("spawn","specificitems")
function specificitems(id)
	if (player(id,"team")==1) then
		return "86" -- Gut Bomb for Terrorists (Zombies)
	elseif (player(id,"team")==2) then
		return "23" -- Mac-10 for CT (Survivors)
	end
end

addhook("attack","unlimitedgutbomb")
function unlimitedgutbomb(id)
	if (player(id,"weapon") == 0) then -- weapon defaults to zero when throwing a grenade
		if (prevwep[id] == 86) then -- Check against the weapon last selected
			parse("equip "..id.." 86")
		end
	end
end

addhook("select","setprevwep")
function setprevwep(id,type)
	prevwep[id] = type -- Set last selected weapon
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview