Forum

> > CS2D > Scripts > bad argument #1 to imagealpha (number expected)
Forums overviewCS2D overview Scripts overviewLog in to reply

English bad argument #1 to imagealpha (number expected)

2 replies
To the start Previous 1 Next To the start

old bad argument #1 to imagealpha (number expected)

prosuWANTED
User Off Offline

Quote
Oh my god!
I cant take this anymore!
I tried everything (even converting number to string then string to number) but it doesn't work!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
HitMarker={}

for id=1,32 do
HitMarker[id]=image("gfx/prosu/HitmarkerI.jpg",0,0,2,id)
imageblend(HitMarker[id],2)
imagealpha(HitMarker[id],0)
imagescale(HitMarker[id],0.3,0.3)
imagepos(HitMarker[id],320,240,0)
end

addhook("hit","codhitmark1")
function codhitmark1(vicid,sid,wpn,hpdmg,rmdmg,rwdmg)
parse("sv_sound2 "..sid.." \"prosu/HitmarkerS.wav\"")
imagealpha(HitMarker[sid],1)
tostring(sid)
timer(1000,"codhitmark2",sid)
end

function codhitmark2(sid)
tonumber(sid)
imagealpha(HitMarker[sid],0)
end

I solved the problem!
Thanks for helping!
edited 1×, last 22.02.15 01:32:41 pm

old Re: bad argument #1 to imagealpha (number expected)

Rainoth
Moderator Off Offline

Quote
why don't you try to write those commands directly where you'd write table index? I can't guarantee that it'll help but you could try and it would save space

1
HitMarker[tonumber(sid)]
or you could try
1
sid = tonumber(sid)
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview