Forum

> > CS2D > Scripts > Scout wpndmg problem
Forums overviewCS2D overview Scripts overviewLog in to reply

English Scout wpndmg problem

15 replies
To the start Previous 1 Next To the start

old Scout wpndmg problem

Mechanolith
User Off Offline

Quote
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...

old Answer

Fiz
User Off Offline

Quote
Here it is:

1
parse("mp_wpndmg scout 25")

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

old Re: Scout wpndmg problem

Mechanolith
User Off Offline

Quote
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]: ?

old Re: Scout wpndmg problem

Lee
Moderator Off Offline

Quote
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?

old Re: Scout wpndmg problem

Mechanolith
User Off Offline

Quote
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".

old Re: Scout wpndmg problem

palomino
User Off Offline

Quote
user Mechanolith has written
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).

old Re: Scout wpndmg problem

Lee
Moderator Off Offline

Quote
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.

old Re: Scout wpndmg problem

EngiN33R
Moderator Off Offline

Quote
user Mechanolith has written
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?

old Re: Scout wpndmg problem

Mechanolith
User Off Offline

Quote
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?
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview