English Health Script Smart Peoples Needed :D

3 replies
Goto Page
To the start Previous 1 Next To the start
Up
KaBooMa
User
Offline Off
Ok so...Im working on a script and i im not super duper pro at lua...atleast not no more..ive used it for cs2d only and havent used it in a year so here is my script..Can you tell me how to stop it from saying attempt to perform arithmetic on Boolean. I know its cause its adding 1 to the player(id,'health') but how do i fix this?

Spoiler >
03.07.11 12:35:23 pm
Up
DannyDeth
User
Offline Off
lol, it is your 'super duper clever' ( [/sarcasm] ) use* of brackets.
Code:
1
2
3
4
5
for id=1,32 do
     if player(id,"exists")
          parse("sethealth "..id.." "..(player(id,"health")+1))
     end
end

This also stops you form trying to heal players that aren't there.
03.07.11 12:38:39 pm
Up
KaBooMa
User
Offline Off
haha thanks danny i get it now. i was adding to the wrong thing o.o haha awesome man love it and it works perfect thanks alot
04.07.11 11:52:45 pm
Up
PyKemis
User
Offline Off
Ah health regeneration.

If I may, this has a delay timer to make it even more realistic.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
addhook("ms100","_ms100")
addhook("hit","_hit")

v_delay=20 --20 = 2 seconds
t_wait={}

function _hit(id)
     t_wait[id]=0
end

function _ms100()
     if #t_wait~=0 then
          for key,value in pairs(t_wait) do
               t_wait[key]=t_wait[key]+1
                    if t_wait[key]>=v_delay then
                         parse("sethealth "..key.." "..player(key,"health")+1)
                    end
               end
          end
     end
end


So if a player is not hit for 2 seconds he will quickly regenerate.
To the start Previous 1 Next To the start