Forum

> > CS2D > Scripts > House System & No-damage area
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch House System & No-damage area

17 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt House System & No-damage area

Hanz
User Off Offline

Zitieren
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

Zitat
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)


Zitat
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.
6× editiert, zuletzt 04.11.12 13:00:50

alt Re: House System & No-damage area

Suprise
BANNED Off Offline

Zitieren
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.

alt Re: House System & No-damage area

Hanz
User Off Offline

Zitieren
user Suprise hat geschrieben
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.

alt Re: House System & No-damage area

Marcell
Super User Off Offline

Zitieren
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...

alt Re: House System & No-damage area

Jynxxx
User Off Offline

Zitieren
@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.

alt Re: House System & No-damage area

Hanz
User Off Offline

Zitieren
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

alt Re: House System & No-damage area

uaiek
User Off Offline

Zitieren
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.
1× editiert, zuletzt 13.10.12 15:44:24

alt Re: House System & No-damage area

Hanz
User Off Offline

Zitieren
@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.
2× editiert, zuletzt 20.10.12 06:24:58

alt Re: House System & No-damage area

Starkkz
Moderator Off Offline

Zitieren
Spoiler >


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

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


It works only with USGN registered players.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht