Forum

> > CS2D > Scripts > no damage
Forums overviewCS2D overview Scripts overviewLog in to reply

English no damage

2 replies
To the start Previous 1 Next To the start

old no damage

princeofpersia
User Off Offline

Quote
hi i need a lua that some players for example player id=1 cant damage other players .
pls help me

old Re: no damage

minos
User Off Offline

Quote
try this :

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
Player = {};
Player.damage={}

addhook("say","say_hook")
function say_hook(id, txt)
if txt:sub(1,8)=="!damage " then
local mid = tonumber(sub:txt(9,10))
	if Player.damage[mid]==false then 
		Player.damage[mid]=true
msg2(id,""..player(mid,"name").." Can't kill players now")
	else
		Player.damage[mid]=false
msg2(id,""..player(mid,"name").." Can kill players now")
	end
return 1
end
end

addhook("hit","hit_hook")
function hit_hook(id, atk)
if player(atk,"exists") and Player.damage[atk]==true then
    if player(id,"exists") then
	msg2(atk,"You can't kill players")
    return 1 
    end
end
end

addhook("join","join_hook")
function join_hook(id)
Player.damage[id]=false
end

EDIT : i didn't test it yet
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview