My little request for scripting is:
Sit system:
Use trigger_use
Press 'E' one the trigger_use or at the side of trigger_use, immediately position on trigger_use.
Player speed will decreased to 0.
Player won't move but can turn around until you press 'E' again.
Please make me this script that can automatically used or help me search, thank you. Admin/Mod Kommentar
"Little request pls." is a generic and hence bad title. Fixed! /DC Player speed will decrease to 0. That's normal speed. I'll assume that point 3 and 4 are actually one point saying "he can't move". Lua can't control player's rotation as it's in game and not supported by Lua.
Anyways
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
tbl = {}
addhook("usebutton","sit")
function sit(id,x,y) -- Id of the player, position of button in TILES !
	if x == 101 and y == 80085 then -- Where is the button ?
		if tbl[id]==0 then -- If not sitting
			tbl[id]=1 -- Starts sitting
			parse("speedmod "..id.." -100") -- Not moving
		else
			tbl[id]=0 -- Stops sitting
			parse("speedmod "..id.." 0") -- Can move
		end
	end
end
addhook("join","setstate")
function setstate(id)
	tbl[id]=0 -- When player joins, he's not sitting.
end
CODE 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
tbl = {}
addhook("usebutton","sit")
function sit(id,x,y)
if entity(x,y,"name")=="!seat" then
if tbl[id]==0 then -- If not sitting
tbl[id]=1 -- Starts sitting
parse("speedmod "..id.." -100") -- Not moving
			parse("setpos " .. id .. " " .. x*32+16 .. " " .. y*32+16)
else
tbl[id]=0 -- Stops sitting
parse("speedmod "..id.." 0") -- Can move
end
end
end
addhook("join","setstate")
function setstate(id)
tbl[id]=0 -- When player joins, he's not sitting.
end
this edit of Rainoth' code allows you to place seats per map editor by just placing a button named "!seat".
Also it teleports you onto the middle of the tile because elsewise you could sit on every surrounding tile too. omg User Offline
is the usebutton on a walkable tile? Possible with trigger_if.
Edit: Nvm, trigger_if can't concatenate "id" (would lead nil).