Forum

> > CS2D > Scripts > [Request] Pushing players
Forums overviewCS2D overview Scripts overviewLog in to reply

English [Request] Pushing players

20 replies
Page
To the start Previous 1 2 Next To the start

old [Request] Pushing players

Syph
User Off Offline

Quote
i want some 1 to do a script that wont let the players stay at the same tile (not tile but idk) if the player try to get on another player he get pushed back
edited 1×, last 12.03.11 10:05:46 pm

old Re: [Request] Pushing players

Banaan
User Off Offline

Quote
Elektrobuz has written
(not tile but idk)
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?

old Re: [Request] Pushing players

medeiros
User Off Offline

Quote
I think he wants a script that prevent players from being close/next to a specific one or to prevent players to be close/next to each other.

old Re: [Request] Pushing players

Syph
User Off Offline

Quote
Danikah has written
Electrobuz has written
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 ..

old Re: [Request] Pushing players

Danikah
User Off Offline

Quote
Electrobuz has written
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).

old Re: [Request] Pushing players

KimKat
GAME BANNED Off Offline

Quote
He wants a Lua script that makes the player act as sort of a block, you can't walk into the player or hiding under/over the player. I think that's what he means.

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.

old Re: [Request] Pushing players

Mechanolith
User Off Offline

Quote
Is that so hard to understand?! - -''
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.

old Re: [Request] Pushing players

Banaan
User Off Offline

Quote
1
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.

old Re: [Request] Pushing players

Syph
User Off Offline

Quote
well it should be like with this base :


1
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 '-'
edited 1×, last 13.03.11 06:28:59 pm

old Re: [Request] Pushing players

Banaan
User Off Offline

Quote
You want it accurately?

1
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

old Re: [Request] Pushing players

Syph
User Off Offline

Quote
sorry but it isnt working
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 '-'

old Re: [Request] Pushing players

Yasday
User Off Offline

Quote
Banaan has written
1
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.

old Re: [Request] Pushing players

Syph
User Off Offline

Quote
Yasday has written
Banaan has written
1
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

old Re: [Request] Pushing players

Shiftt
User Off Offline

Quote
I know this thread is old but i want that script too.

@user Yasday: It says:
Spoiler >
edited 1×, last 10.07.12 12:25:11 am
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview