English Money System

6 replies
Goto Page
To the start Previous 1 Next To the start
20.06.12 01:19:58 pm
Up
CirtarTheEpic
BANNED
Offline Off
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 Names: Private Zanzetzu
20.06.12 01:24:15 pm
Up
Infinite Rain
Reviewer
Offline Off
add aligh parameter, it is missing
Also function f is never called
Try to rename function f to function _kill
A thousand may fall at your side, ten thousand at your right hand, but it will not come near you. You will only look with your eyes and see the recompense of the wicked. - Psalm 91:7-8 ESV
20.06.12 02:22:46 pm
Up
Alistaire
User
Offline Off
Also, you should change the money BEFORE calling a hud update command. Else it won't show.
IMG:http://i.imgur.com/5zhwOTP.png
20.06.12 05:13:35 pm
Up
Apache uwu
User
Offline Off
Code:
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.
20.06.12 07:57:06 pm
Up
omg
User
Offline Off
when a person leaves the server, any hudtxts on the player automatically disappear
will code for food
20.06.12 09:11:43 pm
Up
Kisses
User
Offline Off
@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.
probably hate me, I do too
21.06.12 05:06:11 am
Up
omg
User
Offline Off
u know thats essentially the same thing, right?
will code for food
To the start Previous 1 Next To the start