Forum

> > CS2D > Scripts > How Make Home Control Lua Scripte
Forums overviewCS2D overview Scripts overviewLog in to reply

English How Make Home Control Lua Scripte

1 reply
To the start Previous 1 Next To the start

old How Make Home Control Lua Scripte

Kev1
User Off Offline

Quote
Hi, I would like to have your help to create a script with :

A menu with option "open/close home", "open/close window", "free home" inactive without house
A message at the bottom of the screen, with the number of your home "Your Home : "

1
2
3
For Example :
Home 1: control button "H1" / Door "D1" / Windows "W1"
Home 2: control button "H2" / Door "D2" / Windows "W2"

When the player press on the "H1" button to control the home 1:
The button becomes inactive
The message at the bottom of the screen becomes "Your Home : Home 01"

The menu option control the home 1 :
1
2
3
"Open home"      => open/close "D1"
"Open windows"   => open/close "W1"
"Free Home"      => Stop the control of the home and activate back the control knob "H1", and a message says "Home 01 is free"

When I take the Home 2 with button "H2" or exit server, I free the first, as with the option "Free Home".

I start a script with that I could find on the forum, but I'm bad in Lua Script

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
addhook("usebutton","_te")
function _te(id,x,y)
	if entity(x,y,"name") == "H1" then
		msg2(id,"Now, you control this home !")
		rp_home01[id]=true
	elseif entity(x,y,"name") == "H2" then
		msg2(id,"Now, you control this home !")
		rp_home02[id]=true
	end
end


addhook("serveraction","actions")
function actions(id,b)
	if b==1 then
		menu(id,"Home System,Open door,Open windows,Free Home")
	end
end


addhook("menu","trigger")
function trigger(id,title,button)
	if rp_home01[id]==true then
		if title == "Home System" then
			if button == 1 then
			parse ("trigger ".."D1")
			end
		end
		if title == "Home System" then
			if button == 2 then
			parse ("trigger ".."W1")
			end
		end
	end
	if rp_home02[id]==true then
		if title == "Home System" then
			if button == 1 then
			parse ("trigger ".."D2")
			end
		end
		if title == "Home System" then
			if button == 2 then
			parse ("trigger ".."W2")
			end
		end
	end
end

Thx for your help
edited 3×, last 09.06.14 03:26:04 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview