English Number Expected, Got Nil.

4 replies
Goto Page
To the start Previous 1 Next To the start
21.09.15 05:59:26 pm
Up
Mami Tomoe
User
Offline Off
I searched for a fix but all I got was a fixed code and since I use a different code I cant use it...

Spoiler >


Error:
Code:
1
2
3
4
LUA ERROR: sys/lua/autorun/exp.lua:108: bad argument #1 to 'player' (number expected,
got nil)
 -> [C]: in function 'player'
 -> sys/lua/autorun/exp.lua:108: in function <sys/lua/autorun/exp.lua:107>
fish
21.09.15 06:54:55 pm
Up
DC
Admin
Offline Off
The error is very self-explanatory actually.

• The erroneous line is 108 which is in your code
Code:
1
name = player(id,"name")


• The problem is argument #1 of the function call "player". So it's id

• The actual value of the argument (id) is nil (= undefined) but a number is expected by CS2D. Otherwise CS2D cannot know of which player you want to get the name!

√ Solution: You either have to save a value in id or you have to replace id with another variable which contains a valid value.

You are actually calling that function from the hook cs2d lua hook ms100 which does NOT provide a player ID because it is not related to any specific player. So the question is for what player do you want to do this stuff? For every player? Then you should build a loop around it. Or for just one? Then you should just pass the right ID!
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
21.09.15 07:52:49 pm
Up
Mami Tomoe
User
Offline Off
@user DC: I want it to every single ID on the universe!
fish
21.09.15 07:58:05 pm
Up
TimeQuesT
User
Offline Off
Just move that cmd 2 lines down.
Muh
21.09.15 08:22:29 pm
Up
Mami Tomoe
User
Offline Off
@user TimeQuesT: What

Edit: OHHH For some reason my eyes saw "delete this cmd 2 lines down" and it confused me, thanks it worked!
edited 1×, last 21.09.15 08:46:35 pm
fish
To the start Previous 1 Next To the start