1× editiert, zuletzt 12.03.11 22:05:46
Forum
CS2D Scripts [Request] Pushing players[Request] Pushing players
20 Antworten Electrobuz hat geschrieben
i want to do a script that wo....
ok. Have fun
Elektrobuz hat geschrieben
So... Actually you want a script that prevents players from staying on something you don't know? How the fudge should we ever help you if you cannot even say what you want? (not tile but idk)
not the tile ..
i dont want to do
if you dont seed its a [Request]
Electrobuz hat geschrieben
seed
I saw that you seed that he didn't see.
Danikah hat geschrieben
I saw that you seed that he didn't see.
Electrobuz hat geschrieben
seed
I saw that you seed that he didn't see.
... thats spam cuz isnt help with the script ...
btw its off topic --'
and who ever care if i dont speak english well , dude im just trying to get help with lua im new with lua i just want help and you arent helping ..
Electrobuz hat geschrieben
and who ever care if i dont speak english well , dude im just trying to get help with lua im new with lua i just want help and you arent helping ..
I do care if you don't speak English well.
But ignoring this conservation, I understood what you mean. Like in Minecraft, If you wanna move to a block (tile in our case) where a player already stands, you get pushed away, because you just can't go inside the other player (or climbing on his head, in our case).
Pushing the player back, in this case would just be bad and not make sense. Instead by creating a kind of invisible block area using math phys. you could make it "non-trespassable" for other players, sort of say. Or even better a circle, since math phys. allows that, and if it was a block it would possibly make other players stuck in the area of the block as the player rotates, making it a circle will reduce chances getting stuck at least. It will work.
Only KimKat get it, like, players in CS2D can move through each other, but he don't want to that happens, he wants a cript that don't let players move throught other ones, like in real life.
"Two bodies can not occupy the same place at the same time", physic.
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
addhook("movetile", "BlockPlayer") local ppos = {} -- A small table containing (previous) player positions for pushing back. function BlockPlayer(id, tx, ty) 	for _, v in pairs(player(0,"tableliving")) do 		if player(v, "tilex") == tx and player(v, "tiley") == ty then 			parse("setpos " .. id .. " " .. ppos[id][1] .. " " .. ppos[id][2]) 		else 			ppos[id] = { tx, ty } 		end 	end end
That should do... Probably extremely buggy though.
1
2
3
4
5
2
3
4
5
-- x y = the player that isnt walking ? local dista = math.ceil(math.sqrt((player(id,"x")-x)^2 + (player(id,"y")-y)^2)) if dista < 26 then --push ? end
Edit: Btw your script is good!
but i dont want the "tile" things, i want the players pixels
so it stays more realistic '-'
1× editiert, zuletzt 13.03.11 18:28:59
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
addhook("move", "BlockPlayer") local ppos = {} -- A small table containing (previous) player positions for pushing back. function BlockPlayer(id, x, y) 	for _, v in pairs(player(0,"tableliving")) do 		if math.ceil(math.sqrt((player(id,"x")-player(v,"x"))^2 + (player(id,"y")-player(id,"y"))^2)) < 26 then 			parse("setpos " .. id .. " " .. ppos[id][1] .. " " .. ppos[id][2]) 		else 			ppos[id] = { x, y } 		end 	end end
it gives an error i fixed it but..
it still gives error + keep teleporting me to the same place that i were
:l
if math.ceil(math.sqrt((player(id,"x")-player(v,"x"))^2 + (player(id,"y")-player(id,"y"))^2)) < 26 then
wtf with the 2 player(id,"y") ?
1 isnt to be v and not id ?
that was the error
but there another 500 errors
could you make a new one ?
Edit:Btw the players pixels round is 24 '-'
Banaan hat geschrieben
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("move", "BlockPlayer") local ppos = {} -- A small table containing (previous) player positions for pushing back. function BlockPlayer(id, x, y) 	x = x * 32 + 16 	y = y * 32 + 16 	for _, v in pairs(player(0,"tableliving")) do 		if math.ceil(math.sqrt((player(id,"x")-player(v,"x"))^2 + (player(id,"y")-player(v,"y"))^2)) < 24 then 			parse("setpos " .. id .. " " .. ppos[id][1] .. " " .. ppos[id][2]) 		else 			ppos[id] = { x, y } 		end 	end end
Should work now.
Yasday hat geschrieben
Should work now.
Banaan hat geschrieben
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("move", "BlockPlayer") local ppos = {} -- A small table containing (previous) player positions for pushing back. function BlockPlayer(id, x, y) 	x = x * 32 + 16 	y = y * 32 + 16 	for _, v in pairs(player(0,"tableliving")) do 		if math.ceil(math.sqrt((player(id,"x")-player(v,"x"))^2 + (player(id,"y")-player(v,"y"))^2)) < 24 then 			parse("setpos " .. id .. " " .. ppos[id][1] .. " " .. ppos[id][2]) 		else 			ppos[id] = { x, y } 		end 	end end
Should work now.
no
its out of bounds
@ Yasday: It says:
1× editiert, zuletzt 10.07.12 00:25:11