Forum

> > CS2D > Scripts > Bad argument #1 to tween_move(number expected got
Forums overviewCS2D overview Scripts overviewLog in to reply

English Bad argument #1 to tween_move(number expected got

3 replies
To the start Previous 1 Next To the start

old Bad argument #1 to tween_move(number expected got

J4x
User Off Offline

Quote
Hi, I was trying to make a something like a image that follows the cursor, but I get this error: Bad argument #1 to tween_move(number expected got nil

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
----------------------------
-- Aimableweapons by FN_Linkin Park
-- For more info. visit: Unrealsoftware.de
-- Don't Steal this!
----------------------------

-- image and time
timer(120,"requestdata","",0)

addhook("spawn","aim")
function aim(id)
	freeimage(id)
	img = image("gfx/scope.png",player( id, "x"), player( id, "y"),3,id)
end

-- Request data
function requestdata()	
reqcld(0,2)
end


-- In coming data
addhook("clientdata","mycursordata")
function mycursordata(id,mode,x,y)
	if (mode == 2) then
			tween_move(img,120,x,y)
		end
	end
edited 2×, last 24.04.11 10:28:01 pm

old Re: Bad argument #1 to tween_move(number expected got

Starkkz
Moderator Off Offline

Quote
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
timer(120,"requestdata","",0)

CursorSprite = {}
addhook("spawn","aim")
function aim(id)
	if CursorSprite[id] then
		freeimage(CursorSprite[id])
		CursorSprite[id] = image("gfx/scope/png",player(id,"x"),player(id,"y"),3,id)
	end
end

function requestdata()
	reqcld(0,2)
end

addhook("clientdata","mycursordata")
function mycursordata(id,mode,x,y)
	if mode == 2 then
		if CursorSprite[id] then
			-- Check if this variable is not null
			tween_move(CursorSprite[id],120,x,y)
		end
	end
end

addhook("leave","onLeave")
function onLeave(id)
	-- CS2D Auto remove sprite on leave
	CursorSprite[id] = nil
end

addhook("startround","onStart")
function onStart()
	-- CS2D Auto remove sprite on start round
	CursorSprite = {}
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview