Forum

> > CS2D > Scripts > Money System
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Money System

6 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Money System

CirtarTheEpic
BANNED Off Offline

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

alt Re: Money System

Infinite Rain
Reviewer Off Offline

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

alt Re: Money System

Alistaire
User Off Offline

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

alt Re: Money System

Apache uwu
User Off Offline

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

alt Re: Money System

omg
User Off Offline

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

alt Re: Money System

Kisses
User Off Offline

Zitieren
@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.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht