Forum

> > CS2D > Scripts > expected number, got nil
Forums overviewCS2D overview Scripts overviewLog in to reply

English expected number, got nil

2 replies
To the start Previous 1 Next To the start

old expected number, got nil

8Ball
User Off Offline

Quote
1
2
3
4
5
6
7
8
addhook("second","hudupdate")
function hudupdate()
     if player(id,"weapontype")==50 then --bad argument #1 to 'player' (number expected, got nil)
          parse(hudtxt2 2 \"knife\" 10 435 0")
     elseif player(id,"weapontype")==78 then --ditto
          parse("hudtxt2 3 \"Claw\" 10 435 0")
     end
end

Why am i getting this?

inb4 facepalms

old Re: expected number, got nil

Dousea
User Off Offline

Quote
function hudupdate ()
	for index, id in pairs (player (0, "tableliving")) do
		if (player (id, "weapontype") == 50) then
			parse ("hudtxt2 " .. id .. " 0 \"Knife\" 10 435 0")
		else if (player (id, "weapontype") == 78) then
			parse ("hudtxt2 " .. id .. " 0 \"Claw\" 10 435 0")
		end
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview