Forum

> > CS2D > Scripts > TF2;2D bug reported
Forums overviewCS2D overview Scripts overviewLog in to reply

English TF2;2D bug reported

5 replies
To the start Previous 1 Next To the start

old TF2;2D bug reported

super123s
User Off Offline

Quote
Dear enginer
i found some bug in your mod two day ago
skins.lua:
Spoiler >

ERROR:LUA ERROR: sys/lua/skins.lua:23: attempt to call global 'contains' (a nil value)
FIX IT PLZZZZZZZZZ
P/S: http://unrealsoftware.de/files_show.php?file=3170
TF2-DOWN SITE

old Re: TF2;2D bug reported

palomino
User Off Offline

Quote
Maybe it's because you tried to edit it? HM? Everything is fine with the script, everyone's using it.

old Re: TF2;2D bug reported

EngiN33R
Moderator Off Offline

Quote
Attempt to call global 'contains'? That's bizarre. Try putting this function in the very beginning of skins.lua
1
2
3
4
5
6
7
8
function contains(table, element)
    for _, value in ipairs(table) do
        if value == element then
            return true
        end
    end
    return false
end

And tell me if it works.

old Re: TF2;2D bug reported

super123s
User Off Offline

Quote
new skins.lua
Spoiler >

CONSOLE RESPON:
ERROR:
LUA ERROR:
1
2
3
4
5
[12:25:43] LUA ERROR: [string "hat[2]=image(crafts[tf2.classes.hatunlock[2..."]:1: bad argument #1 to 'image' (string expected, got nil)
[12:25:43] LUA ERROR: [string "hat[3]=image(crafts[tf2.classes.hatunlock[3..."]:1: bad argument #1 to 'image' (string expected, got nil)
[12:25:43] LUA ERROR: [string "hat[4]=image(crafts[tf2.classes.hatunlock[4..."]:1: bad argument #1 to 'image' (string expected, got nil)
12:25:44] LUA ERROR: sys/lua/tf2.lua:665: attempt to index field '?' (a nil value)
[12:25:44] LUA ERROR: [string "hat[1]=image(crafts[tf2.classes.hatunlock[1..."]:1: bad argument #1 to 'image'

old Re: TF2;2D bug reported

EngiN33R
Moderator Off Offline

Quote
Well remove the entirety of the spawndebug hook and replace it with this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("spawn","tf2.classes.spawndebug")
function tf2.classes.spawndebug(id)
if (player(id,"armor")~=206) then
changeSkin(id,player(id,"weapontype"))
          timer(10,"parse","lua changeSkin("..id..",player("..id..",\"weapontype\"))")
          if (tf2.classes.hatunlock[id][tf2.classes.class[id]] and tf2.classes.hatunlock[id][tf2.classes.class[id]]~=0) then
               timer(10,"parse","lua freeimage("..hat[id]..")")
               timer(10,"parse","lua hat["..id.."]=image(crafts[tf2.classes.hatunlock["..id.."][tf2.classes.class["..id.."]]].image,1,0,200+"..id..")")
          else
               timer(10,"parse","lua freeimage("..hat[id]..")")
               timer(10,"parse","lua hat["..id.."]=0")
          end
end
end

Let's see if that works.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview