Forum

> > CS2D > Scripts > House System & No-damage area
Forums overviewCS2D overview Scripts overviewLog in to reply

English House System & No-damage area

17 replies
To the start Previous 1 Next To the start

old House System & No-damage area

Hanz
User Off Offline

Quote
Hi, I need some help here. I know what I'm asking is very much but please help me.

I think If you want to make a menu, I recommended you to use serveraction 3

Quote
House System

• You can't use the trigger If you not the owner of the house (e.g door1,door2,door3)

1
2
3
4
5
Houset ={
		{house1}{door1,door2,door3},
		{house2}{door4,door5,door6},
		{house3}{door7,door8,door9},
	},

• You can be the owner of the house by clicking the trigger (e.g house1,house2,house3) & pay it for 25000 (Once for forever, except If you leave the server or stop renting it).

Payment code:

1
rp_money[id]=rp_money[id]-25000

House code:

house1 trigger to buy the house & door1,door2,door3 are the trigger than can be used after you buy it.

1
2
3
4
5
Houseo ={
		{house1}{door1,door2,door3},
		{house2}{door4,door5,door6},
		{house3}{door7,door8,door9},
	},

• Only the trigger that written down here that will be restricted from being used without owned the house.

1
2
3
Nouse ={
		{door1,door2,door3,door4,door5,door6,door7,door8,door},
	},

• Player only can have one house (Even admin can't have more than one house)

• Only the owner of the house can build, destroy, trigger something in the house (Admin can build, destroy, trigger something in the house even it's wasn't his house)


Quote
No-damage area

• You can't attack someone in some area (Absolutely can't)

1
2
3
Nodagamea ={
		{{10,20},{30,40}},
		{{50,60},{70,80}},

• If someone attack you then the attacker will receive some message (e.g You can not hurt anyone here). I don't want the attacker think that was a lag & then leave the server.
edited 6×, last 04.11.12 01:00:50 pm

old Re: House System & No-damage area

Suprise
BANNED Off Offline

Quote
No damage area==>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
no_attack_zone = {
     {29,22,48,42}, --zones 29,22 X pos, 48,42 Y pos (tiles) to add more zones copypaste the '{29,22,48,42},' and write more. Enter after the '{numbers}'.
}

function no_attack(id)
	for n,w in pairs (no_attack_zone) do
		local tilex=player(id,"tilex")
		local tiley=player(id,"tiley")
		if tilex>=w[1] and tilex <=w[3] and tiley >= w[2] and tiley <= w[4] then
			return true
		end
	end
	return false
end

addhook('hit','attack')
function attack(id)
	if no_attack(id) then
		return 1
	end
end
I copied this from my Multigame. It works fine.

EDIT: ok I forgot that you Absolutely can't attack. I'll edit it.

old Re: House System & No-damage area

Hanz
User Off Offline

Quote
user Suprise has written
No damage area==>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
no_attack_zone = {
     {29,22,48,42}, --zones 29,22 X pos, 48,42 Y pos (tiles) to add more zones copypaste the '{29,22,48,42},' and write more. Enter after the '{numbers}'.
}

function no_attack(id)
	for n,w in pairs (no_attack_zone) do
		local tilex=player(id,"tilex")
		local tiley=player(id,"tiley")
		if tilex>=w[1] and tilex <=w[3] and tiley >= w[2] and tiley <= w[4] then
			return true
		end
	end
	return false
end

addhook('hit','attack')
function attack(id)
	if no_attack(id) then
		return 1
	end
end
I copied this from my Multigame. It works fine.

EDIT: ok I forgot that you Absolutely can't attack. I'll edit it.


Thank you very much. I am gonna wait until it absolutely can't be damaged.

old Re: House System & No-damage area

Marcell
Super User On Online

Quote
didn't work anywaay... i tried it... and nothing happened when i click with left mouse at this area...
i checked the console.. and nothing show'd...

old Re: House System & No-damage area

Jynxxx
User Off Offline

Quote
@user Marcell: And what was the console supposed to say?
1
Console: You can't attack here.
No doesn't work this way. if you want a message to show up add it in the function.

old Re: House System & No-damage area

Hanz
User Off Offline

Quote
I don't believe that cannot be done, because I've a no-damage code but it only designed for admin (They can't be killed whatever you do except you force him to die with using killplayer on console or they get crashed by a dynwall) I don't know how to change that to work per area not per admin.

I don't know did you understand

old Re: House System & No-damage area

uaiek
User Off Offline

Quote
You absolutely cannot omit related action(s) [if there are any] performed by CS2D.
read cs2d lua hook attack


My "no damage area" code
Spoiler >


Instructions:
input start x,y tile coordinates in a sub-nodmgarea table [1],[2]
and then input end x,y tile coordinates in the sub-nodmgarea table[3][4]

(S)XXXXXXX
   XXXXXXXX
   XXXXXXXX
   XXXXXXX(E)


If you stand in X tile, you're protected.
If you want only 1 tile, input like the second sub-table.
Your tables must be like these:
1
nodmgarea = {{10,20,10,20},{30,40,30,40},{50,60,50,60},{70,80,70,80}}

It works fine for me, I'd hope it works for you too.
edited 1×, last 13.10.12 03:44:24 pm

old Re: House System & No-damage area

Hanz
User Off Offline

Quote
@user Jynxxx: I want they buy the house & The house will be their house If they do not leave the server or until the round restart.
edited 2×, last 20.10.12 06:24:58 am

old Re: House System & No-damage area

Starkkz
Moderator Off Offline

Quote
Spoiler >


I'm not sure if works or not, I haven't tested it.

Use:
Quote
MakeProperty"PROPERTY_NAME_HERE"{areaStartX,areaStartY,areaEndX,areaEndY}{"trigger1","trigger2","trigger3","etc..."}{price}


It works only with USGN registered players.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview