Forum

> > CS2D > Scripts > Scout wpndmg problem
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Scout wpndmg problem

15 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Scout wpndmg problem

Mechanolith
User Off Offline

Zitieren
I'm trying to make a simple script, just balancing the weapons in CS2D, it was everything ok before i reach this part:
1
2
3
4
addhook("startround","wpndmg")
function wpndmg
	parse ("mp_wpndmg scout 25")
end

I already tried using the Scout id (which is 34) and it still didn't worked.
What is the problem?
Error code:
1
lua:10: '(' expected near 'parse'

I already tried using space between "parse" and "(" and it doesn't worked, i tried removing the space and it still didn't worked... Can anyone help? I know this should be the most idiot problem/question ever...

alt Answer

Fiz
User Off Offline

Zitieren
Here it is:

1
parse("mp_wpndmg scout 25")

The above line is all you need.
No 'addhooks' needed.

alt Re: Scout wpndmg problem

Mechanolith
User Off Offline

Zitieren
illegal Error:
1
2
3
4
lua: Test.lua:8: attempt to call global 'parse' (a nil value)
stack traceback:
	Test.lua:8: in main chunk
	[C]: ?

alt Re: Scout wpndmg problem

Lee
Moderator Off Offline

Zitieren
1
2
3
4
lua: Test.lua:8: attempt to call global 'parse' (a nil value)
stack traceback:
	Test.lua:8: in main chunk
	[C]: ?

This tells me that the stack trace doesn't extend back to server.lua...

Are you running this in CS2D? What's in server.lua and every file that it loads before Test.lua?

alt Re: Scout wpndmg problem

Mechanolith
User Off Offline

Zitieren
It's actually for a map, for balancing the gameplay on it.

It's on the "maps" folder with the name of the map (for auto-executing when the map opens). So it has nothing with the "server.lua".

alt Re: Scout wpndmg problem

palomino
User Off Offline

Zitieren
user Mechanolith hat geschrieben
It's actually for a map, for balancing the gameplay on it.

It's on the "maps" folder with the name of the map (for auto-executing when the map opens). So it has nothing with the "server.lua".

Yes it does. Both scripts are executed on server start (aka opening the map).

alt Re: Scout wpndmg problem

Lee
Moderator Off Offline

Zitieren
Well then, put the following in your code and see what comes up.

1
for k in pairs(_G) do print(tostring(k)) end

(Put this before the error for obvious reasons...)

For one reason or another, parse apparently hasn't been declared yet, or it's only injected as a local into server.lua and serves as upvalues for all subsequent calls. This is unlikely however.

What else do you have in your file? If you're not careful, you may have unwittingly overwritten parse with a nil value.

alt Re: Scout wpndmg problem

EngiN33R
Moderator Off Offline

Zitieren
user Mechanolith hat geschrieben
illegal Error:
1
2
3
4
lua: Test.lua:8: attempt to call global 'parse' (a nil value)
stack traceback:
	Test.lua:8: in main chunk
	[C]: ?


This doesn't look like a CS2D error. Maybe your debugger doesn't know the parse function?

alt Re: Scout wpndmg problem

Mechanolith
User Off Offline

Zitieren
Thanks everyone, it worked.
But how to i change the grenade launcher damage? Since it's 2 names for 1 gun, maybe glauncher or grenadelauncher?
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht