Forum

> > CS2D > Scripts > Can't find "nil" variable
Forums overviewCS2D overview Scripts overviewLog in to reply

English Can't find "nil" variable

14 replies
To the start Previous 1 Next To the start

old Can't find "nil" variable

Obviously Exactly Myself
User Off Offline

Quote
There was some bug happening to my script, I think it was because it gives me an error message every 10 seconds.
The error message was "LUA ERROR: attempt to call a nil value".
It didn't tell what line, I took me hours trying to find the line.

Script >

old Re: Can't find "nil" variable

Infinite Rain
Reviewer Off Offline

Quote
Error is here:
1
2
3
4
5
--No buying
addhook("buy","tank_buy")
function tank_drop(id,x,y)
     return 1
end

Try to find it yourself.

Hint: Lua error that is without line, means that one of the hooks don't have a function.

old Re: Can't find "nil" variable

Obviously Exactly Myself
User Off Offline

Quote
Another question:
There is something wrong with the "ms100" hook, when a player spawns, there is a lot of chance that the 2 images gets removed and rarely, appears minutes later.

New MS100 Hook >

old Re: Can't find "nil" variable

EndDead
User Off Offline

Quote
use the spawn, die and leave hook insted.
what you are doing is generating an image every ms if the player is alive.

/Yates

old Re: Can't find "nil" variable

Obviously Exactly Myself
User Off Offline

Quote
This is what is happening, if you look to the right, there are 3 CTs, 2 of them have no sprites.
IMG:https://s15.postimage.org/5qhtkg6qz/tank_grassy_00003.jpg

Sometimes, it only shows the cannon or the base only.

BTW, >


---EDIT---

@user EndDead: It only tells what are the lua stuff but it doesn't fix your script.
edited 2×, last 22.02.13 05:59:38 am

old Re: Can't find "nil" variable

Yates
Reviewer Off Offline

Quote
@user Obviously Exactly Myself: You need to use the correct image options to make the image follow the player. Use the damn spawn, die and leave hook. Your script is basically rubbish.

Also cs2d.com/help is not there to magically fix your scripts as it couldn't possibly know what you want. It is there for help and help only. Do not script if you cannot even read properly from a site that is there to help you.

old Re: Can't find "nil" variable

Obviously Exactly Myself
User Off Offline

Quote
Part of the script:
Spoiler >

Those are the only parts with the word "image" in it.

EDIT: BTW, if none understands much, I meant that I want "tankimg" to rotate to "tankrot" with the "tankpic" rotating to the player.
As the button above shows.
edited 2×, last 26.02.13 12:49:46 pm

old Re: Can't find "nil" variable

EngiN33R
Moderator Off Offline

Quote
Try changing your tank_always function to this.

1
2
3
4
5
6
7
8
--Position tank
addhook("always","tank_always")
function tank_always()
     local playerlist=player(0,"tableliving")
     for _,id in pairs(playerlist) do
          imagepos(tankimg[id],0,1,tankrot[id])
     end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview