Forum

> > CS2D > Scripts > Money System
Forums overviewCS2D overview Scripts overviewLog in to reply

English Money System

6 replies
To the start Previous 1 Next To the start

old Money System

CirtarTheEpic
BANNED Off Offline

Quote
Hey Guys Some Problem now

--------------------------
--INITIAL SETUP--
--------------------------
function initArray(m)
     local array = {}
     for i = 1, m do
          array[i]=0
     end
     return array
end

money=initArray(32,0)

addhook("kill","_kill")
function f(id)
_hud(id)
money[id] = money[id] + 500
end

function _hud(id)
parse('hudtxt2 '..id..' 6 "©255128000Money: '..money[id]..'" 10 195')
end

-- the game works but the hud never works..

old Re: Money System

Infinite Rain
Reviewer Off Offline

Quote
add aligh parameter, it is missing
Also function f is never called
Try to rename function f to function _kill

old Re: Money System

Alistaire
User Off Offline

Quote
Also, you should change the money BEFORE calling a hud update command. Else it won't show.

old Re: Money System

Apache uwu
User Off Offline

Quote
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
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end

money=initArray(32,0)

addhook("kill","_kill")

function _kill(id)
	money[id] = money[id] + 500
	_hud(id)
end

function _hud(id)
	parse('hudtxt2 '..id..' 6 "©255128000Money: '..money[id]..'" 10 195')
end

addhook("join","_join")

function _join(id)
	_hudremove(id)
end

function _hudremove(id)
	parse('hudtxt2 '..id..' 6 "" 10 195')
end

Please encase your code in [code][/code] tags.

I've added a join hook that removes hudtxt--if it remains from a last user.

old Re: Money System

omg
User Off Offline

Quote
when a person leaves the server, any hudtxts on the player automatically disappear

old Re: Money System

Kisses
User Off Offline

Quote
@user omg:
When a new player connects, the server won't atomatically send hudtxt packets as they are stored in client, not in the server.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview