Forum

> > CS2D > Scripts > Lua error
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua error

8 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Lua error

Ace Howl
User Off Offline

Zitieren
Hello!
Do this code have any error? Because I got this message when starting up server. It does the error every minute.
Here's the message:
LUA ERROR: attempt to call nil value


And this is the lua:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
-- Updated version 2
-- Author: bKillThePlayer {109296}
-- External LUA --
--- Hook ---
addhook("spawn","id_spawn")
addhook("second","id_second")
addhook("minute","m_minute")
--- Player Misc. ---
-- Spawn
function id_spawn(id)
parse("equip "..id.." 74")
parse("setmoney "..id.." 0")
parse("setarmor "..id.." 50")
end
-- Money
function id_second()
     for _, id in pairs(player(0, "tableliving")) do
          parse("setmoney "..id.." "..(player(id, "money") + 100))
     end
end
-- Setting --
-- Server
parse("mp_roundtime 15") -- Server duration
parse("sv_gamemode 4") -- Server gamemode (Mode: Zombies!)
parse("mp_flashlight") -- Flashlight setting
parse("sv_fow") -- Fog of war setting
parse("sv_friendlyfire 0") -- Friendlyfire
parse("mp_infammo 0") -- Ammo setting
parse("mp_radar 0") -- Radar appearance
parse("mp_shotweakening 95") -- Bullet penetration (Decrease: 5)
parse("mp_damagefactor 0.8") -- Weapon effectivity
parse("mp_kevlar 0.9") -- Kevlar setting
parse("mp_zombiespeedmod 1") -- Zombie movement
parse("mp_zombiedmg 1.0") -- Zombie health
parse("mp_zombiekillequip 24") -- Zombie loot (Weapon: UMP45)
parse("mp_killteambuildings 2") -- Building destroyable
parse("mp_hud 25") -- HUD Visiblity
-- Security
parse("mp_antispeeder 1")
parse("mp_floodprot 1")
parse("sv_rcon ******")
-- Construction
parse("mp_killbuildingmoney 0")
parse('mp_building_limit "Dispenser" 0')
parse('mp_building_limit "Wall I" 50')
parse('mp_building_limit "Wall II" 0')
parse('mp_building_limit "Wall III" 0')
parse('mp_building_limit "Turret" 50')
parse('mp_building_limit "Supply" 50')
parse('mp_building_limit "Gate Field" 50')
parse('mp_building_limit "Barbed Wire" 25')
parse('mp_building_limit "Teleporter Entrance" 10')
parse('mp_building_limit "Teleporter Exit" 10')
parse('mp_building_price "Dispenser" 16000')
parse('mp_building_price "Wall II" 16000')
parse('mp_building_price "Wall III" 16000')
parse('mp_building_price "Wall I" 100')
parse('mp_building_price "Barricade" 50')
parse('mp_building_price "Turret" 2000')
parse('mp_building_price "Supply" 1000')
parse('mp_building_price "Gate Field" 200')
parse('mp_building_price "Barbed Wire" 250')
parse('mp_building_price "Teleporter Entrance" 750')
parse('mp_building_price "Teleporter Exit" 750')
parse("mp_killbuildings 3")
parse("mp_teleportreload 3")
-- Player
parse("mp_supply_items 61,80,30,10,22,66,65,90,83") --(PrimaryAmmo)(Armor)(AK47)(M3)(P90)(Coin)|(Bandage)(M134)(Super Armor)
parse("mp_deathdrop 4")
parse("mp_weaponfadeout 0")
parse("mp_wpndmg gutbomb 70")
parse("mp_wpndmg UMP45 14")
parse("mp_wpndmg Claw 62")
parse("mp_wpndmg Chainsaw 45")
parse("mp_respawndelay 5")
--- Misc. ---

Please help me. If this post looks like useless, pardon me. I keep getting that error. This makes me worry.

alt Re: Lua error

Marcell
Super User Off Offline

Zitieren
If you get error in every minutes, then the error may at the m_minute function...

alt Re: Lua error

EngiN33R
Moderator Off Offline

Zitieren
You basically showed us everything except what we need to see to help you. You need to post the m_minute function as well.

alt Re: Lua error

_Yank
User Off Offline

Zitieren
user EngiN33R hat geschrieben
You basically showed us everything except what we need to see to help you. You need to post the m_minute function as well.

He showed all the code i presume.
The problem is that he didnt wrote the m_minute function. So m_minute is nil, dont exists.

alt Re: Lua error

EngiN33R
Moderator Off Offline

Zitieren
user _Yank hat geschrieben
He showed all the code i presume.
The problem is that he didnt wrote the m_minute function. So m_minute is nil, dont exists.

Oh, that's a possibility I did not account for.

Is this true, user Ace Howl? If so, that there is your problem. Remove line 7, where you add the minute hook to m_minute, and it should be solved. Alternatively, assuming you actually want to do something each minute, define a new function called m_minute.

alt Misplacing

Ace Howl
User Off Offline

Zitieren
Ok. Sorry for that. Here's the code:
1
2
3
4
function m_minute()
	msg("©255255255This server is hosted by")
	msg("©000000225bKillThePlayer {109296}")
end
Its actually work but another problem shows up.
There, the problem:
IMG:https://i.imgur.com/a36XyT4.png

alt Re: Lua error

_Yank
User Off Offline

Zitieren
Change your file enconding to ANSI or ASCII i notepad ++ i really dont remember.
Im on my android.

EDIT : Engin33r way is pretty much easy.
2× editiert, zuletzt 03.11.13 10:03:51

alt Re: Lua error

EngiN33R
Moderator Off Offline

Zitieren
I'm pretty sure this is an issue with encoding, so either try saving your file in Unicode, or replace the copyright sign with \169 - I recommend the latter. So your function should be this:
1
2
3
4
function m_minute()
	msg("\169255255255This server is hosted by")
	msg("\169000000225bKillThePlayer {109296}")
end

alt Thanks

Ace Howl
User Off Offline

Zitieren
Thanks for the help guys. You are awesome in lua coding. √
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht