Forum

> > CS2D > Scripts > Can't kill
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Can't kill

8 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Can't kill

Blacko
User Off Offline

Zitieren
Hello everybody !
I need your help !
I search a Script for my Server
It made a zone where nobody can make damage, kill other people. "A peace area"
Please, help !
Thanks you !
iDios

alt Re: Can't kill

Danikah
User Off Offline

Zitieren
inb4theoneswhodontspeaknoobish

He wants a scipt which makes a zone, a "peace area" where you cannot hurt others, but outside it, you can. Similar to Tibia's safe zones.

alt Re: Can't kill

Yasday
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
area = { x1 = 0, y1 = 0, x2 = 100, y2 = 100 }

addhook([[hit]], [[area.hit]])
function area.hit(id, src, wpn)
if player(id, "tilex") >= area.x1 and player(id, "tiley") >= area.y1 and player(id, "tilex") <= area.x2 and player(id, "tiley") <= area.y2 then
return 1
end
end

alt Re: Can't kill

Infinite Rain
Reviewer Off Offline

Zitieren
try this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function sa(id,x1,y1,x2,y2)
 return (player(id,'tilex')>x1 or player(id,'tilex')==x1) and (player(id,'tilex')<x2 or player(id,'tilex')==x2) and (player(id,'tiley')>y1 or player(id,'tiley')==y1) and (player(id,'tiley')<y2 or player(id,'tiley')==y2)
end

--DONT TOUCH THIS
peacearea={}
--NOW U CAN TOOUCH
peacearea[1]={x1=12,y1=32,x2=58,y2=64}

addhook('hit','nohit')
function nohit(id,source)
 for a=1,#peacearea do
  if sa(id,peacearea[a].x1,peacearea[a].y1,peacearea[a].x2,peaceare[a].y2) then
   msg2(source,'You cant attack on peaceful area!')
   return 1
  end
 end
end

Youcan make moreareas with my table a the top (peacerea[1])
x1 and y1 - X and Y from the left top corner (where starts area)
x2 and y2 - X and Y from the right bottom corner (where ends area)

alt Re: Can't kill

Blacko
User Off Offline

Zitieren
Hello !
I try your, factis699, but he don't work.
LUA ERROR: sys/lua/main.lua:1615: attempt to index global 'peaceare' (a nil value)

alt Re: Can't kill

Geez
GAME BANNED Off Offline

Zitieren
because peaceare don't exist.

you should change it to
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function sa(id,x1,y1,x2,y2)
return (player(id,'tilex')>x1 or player(id,'tilex')==x1) and (player(id,'tilex')<x2 or player(id,'tilex')==x2) and (player(id,'tiley')>y1 or player(id,'tiley')==y1) and (player(id,'tiley')<y2 or player(id,'tiley')==y2)
end

--DONT TOUCH THIS
peacearea={}
--NOW U CAN TOOUCH
peacearea[1]={x1=12,y1=32,x2=58,y2=64}

addhook('hit','nohit')
function nohit(id,source)
for a=1,#peacearea do
if sa(id,peacearea[a].x1,peacearea[a].y1,peacearea[a].x2,peacearea[a].y2) then
msg2(source,'You cant attack on peaceful area!')
return 1
end
end
end

Error was here:
if sa(id,peacearea[a].x1,peacearea[a].y1,peacearea[a].x2,peacearea[a].y2) then

alt Re: Can't kill

Blacko
User Off Offline

Zitieren
It's ok for this Script.
But now, I search a Script who give Speedmod 50 to a Player when he go on a tile.
I don't know if you understand :S
I hope !
Thanks you
iDios
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht