Forum

> > CS2D > Scripts > The clientdata usage(mouse position)!
Forums overviewCS2D overview Scripts overviewLog in to reply

English The clientdata usage(mouse position)!

4 replies
To the start Previous 1 Next To the start

old The clientdata usage(mouse position)!

tom282f3
User Off Offline

Quote
How to use client data to achieve this function?
1) Detects your mouse position.
2) Whenever your mouse hover on someone,
3) A hudtext shows up and says "Examine <PLAYER NAME>" which <PLAYER NAME> is the player's name who you hovered.

Please help me!!! I am going to die on dealing this myself

old Re: The clientdata usage(mouse position)!

palomino
User Off Offline

Quote
user tom282f3 has written
How to use client data to achieve this function?
1) Detects your mouse position.
2) Whenever your mouse hover on someone,
3) A hudtext shows up and says "Examine <PLAYER NAME>" which <PLAYER NAME> is the player's name who you hovered.

Please help me!!! I am going to die on dealing this myself

It is already in the default command list imo. Search.

old Re: The clientdata usage(mouse position)!

DC
Admin Off Offline

Quote
take a look at sys/lua/samples/cursors.lua to see how the clientdata stuff works in general

what you need to do for your script is to loop over all living players and to compare their position with the position of the mouse pointer.
1
2
3
4
5
6
t=player(0,"tableliving")
for i=1,#t do
	if player(t[i],"x")>=cursorx and ... >= cursory and ... <= cursorx+32 and ... cursory+32 then
		... show player name...
	end
end
edited 1×, last 08.10.11 05:19:15 pm

old Re: The clientdata usage(mouse position)!

tom282f3
User Off Offline

Quote
user DC has written
take a look at sys/lua/samples/cursors.lua to see how the clientdata stuff works in general

what you need to do for your script is to loop over all living players and to compare their position with the position of the mouse pointer.


DC thanks.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview