English No Attack Zone

7 replies
Goto Page
To the start Previous 1 Next To the start
04.03.12 11:31:58 am
Up
Bobakrome
User
Offline Off
Hi all, i'm working on some server with school and i need something.

If you are in zones 3,3 to 44,27 ; 22,54 to 26,58 ; and others. I need really many because is school town etc. and others.

Oh yeah back to if you are in zones... then you cant get hurt, and you cant hurt people. i saw this thing in a AFK script.. Factis's AFK Protection
“Be the change that you wish to see in the world.”
04.03.12 11:37:29 am
Up
EngiN33R
Moderator
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
zones = {
     {3,3,44,27},
     {22,54,26,58}
}

function checkInZone(id)
     for zn,zone in pairs(zones) do
          if player(id,"tilex")>=zone[1] and player(id,"tiley")>=zone[2] and player(id,"tilex")<=zone[3] and player(id,"tiley")<=zone[4] then
               return zn
          end
     end
     return nil
end

addhook("hit","safezones")
function safezones(id,src)
     if checkInZone(id) then
          return 1
     end
     if checkInZone(src) then
          return 1
     end
end


I think this would work.

@user Alistaire: That will allow players to toggle invincibility anywhere - he wants it to be in zones.
I code, therefore I exist. | Visit my blog for Lua tips and other interesting info
04.03.12 11:43:18 am
Up
Bobakrome
User
Offline Off
user EngiN33R has written:
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
zones = {
     {3,3,44,27},
     {22,54,26,58}
}

function checkInZone(id)
     for zn,zone in pairs(zones) do
          if player(id,"tilex")>=zone[1] and player(id,"tiley")>=zone[2] and player(id,"tilex")<=zone[3] and player(id,"tiley")<=zone[4] then
               return zn
          end
     end
     return nil
end

addhook("hit","safezones")
function safezones(id,src)
     if checkInZone(id) then
          return 1
     end
     if checkInZone(src) then
          return 1
     end
end


I think this would work.

@user Alistaire: That will allow players to toggle invincibility anywhere - he wants it to be in zones.


Thanks, i really dont want school fights
“Be the change that you wish to see in the world.”
14.09.17 06:12:00 pm
Up
GamerX 17323
User
Offline Off
And if I want to add a message while the person is in this zone "safe zone"
14.09.17 10:05:26 pm
Up
LoaderFRA
User
Offline Off
You must use the command: hudtxt2
http://www.cs2d.com/help.php?cat=server&cmd=hudtxt2#cmd

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
zones = {
     {3,3,44,27},
     {22,54,26,58}
}

function checkInZone(id)
     for zn,zone in pairs(zones) do
          if player(id,"tilex")>=zone[1] and player(id,"tiley")>=zone[2] and player(id,"tilex")<=zone[3] and player(id,"tiley")<=zone[4] then
               return zn
          end
     end
     return nil
end

addhook("hit","safezones")
function safezones(id,src)
if checkInZone(id) then
parse('hudtxt2 '..id..' 5 "©000255255SAFE ZONE" 320 200')
return 1
end
     if checkInZone(src) then
          return 1
     end
end

PS:I think it's like that, i'm not expert in language lua
15.09.17 03:11:37 pm
Up
VADemon
User
Offline Off
That's called a Safezone.
My script: https://youtu.be/uXgJ5F8isrM
file cs2d [MECH/MAP] Entity-06-Safezone (8) - I linked 2 other safezone scripts at the end of the description
19.09.17 02:26:09 pm
Up
LoaderFRA
User
Offline Off
A script ready to be used, what to ask more, the author of this thread will be delighted
Thanks at @user VADemon.
To the start Previous 1 Next To the start