Forum

> > CS2D > Scripts > What's wrong with this code?
Forums overviewCS2D overview Scripts overviewLog in to reply

English What's wrong with this code?

4 replies
To the start Previous 1 Next To the start

old What's wrong with this code?

4729
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
addhook("second","x.second")

x.time=0

function x.second()
	x.time=x.time+1
	if x.time>=3 then
		x.time=0
		parse("setmoney "..id.." "..0)
	end
end

Why will go wrong?

and this code

1
2
3
4
5
6
7
8
9
addhook("walkover","x.wo")

function x.wo(id,idd,type)
	if type>=66 and type<=66 then
		parse("setmoney "..id.." "..0)
	return 0
	end
return 0
end

When I pick up COINS from 0 to 100 money will not change.
sorry, my english is very bad.

old Re: What's wrong with this code?

Avo
User Off Offline

Quote
1
2
3
4
5
6
7
function x.second()
     x.time=x.time+1
     if x.time>=3 then
          x.time=0
          parse("setmoney "..id.." "..0)
     end
end
In this function, id is nil value.Fixed:
1
2
3
4
5
6
7
8
9
function x.second()
     x.time=x.time+1
     if x.time>=3 then
          x.time=0
	 for id=1,32 do
		parse("setmoney "..id.." "..0)
	 end 
     end
end
But I don't see sense in this part of code. Setting money to 0 every 3 seconds?
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview